forked from expo/troggle
CASCADE fixes in data model
This commit is contained in:
@@ -11,7 +11,7 @@ import settings
|
||||
"""This file declares TroggleModel which inherits from django.db.models.Model
|
||||
All TroggleModel and models.Model subclasses inherit persistence in the django relational database. This is known as
|
||||
the django Object Relational Mapping (ORM).
|
||||
There are more subclasses define in models_caves.py models_survex.py etc.
|
||||
There are more subclasses defined in models/caves.py models/survex.py etc.
|
||||
"""
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class TroggleModel(models.Model):
|
||||
|
||||
class DataIssue(TroggleModel):
|
||||
"""When importing cave data any validation problems produce a message which is
|
||||
recorded as a DataIssue. The django admin system automatically prodiuces a page listing
|
||||
recorded as a DataIssue. The django admin system automatically produces a page listing
|
||||
these at /admin/core/dataissue/
|
||||
This is a use of the NOTIFICATION pattern:
|
||||
https://martinfowler.com/eaaDev/Notification.html
|
||||
@@ -55,7 +55,6 @@ class DataIssue(TroggleModel):
|
||||
def __str__(self):
|
||||
return f"{self.parser} - {self.message}"
|
||||
|
||||
|
||||
#
|
||||
# single Expedition, usually seen by year
|
||||
#
|
||||
@@ -150,7 +149,10 @@ class Person(TroggleModel):
|
||||
|
||||
|
||||
class PersonExpedition(TroggleModel):
|
||||
"""Person's attendance to one Expo"""
|
||||
"""Person's attendance to one Expo
|
||||
CASCADE means that if an expedition or a person is deleted, the PersonExpedition
|
||||
is deleted too
|
||||
"""
|
||||
|
||||
expedition = models.ForeignKey(Expedition, on_delete=models.CASCADE)
|
||||
person = models.ForeignKey(Person, on_delete=models.CASCADE)
|
||||
|
||||
Reference in New Issue
Block a user