nuitdelinfo_2021/rescue/models.py

31 lines
880 B
Python
Raw Normal View History

2021-12-03 04:52:09 +01:00
from django.db.models import Model, CharField, DateField, ManyToManyField, DecimalField, BooleanField, ForeignKey, \
CASCADE
2021-12-03 00:23:06 +01:00
from django_quill.fields import QuillField
2021-12-02 21:57:32 +01:00
2021-12-03 04:52:09 +01:00
from boat.models import Boat
2021-12-02 21:57:32 +01:00
from people.models import People
class Rescue(Model):
2021-12-03 00:23:06 +01:00
name = CharField(max_length=70)
date = DateField()
2021-12-02 21:57:32 +01:00
location_long = DecimalField(max_digits=9, decimal_places=6)
location_lat = DecimalField(max_digits=9, decimal_places=6)
2021-12-03 00:23:06 +01:00
resume = CharField(max_length=125)
2021-12-02 21:57:32 +01:00
saved = ManyToManyField(People, related_name="saved")
rescuers = ManyToManyField(People, related_name="rescued")
2021-12-03 04:52:09 +01:00
boats = ManyToManyField(Boat)
validated = BooleanField(default=False)
pending_edit_of = ForeignKey(People, on_delete=CASCADE, null=True, blank=True)
2021-12-02 21:57:32 +01:00
2021-12-03 00:23:06 +01:00
description = QuillField()
2021-12-02 21:57:32 +01:00
2021-12-03 00:23:06 +01:00
sources = QuillField()
2021-12-03 03:40:41 +01:00
def __str__(self):
return self.name