Browse Source

Add API support for restaurant addition and filtering

master
Apostolos Fanakis 6 years ago
parent
commit
a732dadcb0
  1. BIN
      UI/Database API/hyrieus/flavoursAPI/__pycache__/__init__.cpython-35.pyc
  2. BIN
      UI/Database API/hyrieus/flavoursAPI/__pycache__/settings.cpython-35.pyc
  3. BIN
      UI/Database API/hyrieus/flavoursAPI/__pycache__/urls.cpython-35.pyc
  4. BIN
      UI/Database API/hyrieus/flavoursAPI/__pycache__/wsgi.cpython-35.pyc
  5. BIN
      UI/Database API/hyrieus/flavoursAPI/hyrieus/__pycache__/__init__.cpython-35.pyc
  6. BIN
      UI/Database API/hyrieus/flavoursAPI/hyrieus/__pycache__/admin.cpython-35.pyc
  7. BIN
      UI/Database API/hyrieus/flavoursAPI/hyrieus/__pycache__/models.cpython-35.pyc
  8. BIN
      UI/Database API/hyrieus/flavoursAPI/hyrieus/__pycache__/serializers.cpython-35.pyc
  9. BIN
      UI/Database API/hyrieus/flavoursAPI/hyrieus/__pycache__/urls.cpython-35.pyc
  10. BIN
      UI/Database API/hyrieus/flavoursAPI/hyrieus/__pycache__/views.cpython-35.pyc
  11. 7
      UI/Database API/hyrieus/flavoursAPI/hyrieus/admin.py
  12. 116
      UI/Database API/hyrieus/flavoursAPI/hyrieus/migrations/0001_initial.py
  13. BIN
      UI/Database API/hyrieus/flavoursAPI/hyrieus/migrations/__pycache__/0001_initial.cpython-35.pyc
  14. BIN
      UI/Database API/hyrieus/flavoursAPI/hyrieus/migrations/__pycache__/__init__.cpython-35.pyc
  15. 66
      UI/Database API/hyrieus/flavoursAPI/hyrieus/models.py
  16. 48
      UI/Database API/hyrieus/flavoursAPI/hyrieus/serializers.py
  17. 30
      UI/Database API/hyrieus/flavoursAPI/hyrieus/urls.py
  18. 294
      UI/Database API/hyrieus/flavoursAPI/hyrieus/views.py
  19. 32
      UI/Database API/hyrieus/flavoursAPI/settings.py

BIN
UI/Database API/hyrieus/flavoursAPI/__pycache__/__init__.cpython-35.pyc

Binary file not shown.

BIN
UI/Database API/hyrieus/flavoursAPI/__pycache__/settings.cpython-35.pyc

Binary file not shown.

BIN
UI/Database API/hyrieus/flavoursAPI/__pycache__/urls.cpython-35.pyc

Binary file not shown.

BIN
UI/Database API/hyrieus/flavoursAPI/__pycache__/wsgi.cpython-35.pyc

Binary file not shown.

BIN
UI/Database API/hyrieus/flavoursAPI/hyrieus/__pycache__/__init__.cpython-35.pyc

Binary file not shown.

BIN
UI/Database API/hyrieus/flavoursAPI/hyrieus/__pycache__/admin.cpython-35.pyc

Binary file not shown.

BIN
UI/Database API/hyrieus/flavoursAPI/hyrieus/__pycache__/models.cpython-35.pyc

Binary file not shown.

BIN
UI/Database API/hyrieus/flavoursAPI/hyrieus/__pycache__/serializers.cpython-35.pyc

Binary file not shown.

BIN
UI/Database API/hyrieus/flavoursAPI/hyrieus/__pycache__/urls.cpython-35.pyc

Binary file not shown.

BIN
UI/Database API/hyrieus/flavoursAPI/hyrieus/__pycache__/views.cpython-35.pyc

Binary file not shown.

7
UI/Database API/hyrieus/flavoursAPI/hyrieus/admin.py

@ -1,5 +1,10 @@
from django.contrib import admin from django.contrib import admin
from .models import Diet, DietProhibitsIngredient, Drink, DrinkHasIngredient, Food, FoodHasIngredient, Ingredient, Permission, Restaurant, Role, RoleHasPermission, User, UserFollowsDiet, UserProhibitsIngredient, UserRatesDrink, UserRatesFood, UserRatesRestaurant from .models import (Diet,
DietProhibitsIngredient, Drink, DrinkHasIngredient, Food, FoodHasIngredient,
Ingredient, Permission, Restaurant, Role, RoleHasPermission, User,
UserFollowsDiet, UserProhibitsIngredient, UserRatesDrink, UserRatesFood,
UserRatesRestaurant,
)
admin.site.register(Diet) admin.site.register(Diet)
admin.site.register(DietProhibitsIngredient) admin.site.register(DietProhibitsIngredient)

116
UI/Database API/hyrieus/flavoursAPI/hyrieus/migrations/0001_initial.py

