-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #257 from Exifly/main
Bump to v2.2.0
- Loading branch information
Showing
49 changed files
with
1,684 additions
and
616 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,43 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 ApiVault | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0) | ||
|
||
Creative Commons Corporation ("Creative Commons") is not a law firm and does not provide legal services. Distributing this license does not create an attorney-client relationship. Creative Commons provides this information on an "as-is" basis. Creative Commons makes no warranties regarding the information provided, and disclaims liability for damages resulting from its use. | ||
|
||
License | ||
|
||
The authors of the work (hereinafter referred to as "you" or "the authors") grant you the non-exclusive rights to use the described work under the following terms: | ||
|
||
Title: Apivault | ||
Authors: Giovanni D'Andrea, Flavio Adamo | ||
|
||
1. Definitions | ||
|
||
a. "Derivative Works" means any work that is based on or derived from the original work, including the work based on the original work and expressing the original author's views or opinions. | ||
b. "Commercial Use" means use of the work for any purpose that is primarily intended for or directed toward commercial advantage or private monetary compensation. | ||
c. "Licenses Granted" are the additional restrictions that apply to the work under this license. | ||
|
||
2. License Grant | ||
|
||
Subject to the terms and conditions of this license, the authors grant you a worldwide, non-exclusive, non-sublicensable, revocable, and royalty-free license to: | ||
|
||
a. Reproduce, distribute, and publicly communicate the work, including derivative works, under the terms of this license. | ||
b. Attribute the authors as suggested by the authors or requested by them. | ||
|
||
3. Restrictions | ||
|
||
This license is subject to the following restrictions: | ||
|
||
a. NonCommercial Use: You may not use the work for Commercial Use. | ||
b. No Derivative Works: You may not modify, adapt, or build upon the original work to create a Derivative Work. | ||
c. License Application: Any use or distribution of the work or derivative works must be made in compliance with the terms of this license and must attribute the authors as suggested by the authors or requested by them. | ||
|
||
4. Other Conditions | ||
|
||
a. Waivers: The authors provide the work "as is" and make no warranties regarding the work, express or implied, and disclaim liability for damages resulting from using the work. | ||
b. Limitation of Liability: In no event will the authors be liable to you or any third party for any damages, including any lost profits, lost savings, or other incidental or consequential damages arising out of the use or inability to use the work, even if advised of the possibility of such damages. | ||
c. Termination of License: Any use or distribution of the work in violation of the terms of this license will automatically terminate your rights under this license, without prejudice to any legal rights and remedies the authors may have. | ||
|
||
Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with the authors regarding the work or any separate legal agreements between you and the authors. | ||
|
||
This license is governed and interpreted under the laws of the state where the authors have their primary residence, without giving effect to any principles of conflicts of law. | ||
|
||
The complete and official version of the CC BY-NC-ND 4.0 license can be found at the following address: https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
class ApiFilterMixin: | ||
def get_ordering_fields(self): | ||
ordering = self.request.query_params.get('order', None) | ||
allowed_fields = [field.lstrip('-') for field in getattr(self, 'allowed_order_field', [])] | ||
|
||
if ordering and ordering.lstrip('-') in allowed_fields: | ||
return (ordering,) | ||
|
||
return None | ||
|
||
|
||
def apply_ordering(self, queryset): | ||
ordering_fields = self.get_ordering_fields() | ||
if ordering_fields: | ||
return queryset.order_by(*ordering_fields) | ||
return queryset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
backend/authentication/migrations/0002_defaultuser_picture.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
from .models import Like, Feedback | ||
from django.contrib import admin | ||
from .models import Like | ||
|
||
|
||
class CustomFeedbacksAdmin(admin.ModelAdmin): | ||
list_display = ("id", "email", "message", "user") | ||
search_fields = ("name", "id") | ||
|
||
|
||
admin.site.register(Like) | ||
admin.site.register(Feedback, CustomFeedbacksAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 4.2.3 on 2023-07-21 11:11 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('interaction', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Feedback', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(blank=True, max_length=30, null=True)), | ||
('email', models.EmailField(blank=True, max_length=254, null=True)), | ||
('message', models.TextField(max_length=150)), | ||
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from rest_framework import serializers | ||
from interaction.models import ( | ||
Feedback | ||
) | ||
|
||
class FeedbackSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Feedback | ||
fields = ["name", "email", "message"] | ||
read_only_fields = ["user"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from django.urls import path | ||
from .api import LikeAPIView | ||
from .api import LikeAPIView, FeedbackView | ||
|
||
urlpatterns = [ | ||
path('/like/<int:api_id>/', LikeAPIView.as_view(), name='like-api'), | ||
path('/feedback/', FeedbackView.as_view(), name='feedback') | ||
] |
Oops, something went wrong.