Added Mood model
This commit is contained in:
parent
cdd4a01521
commit
17b1363ee4
7 changed files with 56 additions and 9 deletions
|
@ -3,6 +3,7 @@ from django.contrib import admin
|
|||
from api_v1.cafeteria.model import Cafeteria
|
||||
from api_v1.institution.model import Institution
|
||||
from api_v1.location.model import Location
|
||||
from api_v1.mood.model import Mood
|
||||
from api_v1.profile.model import Profile
|
||||
|
||||
# Register your models here.
|
||||
|
@ -10,3 +11,4 @@ admin.site.register(Profile)
|
|||
admin.site.register(Location)
|
||||
admin.site.register(Cafeteria)
|
||||
admin.site.register(Institution)
|
||||
admin.site.register(Mood)
|
||||
|
|
27
api_v1/migrations/0006_addedMoodModel.py
Normal file
27
api_v1/migrations/0006_addedMoodModel.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
# Generated by Django 5.0.2 on 2024-02-28 22:55
|
||||
|
||||
import colorfield.fields
|
||||
import uuid
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('api_v1', '0005_addedInstitutionModel'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Mood',
|
||||
fields=[
|
||||
('mood_id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||
('name', models.CharField(max_length=30)),
|
||||
('description', models.CharField(max_length=150)),
|
||||
('color', colorfield.fields.ColorField(default='#FFFFFF', image_field=None, max_length=25, samples=None)),
|
||||
('is_available', models.BooleanField(default=True)),
|
||||
('is_reliable', models.BooleanField(default=True)),
|
||||
('is_going', models.BooleanField(default=False)),
|
||||
],
|
||||
),
|
||||
]
|
|
@ -2,3 +2,4 @@ from api_v1.profile.model import Profile
|
|||
from api_v1.location.model import Location
|
||||
from api_v1.cafeteria.model import Cafeteria
|
||||
from api_v1.institution.model import Institution
|
||||
from api_v1.mood.model import Mood
|
||||
|
|
0
api_v1/mood/__init__.py
Normal file
0
api_v1/mood/__init__.py
Normal file
20
api_v1/mood/model.py
Normal file
20
api_v1/mood/model.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
import uuid
|
||||
|
||||
from django.db import models
|
||||
from colorfield.fields import ColorField
|
||||
|
||||
|
||||
class Mood(models.Model):
|
||||
mood_id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||
|
||||
name = models.CharField(max_length=30)
|
||||
description = models.CharField(max_length=150, blank=False, null=False)
|
||||
|
||||
color = ColorField(format='hex')
|
||||
|
||||
is_available = models.BooleanField(default=True) # Is available to go
|
||||
is_reliable = models.BooleanField(default=True) # Will always do the same in this mood
|
||||
is_going = models.BooleanField(default=False) # Is going to the cafeteria
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
|
@ -15,7 +15,6 @@ from pathlib import Path
|
|||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
|
||||
|
||||
|
@ -27,18 +26,19 @@ DEBUG = True
|
|||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'api_v1.apps.ApiV1Config',
|
||||
'rest_framework',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
|
||||
'api_v1.apps.ApiV1Config',
|
||||
'rest_framework',
|
||||
'colorfield',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
@ -71,7 +71,6 @@ TEMPLATES = [
|
|||
|
||||
WSGI_APPLICATION = 'mixr_api.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases
|
||||
|
||||
|
@ -86,7 +85,6 @@ DATABASES = {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators
|
||||
|
||||
|
@ -105,7 +103,6 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||
},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/5.0/topics/i18n/
|
||||
|
||||
|
@ -117,7 +114,6 @@ USE_I18N = True
|
|||
|
||||
USE_TZ = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/5.0/howto/static-files/
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
Django~=4.2
|
||||
psycopg2-binary~=2.9.9
|
||||
djangorestframework~=3.14.0
|
||||
djangorestframework~=3.14.0
|
||||
django-colorfield~=0.11.0
|
Loading…
Reference in a new issue