@ -1,7 +1,11 @@
# Generated by Django 2.1.4 on 2019-01-04 16:17 # Generated by Django 2.1.4 on 2019-01-09 11:35
from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration): class Migration(migrations.Migration):
@ -9,20 +13,46 @@ class Migration(migrations.Migration):
initial = True initial = True
dependencies = [ dependencies = [
('auth', '0009_alter_user_last_name_max_length'),
] ]
operations = [ operations = [
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('user_age', models.DateField(null=True)),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
],
options={
'managed': True,
'db_table': 'user',
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
migrations.CreateModel( migrations.CreateModel(
name='Diet', name='Diet',
fields=[ fields=[
('diet_id', models.IntegerField(primary_key=True, serialize=False)), ('diet_id', models.AutoField(primary_key=True, serialize=False)),
('diet_name', models.CharField(max_length=500)), ('diet_name', models.CharField(max_length=500)),
('diet_description', models.CharField(blank=True, max_length=700, null=True)), ('diet_description', models.CharField(blank=True, max_length=700, null=True)),
('diet_is_approved', models.BooleanField(default=False)), ('diet_is_approved', models.BooleanField(default=False)),
], ],
options={ options={
'db_table': 'diet',
'managed': True, 'managed': True,
'db_table': 'diet',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -32,21 +62,21 @@ class Migration(migrations.Migration):
('diet', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Diet')), ('diet', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Diet')),
], ],
options={ options={
'db_table': 'diet_prohibits_ingredient',
'managed': True, 'managed': True,
'db_table': 'diet_prohibits_ingredient',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
name='Drink', name='Drink',
fields=[ fields=[
('drink_id', models.IntegerField(primary_key=True, serialize=False)), ('drink_id', models.AutoField(primary_key=True, serialize=False)),
('drink_name', models.CharField(max_length=500)), ('drink_name', models.CharField(max_length=500)),
('drink_description', models.CharField(blank=True, max_length=700, null=True)), ('drink_description', models.CharField(blank=True, max_length=700, null=True)),
('drink_is_approved', models.BooleanField(default=False)), ('drink_is_approved', models.BooleanField(default=False)),
], ],
options={ options={
'db_table': 'drink',
'managed': True, 'managed': True,
'db_table': 'drink',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -56,22 +86,22 @@ class Migration(migrations.Migration):
('drink', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Drink')), ('drink', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Drink')),
], ],
options={ options={
'db_table': 'drink_has_ingredient',
'managed': True, 'managed': True,
'db_table': 'drink_has_ingredient',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
name='Food', name='Food',
fields=[ fields=[
('food_id', models.IntegerField(primary_key=True, serialize=False)), ('food_id', models.AutoField(primary_key=True, serialize=False)),
('food_name', models.CharField(max_length=500)), ('food_name', models.CharField(max_length=500)),
('food_description', models.CharField(blank=True, max_length=700, null=True)), ('food_description', models.CharField(blank=True, max_length=700, null=True)),
('food_calories', models.IntegerField(blank=True, null=True)), ('food_calories', models.IntegerField(blank=True, null=True)),
('food_is_approved', models.BooleanField(default=False)), ('food_is_approved', models.BooleanField(default=False)),
], ],
options={ options={
'db_table': 'food',
'managed': True, 'managed': True,
'db_table': 'food',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -81,8 +111,8 @@ class Migration(migrations.Migration):
('food', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Food')), ('food', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Food')),
], ],
options={ options={
'db_table': 'food_has_ingredient',
'managed': True, 'managed': True,
'db_table': 'food_has_ingredient',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -92,25 +122,25 @@ class Migration(migrations.Migration):
('ingredient_has_alcohol', models.BooleanField(blank=True, default=False, null=True)), ('ingredient_has_alcohol', models.BooleanField(blank=True, default=False, null=True)),
], ],
options={ options={
'db_table': 'ingredient',
'managed': True, 'managed': True,
'db_table': 'ingredient',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
name='Permission', name='Permission',
fields=[ fields=[
('permission_id', models.IntegerField(primary_key=True, serialize=False)), ('permission_id', models.AutoField(primary_key=True, serialize=False)),
('permission_description', models.CharField(max_length=700)), ('permission_description', models.CharField(max_length=700)),
], ],
options={ options={
'db_table': 'permission',
'managed': True, 'managed': True,
'db_table': 'permission',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
name='Restaurant', name='Restaurant',
fields=[ fields=[
('restaurant_id', models.IntegerField(primary_key=True, serialize=False)), ('restaurant_id', models.AutoField(primary_key=True, serialize=False)),
('restaurant_name', models.CharField(max_length=500)), ('restaurant_name', models.CharField(max_length=500)),
('restaurant_category', models.CharField(max_length=10)), ('restaurant_category', models.CharField(max_length=10)),
('restaurant_longitude', models.FloatField()), ('restaurant_longitude', models.FloatField()),
@ -118,10 +148,11 @@ class Migration(migrations.Migration):
('restaurant_opening', models.TimeField(blank=True, null=True)), ('restaurant_opening', models.TimeField(blank=True, null=True)),
('restaurant_closing', models.TimeField(blank=True, null=True)), ('restaurant_closing', models.TimeField(blank=True, null=True)),
('restaurant_is_approved', models.BooleanField(default=False)), ('restaurant_is_approved', models.BooleanField(default=False)),
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
], ],
options={ options={
'db_table': 'restaurant',
'managed': True, 'managed': True,
'db_table': 'restaurant',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -132,8 +163,8 @@ class Migration(migrations.Migration):
('role_description', models.CharField(max_length=700)), ('role_description', models.CharField(max_length=700)),
], ],
options={ options={
'db_table': 'role',
'managed': True, 'managed': True,
'db_table': 'role',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -144,24 +175,8 @@ class Migration(migrations.Migration):
('role', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Role')), ('role', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Role')),
], ],
options={ options={
'db_table': 'role_has_permission',
'managed': True,
},
),
migrations.CreateModel(
name='User',
fields=[
('user_id', models.IntegerField(primary_key=True, serialize=False)),
('user_email', models.CharField(max_length=500)),
('user_username', models.CharField(max_length=500)),
('user_hashed_password', models.CharField(max_length=64)),
('user_salt', models.CharField(max_length=32)),
('user_age', models.DateField()),
('role', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Role')),
],
options={
'db_table': 'user',
'managed': True, 'managed': True,
'db_table': 'role_has_permission',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -169,11 +184,11 @@ class Migration(migrations.Migration):
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('diet', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Diet')), ('diet', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Diet')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.User')), ('user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
], ],
options={ options={
'db_table': 'user_follows_diet',
'managed': True, 'managed': True,
'db_table': 'user_follows_diet',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -181,11 +196,11 @@ class Migration(migrations.Migration):
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('ingredient_name', models.ForeignKey(db_column='ingredient_name', on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Ingredient')), ('ingredient_name', models.ForeignKey(db_column='ingredient_name', on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Ingredient')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.User')), ('user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
], ],
options={ options={
'db_table': 'user_prohibits_ingredient',
'managed': True, 'managed': True,
'db_table': 'user_prohibits_ingredient',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -197,11 +212,11 @@ class Migration(migrations.Migration):
('rating_text', models.CharField(blank=True, max_length=700, null=True)), ('rating_text', models.CharField(blank=True, max_length=700, null=True)),
('rating_pοrtion_size', models.CharField(blank=True, max_length=6, null=True)), ('rating_pοrtion_size', models.CharField(blank=True, max_length=6, null=True)),
('drink', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Drink')), ('drink', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Drink')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.User')), ('user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
], ],
options={ options={
'db_table': 'user_rates_drink',
'managed': True, 'managed': True,
'db_table': 'user_rates_drink',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -213,11 +228,11 @@ class Migration(migrations.Migration):
('rating_text', models.CharField(blank=True, max_length=700, null=True)), ('rating_text', models.CharField(blank=True, max_length=700, null=True)),
('rating_pοrtion_size', models.CharField(blank=True, max_length=6, null=True)), ('rating_pοrtion_size', models.CharField(blank=True, max_length=6, null=True)),
('food', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Food')), ('food', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Food')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.User')), ('user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
], ],
options={ options={
'db_table': 'user_rates_food',
'managed': True, 'managed': True,
'db_table': 'user_rates_food',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -230,18 +245,13 @@ class Migration(migrations.Migration):
('rating_accessibility', models.CharField(blank=True, max_length=8, null=True)), ('rating_accessibility', models.CharField(blank=True, max_length=8, null=True)),
('diet', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Diet')), ('diet', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Diet')),
('restaurant', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Restaurant')), ('restaurant', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Restaurant')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.User')), ('user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
], ],
options={ options={
'db_table': 'user_rates_restaurant',
'managed': True, 'managed': True,
'db_table': 'user_rates_restaurant',
}, },
), ),
migrations.AddField(
model_name='restaurant',
name='user',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.User'),
),
migrations.AddField( migrations.AddField(
model_name='foodhasingredient', model_name='foodhasingredient',
name='ingredient_name', name='ingredient_name',
@ -267,6 +277,16 @@ class Migration(migrations.Migration):
name='ingredient_name', name='ingredient_name',
field=models.ForeignKey(db_column='ingredient_name', on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Ingredient'), field=models.ForeignKey(db_column='ingredient_name', on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Ingredient'),
), ),
migrations.AddField(
model_name='user',
name='role',
field=models.ForeignKey(default=0, on_delete=django.db.models.deletion.DO_NOTHING, to='hyrieus.Role'),
),
migrations.AddField(
model_name='user',
name='user_permissions',
field=models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions'),
),
migrations.AlterUniqueTogether( migrations.AlterUniqueTogether(
name='userratesrestaurant', name='userratesrestaurant',
unique_together={('user', 'restaurant')}, unique_together={('user', 'restaurant')},

BIN
UI/Database API/hyrieus/flavoursAPI/hyrieus/migrations/__pycache__/0001_initial.cpython-35.pyc

Binary file not shown.

BIN
UI/Database API/hyrieus/flavoursAPI/hyrieus/migrations/__pycache__/__init__.cpython-35.pyc

Binary file not shown.

66
UI/Database API/hyrieus/flavoursAPI/hyrieus/models.py

@ -1,7 +1,26 @@
from django.db import models from django.db import models
from django.contrib.auth.models import AbstractUser
from django.conf import settings
class Role(models.Model):
role_id = models.IntegerField(primary_key=True)
role_name = models.CharField(max_length=500)
role_description = models.CharField(max_length=700)
class Meta:
managed = True
db_table = 'role'
class User(AbstractUser):
role = models.ForeignKey(Role, models.DO_NOTHING, default=0)
user_age = models.DateField(null=True)
class Meta:
managed = True
db_table = 'user'
class Diet(models.Model): class Diet(models.Model):
diet_id = models.IntegerField(primary_key=True) diet_id = models.AutoField(primary_key=True)
diet_name = models.CharField(max_length=500) diet_name = models.CharField(max_length=500)
diet_description = models.CharField(max_length=700, blank=True, null=True) diet_description = models.CharField(max_length=700, blank=True, null=True)
diet_is_approved = models.BooleanField(default=False) diet_is_approved = models.BooleanField(default=False)
@ -21,7 +40,7 @@ class DietProhibitsIngredient(models.Model):
unique_together = (('diet', 'ingredient_name'),) unique_together = (('diet', 'ingredient_name'),)
class Drink(models.Model): class Drink(models.Model):
drink_id = models.IntegerField(primary_key=True) drink_id = models.AutoField(primary_key=True)
drink_name = models.CharField(max_length=500) drink_name = models.CharField(max_length=500)
drink_description = models.CharField(max_length=700, blank=True, null=True) drink_description = models.CharField(max_length=700, blank=True, null=True)
drink_is_approved = models.BooleanField(default=False) drink_is_approved = models.BooleanField(default=False)
@ -43,7 +62,7 @@ class DrinkHasIngredient(models.Model):
class Food(models.Model): class Food(models.Model):
food_id = models.IntegerField(primary_key=True) food_id = models.AutoField(primary_key=True)
food_name = models.CharField(max_length=500) food_name = models.CharField(max_length=500)
food_description = models.CharField(max_length=700, blank=True, null=True) food_description = models.CharField(max_length=700, blank=True, null=True)
food_calories = models.IntegerField(blank=True, null=True) food_calories = models.IntegerField(blank=True, null=True)
@ -74,7 +93,7 @@ class Ingredient(models.Model):
class Permission(models.Model): class Permission(models.Model):
permission_id = models.IntegerField(primary_key=True) permission_id = models.AutoField(primary_key=True)
permission_description = models.CharField(max_length=700) permission_description = models.CharField(max_length=700)
class Meta: class Meta:
@ -83,7 +102,7 @@ class Permission(models.Model):
class Restaurant(models.Model): class Restaurant(models.Model):
restaurant_id = models.IntegerField(primary_key=True) restaurant_id = models.AutoField(primary_key=True)
restaurant_name = models.CharField(max_length=500) restaurant_name = models.CharField(max_length=500)
restaurant_category = models.CharField(max_length=10) restaurant_category = models.CharField(max_length=10)
restaurant_longitude = models.FloatField() restaurant_longitude = models.FloatField()
@ -91,23 +110,12 @@ class Restaurant(models.Model):
restaurant_opening = models.TimeField(blank=True, null=True) restaurant_opening = models.TimeField(blank=True, null=True)
restaurant_closing = models.TimeField(blank=True, null=True) restaurant_closing = models.TimeField(blank=True, null=True)
restaurant_is_approved = models.BooleanField(default=False) restaurant_is_approved = models.BooleanField(default=False)
user = models.ForeignKey('User', models.DO_NOTHING, blank=True, null=True) user = models.ForeignKey(settings.AUTH_USER_MODEL, models.DO_NOTHING, blank=True, null=True)
class Meta: class Meta:
managed = True managed = True
db_table = 'restaurant' db_table = 'restaurant'
class Role(models.Model):
role_id = models.IntegerField(primary_key=True)
role_name = models.CharField(max_length=500)
role_description = models.CharField(max_length=700)
class Meta:
managed = True
db_table = 'role'
class RoleHasPermission(models.Model): class RoleHasPermission(models.Model):
role = models.ForeignKey(Role, models.DO_NOTHING) role = models.ForeignKey(Role, models.DO_NOTHING)
permission = models.ForeignKey(Permission, models.DO_NOTHING) permission = models.ForeignKey(Permission, models.DO_NOTHING)
@ -118,22 +126,8 @@ class RoleHasPermission(models.Model):
unique_together = (('role', 'permission'),) unique_together = (('role', 'permission'),)
class User(models.Model):
user_id = models.IntegerField(primary_key=True)
user_email = models.CharField(max_length=500)
user_username = models.CharField(max_length=500)
user_hashed_password = models.CharField(max_length=64)
user_salt = models.CharField(max_length=32)
role = models.ForeignKey(Role, models.DO_NOTHING)
user_age = models.DateField()
class Meta:
managed = True
db_table = 'user'
class UserFollowsDiet(models.Model): class UserFollowsDiet(models.Model):
user = models.ForeignKey(User, models.DO_NOTHING) user = models.ForeignKey(settings.AUTH_USER_MODEL, models.DO_NOTHING)
diet = models.ForeignKey(Diet, models.DO_NOTHING) diet = models.ForeignKey(Diet, models.DO_NOTHING)
class Meta: class Meta:
@ -143,7 +137,7 @@ class UserFollowsDiet(models.Model):
class UserProhibitsIngredient(models.Model): class UserProhibitsIngredient(models.Model):
user = models.ForeignKey(User, models.DO_NOTHING) user = models.ForeignKey(settings.AUTH_USER_MODEL, models.DO_NOTHING)
ingredient_name = models.ForeignKey(Ingredient, models.DO_NOTHING, db_column='ingredient_name') ingredient_name = models.ForeignKey(Ingredient, models.DO_NOTHING, db_column='ingredient_name')
class Meta: class Meta:
@ -153,7 +147,7 @@ class UserProhibitsIngredient(models.Model):
class UserRatesDrink(models.Model): class UserRatesDrink(models.Model):
user = models.ForeignKey(User, models.DO_NOTHING) user = models.ForeignKey(settings.AUTH_USER_MODEL, models.DO_NOTHING)
drink = models.ForeignKey(Drink, models.DO_NOTHING) drink = models.ForeignKey(Drink, models.DO_NOTHING)
rating_grade = models.IntegerField() rating_grade = models.IntegerField()
rating_date = models.DateField() rating_date = models.DateField()
@ -167,7 +161,7 @@ class UserRatesDrink(models.Model):
class UserRatesFood(models.Model): class UserRatesFood(models.Model):
user = models.ForeignKey(User, models.DO_NOTHING) user = models.ForeignKey(settings.AUTH_USER_MODEL, models.DO_NOTHING)
food = models.ForeignKey(Food, models.DO_NOTHING) food = models.ForeignKey(Food, models.DO_NOTHING)
rating_grade = models.IntegerField() rating_grade = models.IntegerField()
rating_date = models.DateField() rating_date = models.DateField()
@ -181,7 +175,7 @@ class UserRatesFood(models.Model):
class UserRatesRestaurant(models.Model): class UserRatesRestaurant(models.Model):
user = models.ForeignKey(User, models.DO_NOTHING) user = models.ForeignKey(settings.AUTH_USER_MODEL, models.DO_NOTHING)
restaurant = models.ForeignKey(Restaurant, models.DO_NOTHING) restaurant = models.ForeignKey(Restaurant, models.DO_NOTHING)
diet = models.ForeignKey(Diet, models.DO_NOTHING, blank=True, null=True) diet = models.ForeignKey(Diet, models.DO_NOTHING, blank=True, null=True)
rating_grade = models.IntegerField() rating_grade = models.IntegerField()

48
UI/Database API/hyrieus/flavoursAPI/hyrieus/serializers.py

@ -1,22 +1,10 @@
from rest_framework import serializers from rest_framework import serializers
from rest_framework.authtoken.models import Token
from .models import ( from .models import (
Diet, Diet, DietProhibitsIngredient, Drink, DrinkHasIngredient, Food,
DietProhibitsIngredient, FoodHasIngredient, Ingredient, Permission, Restaurant, Role,
Drink, RoleHasPermission, User, UserFollowsDiet, UserProhibitsIngredient,
DrinkHasIngredient, UserRatesDrink, UserRatesFood, UserRatesRestaurant,
Food,
FoodHasIngredient,
Ingredient,
Permission,
Restaurant,
Role,
RoleHasPermission,
User,
UserFollowsDiet,
UserProhibitsIngredient,
UserRatesDrink,
UserRatesFood,
UserRatesRestaurant,
) )
class DietSerializer(serializers.ModelSerializer): class DietSerializer(serializers.ModelSerializer):
@ -64,6 +52,16 @@ class RestaurantSerializer(serializers.ModelSerializer):
model = Restaurant model = Restaurant
fields = '__all__' fields = '__all__'
def create(self, validated_data):
user = None
request = self.context.get("request")
if request and hasattr(request, "user"):
user = request.user
user = User.objects.get(username=user)
validated_data['restaurant_is_approved'] = True if (user.role.role_id == 1) else False
restaurant = Restaurant.objects.create(**validated_data)
return restaurant
class RoleSerializer(serializers.ModelSerializer): class RoleSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = Role model = Role
@ -79,6 +77,16 @@ class UserSerializer(serializers.ModelSerializer):
model = User model = User
fields = '__all__' fields = '__all__'
class UserPublicInfoSerializer(UserSerializer):
class Meta:
model = User
fields = (
'id',
'role',
'username'
)
class UserFollowsDietSerializer(serializers.ModelSerializer): class UserFollowsDietSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = UserFollowsDiet model = UserFollowsDiet
@ -103,3 +111,9 @@ class UserRatesRestaurantSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = UserRatesRestaurant model = UserRatesRestaurant
fields = '__all__' fields = '__all__'
class FlavoursTokenSerializer(serializers.ModelSerializer):
user = UserPublicInfoSerializer(many=False, read_only=True)
class Meta:
model = Token
fields = ('key', 'user')

30
UI/Database API/hyrieus/flavoursAPI/hyrieus/urls.py

@ -1,23 +1,12 @@
from django.conf.urls import url from django.conf.urls import url
from django.urls import include, path
from rest_framework import routers from rest_framework import routers
from flavoursAPI.hyrieus.views import (DietViewSet, from flavoursAPI.hyrieus.views import (DietViewSet, DietProhibitsIngredientViewSet,
DietProhibitsIngredientViewSet, DrinkViewSet, DrinkHasIngredientViewSet, FoodViewSet, FoodHasIngredientViewSet,
DrinkViewSet, IngredientViewSet, PermissionViewSet, RestaurantViewSet, RoleViewSet,
DrinkHasIngredientViewSet, RoleHasPermissionViewSet, UserViewSet, UserFollowsDietViewSet,
FoodViewSet, UserProhibitsIngredientViewSet, UserRatesDrinkViewSet, UserRatesFoodViewSet,
FoodHasIngredientViewSet, UserRatesRestaurantViewSet, UserSetBirthDay,
IngredientViewSet,
PermissionViewSet,
RestaurantViewSet,
RoleViewSet,
RoleHasPermissionViewSet,
UserViewSet,
UserFollowsDietViewSet,
UserProhibitsIngredientViewSet,
UserRatesDrinkViewSet,
UserRatesFoodViewSet,
UserRatesRestaurantViewSet,
Signup,
) )
router = routers.DefaultRouter() router = routers.DefaultRouter()
@ -40,7 +29,10 @@ router.register(r'userratesfood', UserRatesFoodViewSet)
router.register(r'userratesrestaurant', UserRatesRestaurantViewSet) router.register(r'userratesrestaurant', UserRatesRestaurantViewSet)
urlpatterns = [ urlpatterns = [
url(r'signup', Signup.as_view()), # url(r'signup', Signup.as_view()),
path('setUserBirthday/<int:pk>/', UserSetBirthDay.as_view(), name='setUserBirthday'),
path('rest-auth/', include('rest_auth.urls')),
url(r'^rest-auth/registration/', include('rest_auth.registration.urls'))
] ]
urlpatterns += router.urls urlpatterns += router.urls

294
UI/Database API/hyrieus/flavoursAPI/hyrieus/views.py

@ -1,127 +1,327 @@
from django.shortcuts import render from django.shortcuts import render
from decimal import Decimal
from django.db.models import F, ExpressionWrapper, FloatField
from rest_framework.views import APIView
from rest_framework import viewsets from rest_framework import viewsets
from .models import ( from rest_framework.authentication import SessionAuthentication, BasicAuthentication
Diet, from rest_framework.permissions import IsAuthenticated
DietProhibitsIngredient, from rest_framework.response import Response
Drink, from rest_framework.exceptions import PermissionDenied
DrinkHasIngredient,
Food, from .models import (Diet, DietProhibitsIngredient, Drink, DrinkHasIngredient,
FoodHasIngredient, Food, FoodHasIngredient, Ingredient, Permission, Restaurant, Role,
Ingredient, RoleHasPermission, User, UserFollowsDiet, UserProhibitsIngredient,
Permission, UserRatesDrink, UserRatesFood, UserRatesRestaurant,
Restaurant,
Role,
RoleHasPermission,
User,
UserFollowsDiet,
UserProhibitsIngredient,
UserRatesDrink,
UserRatesFood,
UserRatesRestaurant,
) )
from .serializers import ( from .serializers import (
DietSerializer, DietSerializer, DietProhibitsIngredientSerializer, DrinkSerializer,
DietProhibitsIngredientSerializer, DrinkHasIngredientSerializer, FoodSerializer, FoodHasIngredientSerializer,
DrinkSerializer, IngredientSerializer, PermissionSerializer, RestaurantSerializer,
DrinkHasIngredientSerializer, RoleSerializer, RoleHasPermissionSerializer, UserSerializer,
FoodSerializer, UserFollowsDietSerializer, UserProhibitsIngredientSerializer,
FoodHasIngredientSerializer, UserRatesDrinkSerializer, UserRatesFoodSerializer,
IngredientSerializer,
PermissionSerializer,
RestaurantSerializer,
RoleSerializer,
RoleHasPermissionSerializer,
UserSerializer,
UserFollowsDietSerializer,
UserProhibitsIngredientSerializer,
UserRatesDrinkSerializer,
UserRatesFoodSerializer,
UserRatesRestaurantSerializer, UserRatesRestaurantSerializer,
) )
class DietViewSet(viewsets.ModelViewSet): class DietViewSet(viewsets.ModelViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
def get(self, request, format=None):
content = {
'user': unicode(request.user),
'auth': unicode(request.auth),
}
return Response(content)
queryset = Diet.objects.all() queryset = Diet.objects.all()
serializer_class = DietSerializer serializer_class = DietSerializer
class DietProhibitsIngredientViewSet(viewsets.ModelViewSet): class DietProhibitsIngredientViewSet(viewsets.ModelViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
def get(self, request, format=None):
content = {
'user': unicode(request.user),
'auth': unicode(request.auth),
}
return Response(content)
queryset = DietProhibitsIngredient.objects.all() queryset = DietProhibitsIngredient.objects.all()
serializer_class = DietProhibitsIngredientSerializer serializer_class = DietProhibitsIngredientSerializer
class DrinkViewSet(viewsets.ModelViewSet): class DrinkViewSet(viewsets.ModelViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
def get(self, request, format=None):
content = {
'user': unicode(request.user),
'auth': unicode(request.auth),
}
return Response(content)
queryset = Drink.objects.all() queryset = Drink.objects.all()
serializer_class = DrinkSerializer serializer_class = DrinkSerializer
class DrinkHasIngredientViewSet(viewsets.ModelViewSet): class DrinkHasIngredientViewSet(viewsets.ModelViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
def get(self, request, format=None):
content = {
'user': unicode(request.user),
'auth': unicode(request.auth),
}
return Response(content)
queryset = DrinkHasIngredient.objects.all() queryset = DrinkHasIngredient.objects.all()
serializer_class = DrinkHasIngredientSerializer serializer_class = DrinkHasIngredientSerializer
class FoodViewSet(viewsets.ModelViewSet): class FoodViewSet(viewsets.ModelViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
def get(self, request, format=None):
content = {
'user': unicode(request.user),
'auth': unicode(request.auth),
}
return Response(content)
queryset = Food.objects.all() queryset = Food.objects.all()
serializer_class = FoodSerializer serializer_class = FoodSerializer
class FoodHasIngredientViewSet(viewsets.ModelViewSet): class FoodHasIngredientViewSet(viewsets.ModelViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
def get(self, request, format=None):
content = {
'user': unicode(request.user),
'auth': unicode(request.auth),
}
return Response(content)
queryset = FoodHasIngredient.objects.all() queryset = FoodHasIngredient.objects.all()
serializer_class = FoodHasIngredientSerializer serializer_class = FoodHasIngredientSerializer
class IngredientViewSet(viewsets.ModelViewSet): class IngredientViewSet(viewsets.ModelViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
def get(self, request, format=None):
content = {
'user': unicode(request.user),
'auth': unicode(request.auth),
}
return Response(content)
queryset = Ingredient.objects.all() queryset = Ingredient.objects.all()
serializer_class = IngredientSerializer serializer_class = IngredientSerializer
class PermissionViewSet(viewsets.ModelViewSet): class PermissionViewSet(viewsets.ModelViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
def get(self, request, format=None):
content = {
'user': unicode(request.user),
'auth': unicode(request.auth),
}
return Response(content)
queryset = Permission.objects.all() queryset = Permission.objects.all()
serializer_class = PermissionSerializer serializer_class = PermissionSerializer
class RestaurantViewSet(viewsets.ModelViewSet): class RestaurantViewSet(viewsets.ModelViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
def get_queryset(self):
user = self.request.user
filterType = self.request.query_params.get('filter_restaurant_type', None)
filterDistanceRadius = self.request.query_params.get('filter_restaurant_radius', None)
filterDistanceLongitude = self.request.query_params.get('filter_restaurant_longitude', None)
filterDistanceLatitude = self.request.query_params.get('filter_restaurant_latitude', None)
filterCalories = self.request.query_params.get('filter_restaurant_calories', None)
restaurants = Restaurant.objects.all()
if filterDistanceRadius is not None:
filterDistanceRadius = float(filterDistanceRadius)
filterDistanceLongitude = float(filterDistanceLongitude)
filterDistanceLatitude = float(filterDistanceLatitude)
import math
restaurants = restaurants.filter(
restaurant_latitude__range=(filterDistanceLatitude-(filterDistanceRadius/111.045),
filterDistanceLatitude+(filterDistanceRadius/111.045)))
restaurants = restaurants.filter(
restaurant_longitude__range=(filterDistanceLongitude-(filterDistanceRadius/(111.045*math.cos(math.radians(filterDistanceLatitude)))),
filterDistanceLongitude+(filterDistanceRadius/(111.045*math.cos(math.radians(filterDistanceLatitude))))))
# ======================================================================================
# WHY THE FUCK DOES BELOW CODE FAIL? :-(
# ======================================================================================
# restaurants = restaurants.annotate(distance =
# 111.045 * math.degrees(math.acos(
# math.cos(math.radians(filterDistanceLatitude))
# * math.cos(math.radians(F('restaurant_latitude')))
# * math.cos(math.radians(filterDistanceLongitude - float(F('restaurant_longitude'))))
# + math.sin(math.radians(filterDistanceLatitude))
# * math.sin(math.radians(F('restaurant_latitude')))
# )))
# restaurants = restaurants.filter(distance__lt=filterDistanceRadius)
# restaurants = restaurants.order_by('distance')
restaurants = restaurants.distinct();
if filterType is not None:
restaurants = restaurants.filter(restaurant_category=filterType)
if not user.role.role_id == 1:
restaurants = restaurants.filter(restaurant_is_approved=True)
return restaurants
def get(self, request, format=None):
content = {
'user': unicode(request.user),
'auth': unicode(request.auth),
}
return Response(content)
queryset = Restaurant.objects.all() queryset = Restaurant.objects.all()
serializer_class = RestaurantSerializer serializer_class = RestaurantSerializer
class RoleViewSet(viewsets.ModelViewSet): class RoleViewSet(viewsets.ModelViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
def get(self, request, format=None):
content = {
'user': unicode(request.user),
'auth': unicode(request.auth),
}
return Response(content)
queryset = Role.objects.all() queryset = Role.objects.all()
serializer_class = RoleSerializer serializer_class = RoleSerializer
class RoleHasPermissionViewSet(viewsets.ModelViewSet): class RoleHasPermissionViewSet(viewsets.ModelViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
def get(self, request, format=None):
content = {
'user': unicode(request.user),
'auth': unicode(request.auth),
}
return Response(content)
queryset = RoleHasPermission.objects.all() queryset = RoleHasPermission.objects.all()
serializer_class = RoleHasPermissionSerializer serializer_class = RoleHasPermissionSerializer
class UserViewSet(viewsets.ModelViewSet): class UserViewSet(viewsets.ModelViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
def get(self, request, format=None):
content = {
'user': unicode(request.user),
'auth': unicode(request.auth),
}
return Response(content)
queryset = User.objects.all() queryset = User.objects.all()
serializer_class = UserSerializer serializer_class = UserSerializer
class UserFollowsDietViewSet(viewsets.ModelViewSet): class UserFollowsDietViewSet(viewsets.ModelViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
def get(self, request, format=None):
content = {
'user': unicode(request.user),
'auth': unicode(request.auth),
}
return Response(content)
queryset = UserFollowsDiet.objects.all() queryset = UserFollowsDiet.objects.all()
serializer_class = UserFollowsDietSerializer serializer_class = UserFollowsDietSerializer
class UserProhibitsIngredientViewSet(viewsets.ModelViewSet): class UserProhibitsIngredientViewSet(viewsets.ModelViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
def get(self, request, format=None):
content = {
'user': unicode(request.user),
'auth': unicode(request.auth),
}
return Response(content)
queryset = UserProhibitsIngredient.objects.all() queryset = UserProhibitsIngredient.objects.all()
serializer_class = UserProhibitsIngredientSerializer serializer_class = UserProhibitsIngredientSerializer
class UserRatesDrinkViewSet(viewsets.ModelViewSet): class UserRatesDrinkViewSet(viewsets.ModelViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
def get(self, request, format=None):
content = {
'user': unicode(request.user),
'auth': unicode(request.auth),
}
return Response(content)
queryset = UserRatesDrink.objects.all() queryset = UserRatesDrink.objects.all()
serializer_class = UserRatesDrinkSerializer serializer_class = UserRatesDrinkSerializer
class UserRatesFoodViewSet(viewsets.ModelViewSet): class UserRatesFoodViewSet(viewsets.ModelViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
def get(self, request, format=None):
content = {
'user': unicode(request.user),
'auth': unicode(request.auth),
}
return Response(content)
queryset = UserRatesFood.objects.all() queryset = UserRatesFood.objects.all()
serializer_class = UserRatesFoodSerializer serializer_class = UserRatesFoodSerializer
class UserRatesRestaurantViewSet(viewsets.ModelViewSet): class UserRatesRestaurantViewSet(viewsets.ModelViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
def get(self, request, format=None):
content = {
'user': unicode(request.user),
'auth': unicode(request.auth),
}
return Response(content)
queryset = UserRatesRestaurant.objects.all() queryset = UserRatesRestaurant.objects.all()
serializer_class = UserRatesRestaurantSerializer serializer_class = UserRatesRestaurantSerializer
from rest_framework.views import APIView, Response class UserSetBirthDay(APIView):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
class Signup(APIView): def put(self, request, pk, format=None):
def get(self, request, format=None): try:
serializer = User.objects.all() user = User.objects.get(pk=pk)
return Response(serializer.data, status=status.HTTP_201_CREATED) except Snippet.DoesNotExist:
raise Http404
if not request.user == user:
raise PermissionDenied({"message":"You don't have permission to access"})
def post(self, request, format=None): serializer = UserSerializer(user, data=request.data, partial=True)
serializer = UserSerializer(data=request.data)
if serializer.is_valid(): if serializer.is_valid():
serializer.save() serializer.save()
return Response(serializer.data, status=status.HTTP_201_CREATED) return Response(serializer.data)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
@classmethod
def get_extra_actions(cls):
return []

32
UI/Database API/hyrieus/flavoursAPI/settings.py

@ -38,9 +38,17 @@ INSTALLED_APPS = [
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'flavoursAPI.hyrieus', 'flavoursAPI.hyrieus',
'rest_auth',
'rest_framework', 'rest_framework',
'rest_framework.authtoken',
'rest_auth.registration',
'allauth.account',
'allauth',
'django.contrib.sites',
] ]
SITE_ID = 1
MIDDLEWARE = [ MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware', 'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
@ -82,7 +90,6 @@ DATABASES = {
'USER': 'flavoursUser', 'USER': 'flavoursUser',
'PASSWORD': 'flavours13', 'PASSWORD': 'flavours13',
'HOST': '83.212.109.171', 'HOST': '83.212.109.171',
# 'HOST': '127.0.0.1',
'PORT': '', 'PORT': '',
}, },
} }
@ -127,3 +134,26 @@ USE_TZ = True
STATIC_URL = '/static/' STATIC_URL = '/static/'
SILENCED_SYSTEM_CHECKS = ['mysql.E001'] SILENCED_SYSTEM_CHECKS = ['mysql.E001']
AUTH_USER_MODEL = 'hyrieus.User'
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.TokenAuthentication',
)
}
REST_AUTH_SERIALIZERS = {
'TOKEN_SERIALIZER': 'flavoursAPI.hyrieus.serializers.FlavoursTokenSerializer',
}
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'allauth.account.auth_backends.AuthenticationBackend',
)
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
ACCOUNT_EMAIL_VERIFICATION = 'none'
ACCOUNT_AUTHENTICATION_METHOD = 'username_email'

Loading…
Cancel
Save