added aviary
This commit is contained in:
parent
f8545a26fe
commit
6af0a15f9e
10 changed files with 50 additions and 6 deletions
0
aviary/__init__.py
Normal file
0
aviary/__init__.py
Normal file
13
aviary/admin.py
Normal file
13
aviary/admin.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from .models import Aviary
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(Aviary)
|
||||||
|
class AviaryAdmin(admin.ModelAdmin):
|
||||||
|
list_display = [
|
||||||
|
"description",
|
||||||
|
"condition",
|
||||||
|
"last_ward_round",
|
||||||
|
]
|
||||||
|
list_filter = ("description", "condition", "last_ward_round")
|
6
aviary/apps.py
Normal file
6
aviary/apps.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class AviaryConfig(AppConfig):
|
||||||
|
default_auto_field = "django.db.models.BigAutoField"
|
||||||
|
name = "aviary"
|
0
aviary/migrations/__init__.py
Normal file
0
aviary/migrations/__init__.py
Normal file
12
aviary/models.py
Normal file
12
aviary/models.py
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
from uuid import uuid4
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
|
class Aviary(models.Model):
|
||||||
|
id = models.UUIDField(primary_key=True, default=uuid4, editable=False)
|
||||||
|
description = models.CharField(max_length=256)
|
||||||
|
condition = models.CharField(max_length=256)
|
||||||
|
last_ward_round = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.description
|
3
aviary/tests.py
Normal file
3
aviary/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
3
aviary/views.py
Normal file
3
aviary/views.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
# Create your views here.
|
|
@ -4,7 +4,7 @@ from .models import Bird, FallenBird
|
||||||
|
|
||||||
|
|
||||||
@admin.register(FallenBird)
|
@admin.register(FallenBird)
|
||||||
class ContractAdmin(admin.ModelAdmin):
|
class FallenBirdAdmin(admin.ModelAdmin):
|
||||||
list_display = [
|
list_display = [
|
||||||
"bird",
|
"bird",
|
||||||
"date_found",
|
"date_found",
|
||||||
|
@ -16,5 +16,5 @@ class ContractAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Bird)
|
@admin.register(Bird)
|
||||||
class ContractAdmin(admin.ModelAdmin):
|
class BirdAdmin(admin.ModelAdmin):
|
||||||
list_display = ["name"]
|
list_display = ["name"]
|
||||||
|
|
|
@ -4,6 +4,7 @@ from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from rescuer.models import Rescuer
|
from rescuer.models import Rescuer
|
||||||
|
from aviary.models import Aviary
|
||||||
|
|
||||||
|
|
||||||
class FallenBird(models.Model):
|
class FallenBird(models.Model):
|
||||||
|
@ -15,6 +16,7 @@ class FallenBird(models.Model):
|
||||||
updated = models.DateTimeField(auto_now=True)
|
updated = models.DateTimeField(auto_now=True)
|
||||||
rescuer = models.ForeignKey(Rescuer, on_delete=models.CASCADE)
|
rescuer = models.ForeignKey(Rescuer, on_delete=models.CASCADE)
|
||||||
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
|
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
|
||||||
|
aviary = models.ForeignKey(Aviary, on_delete=models.CASCADE)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.place
|
return self.place
|
||||||
|
|
|
@ -53,6 +53,7 @@ INSTALLED_APPS = [
|
||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
# My Apps
|
# My Apps
|
||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
|
"aviary",
|
||||||
"bird",
|
"bird",
|
||||||
"rescuer",
|
"rescuer",
|
||||||
"sites",
|
"sites",
|
||||||
|
@ -112,16 +113,20 @@ DATABASES = {
|
||||||
|
|
||||||
AUTH_PASSWORD_VALIDATORS = [
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
{
|
{
|
||||||
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
|
"NAME":
|
||||||
|
"django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
|
"NAME":
|
||||||
|
"django.contrib.auth.password_validation.MinimumLengthValidator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
|
"NAME":
|
||||||
|
"django.contrib.auth.password_validation.CommonPasswordValidator",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
|
"NAME":
|
||||||
|
"django.contrib.auth.password_validation.NumericPasswordValidator",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue