class Foo(Model): name = CharField(max_length=20, blank=True, null=True) date_of_birth = PartialDateField(blank=True, null=True) date_of_death = PartialDateField(blank=True, null=True) def __str__(self): return self.name
class Person(models.Model): name = models.CharField(max_length=50, blank=False) GENDER = ( ('M', 'Male'), ('F', 'Female'), ('O', 'Other'), ) gender = models.CharField(max_length=1, choices=GENDER, default='M') birth_lower = PartialDateField(blank=True, default='', null=True) birth_upper = PartialDateField(blank=True, default='', null=True) death_lower = PartialDateField(blank=True, default='', null=True) death_upper = PartialDateField(blank=True, default='', null=True) role = models.CharField( max_length=100, blank=True ) # Role field for person and type of envolvement feild for person-installation relation religion = models.ForeignKey(Religion, on_delete=models.CASCADE, blank=True, default='', null=True) secondary_literature = models.ManyToManyField(SecondaryLiterature, blank=True) comment = models.TextField(max_length=1000, blank=True, default='', null=True) def __str__(self): return self.name
class LiturgicalManuscript(models.Model): shelf_no = models.CharField(max_length=100, blank=False, default='') rite = models.ForeignKey(Rite, on_delete=models.SET_NULL, blank=True, default='', null=True) type = models.ForeignKey(ManuscriptType, on_delete=models.SET_NULL, blank=True, default='', null=True) date_lower = PartialDateField(blank=True, null=True) date_upper = PartialDateField(blank=True, null=True) provenance = models.ForeignKey(Church, on_delete=models.SET_NULL, blank=True, default='', null=True) feast = models.ForeignKey(Feast, on_delete=models.SET_NULL, blank=True, default='', null=True) external_link = models.URLField(max_length=256, default='', blank=True) bibliography = models.ForeignKey(Bibliography, on_delete=models.SET_NULL, blank=True, default='', null=True) description = models.TextField(default='', blank=True, null=True) def __str__(self): return self.shelf_no
class Season(models.Model): """"Model representing a traditional season""" name = models.CharField(max_length=200) start_date = PartialDateField(blank=True, null=True, default=None) end_date = PartialDateField(blank=True, null=True, default=None) def __str__(self): return self.name
class EntityOrganity(Entity): entity_type = models.ManyToManyField('EntityOrganityType', blank=True) start_date = PartialDateField(blank=True, null=True, default=None) end_date = PartialDateField(blank=True, null=True, default=None) def get_absolute_url(self): """"Returns the url to access a detail record for this production""" return reverse('organities-detail', args=[str(self.id)])
class ObjectChurchRelation(models.Model): object = models.ForeignKey(Object, on_delete=models.CASCADE, blank=True) church = models.ForeignKey(Church, on_delete=models.CASCADE, blank=True) start_date = PartialDateField(blank=True, null=True) end_date = PartialDateField(blank=True, null=True) def __str__(self): message = self.object + "and" + self.church return message
class CityEra(models.Model): name = models.CharField(max_length=100, blank=False) city = models.ForeignKey(City, on_delete=models.CASCADE, blank=True) start_date = PartialDateField() end_date = PartialDateField() population = models.IntegerField() def __str__(self): return self.name
class InscriptionChurchRelation(models.Model): inscription = models.ForeignKey(Inscription, on_delete=models.CASCADE, blank=True) church = models.ForeignKey(Church, on_delete=models.CASCADE, blank=True) start_date = PartialDateField(blank=True, null=True) end_date = PartialDateField(blank=True, null=True) def __str__(self): message = self.inscription + "and" + self.church return message
class Citymap(models.Model): # map = models.ImageField() type = models.CharField(max_length=50, blank=False) city = models.ForeignKey(City, related_name='citymaps', on_delete=models.CASCADE, blank=True) population = models.IntegerField( ) # I think we do nat need population here, as we have it in CityEra start_date = PartialDateField() end_date = PartialDateField()
class LitManuscriptChurchRelation(models.Model): liturgical_manuscript = models.ForeignKey(LiturgicalManuscript, on_delete=models.CASCADE, blank=True, null=True) church = models.ForeignKey(Church, on_delete=models.CASCADE, blank=True) start_date = PartialDateField(blank=True, null=True) end_date = PartialDateField(blank=True, null=True) def __str__(self): message = self.liturgical_manuscript + "and" + self.church return message
class EntityProduction(Entity): """"Model representing stage productions""" season = models.ForeignKey('Season', on_delete=models.PROTECT, blank=True, null=True) start_date = PartialDateField(blank=True, null=True, default=None) end_date = PartialDateField(blank=True, null=True, default=None) entity_type = models.ManyToManyField('EntityProductionType', blank=True) def get_absolute_url(self): """"Returns the url to access a detail record for this production""" return reverse('productions-detail', args=[str(self.id)])
class Experience(models.Model): company = models.CharField(max_length=50) job_description = models.CharField(max_length=200) start_date = PartialDateField('start_date', blank=True, null=True) end_date = PartialDateField('end_date', blank=True, null=True) is_visible = models.BooleanField(default=True) is_current = models.BooleanField(default=True) def check_current(self): if self.end_date < datetime.datetime.now(): self.is_current = False def __str__(self): return self.company
class Figure(models.Model, info): '''figure to be plotted on a map. model for the map source of life demo. ''' dargs = {'on_delete': models.SET_NULL, 'blank': True, 'null': True} name = models.CharField(max_length=200) description = models.TextField(default='', blank=True) style = models.ForeignKey(Style, **dargs) start_date = PartialDateField(null=True, blank=True) end_date = PartialDateField(null=True, blank=True) geojson = models.FileField(upload_to='geojson/', null=True, blank=True) # ? district_number = models.IntegerField(blank=True, null=True) city = models.CharField(max_length=200)
class Church(models.Model): name = models.CharField(max_length=100, blank=False, default='') start_date_lower = PartialDateField(blank=True, null=True) start_date_upper = PartialDateField(blank=True, null=True) end_date_lower = PartialDateField(blank=True, null=True) end_date_upper = PartialDateField(blank=True, null=True) coordinates_latitude = models.DecimalField(max_digits=8, decimal_places=5, blank=True, null=True, default=0) coordinates_longitude = models.DecimalField(max_digits=8, decimal_places=5, blank=True, null=True, default=0) institution_type = models.ForeignKey(InstitutionType, on_delete=models.CASCADE, blank=True, default='', null=True) TEXTUAL = ( ('Y', 'Yes'), ('N', 'No'), ) textual_evidence = models.CharField(max_length=1, choices=TEXTUAL, default='Y', blank=True, null=True) MATERIAL = ( ('Y', 'Yes'), ('N', 'No'), ) material_evidence = models.CharField(max_length=1, choices=MATERIAL, default='Y', blank=True, null=True) external_link = models.URLField(max_length=256, default='', blank=True) bibliography = models.ForeignKey(Bibliography, on_delete=models.CASCADE, blank=True, default='', null=True) description = models.TextField(default='', blank=True) def __str__(self): return self.name
class Object(models.Model): name = models.CharField(max_length=256, blank=False, default='') date_lower = PartialDateField(blank=True, null=True) date_upper = PartialDateField(blank=True, null=True) original_location = models.ForeignKey(Church, related_name='originallocations', on_delete=models.CASCADE, blank=True, default='', null=True) current_location = models.ForeignKey(Church, on_delete=models.CASCADE, blank=True, default='', null=True) type = models.ForeignKey(ObjectType, on_delete=models.CASCADE, blank=True, default='', null=True) TEXTUAL = ( ('Y', 'Yes'), ('N', 'No'), ) textual_evidence = models.CharField(max_length=1, choices=TEXTUAL, default='Y', blank=True, null=True) MATERIAL = ( ('Y', 'Yes'), ('N', 'No'), ) material_evidence = models.CharField(max_length=1, choices=MATERIAL, default='Y', blank=True, null=True) external_link = models.URLField(max_length=256, default='', blank=True) bibliography = models.ForeignKey(Bibliography, on_delete=models.CASCADE, blank=True, default='', null=True) description = models.TextField(default='', blank=True, null=True) def __str__(self): return self.name
class Ship(models.Model): """ Some attributes taken from https://gisis.imo.org/Public/SHIPS/Default.aspx """ # TODO: flag and ship_type later to be refined with explicit `choices` attribute # or converted to ForeignKeys name = models.CharField(max_length=255) # NOTE: preferred a surrogate primary key instead of IMO itself. # If it's an overkill, would convert to [a more effective] actual primary key imo = models.CharField('IMO', max_length=7, unique=True, db_index=True, validators=[RegexValidator(r'^|\d{7}$')]) flag = models.CharField(max_length=3, blank=True, help_text='ISO 3-letter code') ship_type = models.CharField('Type', max_length=100, blank=True, help_text='Later refined as a dropdown') build = PartialDateField(null=True, blank=True, help_text='year-month') mmsi = models.CharField(blank=True, max_length=9, db_index=True, validators=[RegexValidator(r'^|\d{9}$')]) def str(self): s = '%s (IMO %s) %s' % (self.name, self.pk, self.country or '') return s.strip()
class Saint(models.Model): name = models.CharField(max_length=256) feast_day = PartialDateField(blank=True, null=True) death_date = PartialDateField(blank=True, null=True) death_place = models.CharField(max_length=256, blank=True, null=True) type = models.ForeignKey(SaintType, related_name='saints', on_delete=models.CASCADE, blank=True, default='', null=True) external_link = models.URLField(max_length=256, default='', blank=True) description = models.TextField(default='', blank=True, null=True) def __str__(self): return self.name
class Ace(Model): PRACTICE = 'P' CASUAL_ROUND = 'C' TOURNAMENT = 'T' TYPE_CHOICES = ( (PRACTICE, _('Practice')), (CASUAL_ROUND, _('Casual Round')), (TOURNAMENT, _('Tournament')), ) friend = models.ForeignKey(Friend, on_delete=CASCADE, related_name='aces') disc = models.ForeignKey(Disc, null=True, on_delete=SET_NULL, related_name='aces', verbose_name=_('Disc')) course = models.ForeignKey(Course, null=True, on_delete=SET_NULL, related_name='aces', verbose_name=_('Course')) hole = models.CharField(_('Hole'), max_length=20) type = models.CharField(_('Type'), max_length=1, choices=TYPE_CHOICES) date = PartialDateField(_('Date'), null=True, blank=True) def __str__(self): date = f' on {self.date}' if self.date else '' return f'{self.friend} aced hole {self.hole} at {self.course}' \ f' with a {self.disc.display_name} ({self.get_type_display()}){date}'
class Bibliography(models.Model): short_title = models.CharField(max_length=250, blank=False, default='') author = models.CharField(max_length=50, blank=True, null=True) year = PartialDateField(blank=True, null=True) def __str__(self): return self.short_title
class EmployerWorkExperience(models.Model): user_account_id = models.ForeignKey( UserAccount, related_name='user_account_id_work_experience', on_delete=models.CASCADE) designation_id = models.ForeignKey(Designation, related_name='designation_id1', on_delete=models.CASCADE, null=True) organization_id = models.ForeignKey(Organizations, related_name='organizations_id1', on_delete=models.CASCADE, null=True) description = models.CharField(max_length=500, null=True) is_current_job = models.BooleanField(default=True) start_date = PartialDateField(null=True) end_date = PartialDateField(null=True)
class Inscription(models.Model): reference_no = models.CharField(max_length=100, blank=False, default='') original_location = models.ForeignKey(Church, on_delete=models.SET_NULL, blank=True, default='', null=True) date_lower = PartialDateField(blank=True, null=True) date_upper = PartialDateField(blank=True, null=True) external_link = models.URLField(max_length=256, default='', blank=True) bibliography = models.ForeignKey(Bibliography, on_delete=models.SET_NULL, blank=True, default='', null=True) text = models.TextField(max_length=256, blank=True, null=True) description = models.TextField(default='', blank=True, null=True) def __str__(self): return self.reference_no
class Education(models.Model): school = models.CharField(max_length=50) city = models.CharField(max_length=50, blank=True) state = models.CharField(max_length=50, blank=True) education_level = models.CharField(max_length=20, choices=EDUCATION_LEVEL_CHOICES, default=None) currently_enrolled = models.BooleanField(default=False) year_started = PartialDateField('start_year', blank=True, null=True) year_ended = PartialDateField('end_year', blank=True, null=True) expected_end_year = PartialDateField('expected_end_year', blank=True, null=True) major = models.CharField(max_length=50, blank=True, null=True) major_gpa = models.FloatField(blank=True, null=True) overall_gpa = models.FloatField(blank=True, null=True) courses = models.ManyToManyField(Course, blank=True) clubs = models.ManyToManyField(Club, blank=True) is_visible = models.BooleanField(default=True) def __str__(self): return self.school
class Evidence(models.Model): title = models.CharField(max_length=250, blank=False) author = models.CharField(max_length=100, blank=False, default='', null=True) date_lower = PartialDateField(blank=True, null=True) date_upper = PartialDateField(blank=True, null=True) secondary_literature = models.ForeignKey(SecondaryLiterature, on_delete=models.CASCADE, blank=True, default='', null=True) description = models.TextField(max_length=1000, blank=True, default='', null=True) def __str__(self): return 'Author: ' + self.author + ' | Title: ' + self.title def get_absolute_url(self): return reverse("installations:home", kwargs={'pk': self.pk})
class Book(models.Model): id = models.CharField(max_length=16, primary_key=True, unique=True, null=False) title = models.CharField(max_length=128, null=False) authors = models.ManyToManyField(Author, blank=True) published_date = PartialDateField(blank=True) industry_identifies = models.ManyToManyField(IndustryIdentifies, blank=True) page_count = models.IntegerField(null=True) image_links = models.OneToOneField(ImageLinks, on_delete=models.CASCADE, blank=True) language = models.CharField(max_length=3, null=True) def __str__(self): return self.title
class Institution(models.Model): name = models.CharField(max_length=100, blank=False) type = models.ForeignKey(InstitutionType, on_delete=models.CASCADE, blank=True, null=True) purpose = models.ManyToManyField(Purpose, blank=True) city = models.ForeignKey(City, on_delete=models.CASCADE, blank=True, null=True) neighbourhood = models.ManyToManyField(Neighbourhood, blank=True) latitude = models.DecimalField(max_digits=8, decimal_places=5, blank=True, null=True, default=0) longitude = models.DecimalField(max_digits=8, decimal_places=5, blank=True, null=True, default=0) start_date_lower = PartialDateField( blank=True, null=True) # this field is for test and explaine the partitial dat start_date_upper = PartialDateField(blank=True, null=True) ''''help_text="Date formats:" "Day: yyyy-mm-dd 1999-12-04 " "Month: yyyy-mm 1999-12 " "Year: <integer>y 1999y " "Decade: <integer>d 200d 1990-2000 " "Century: <integer>c 20c 1900-2000 " "Millennium: <integer>m 2m 1000-2000 "''' # start_date = ... will be the partitial dat first_reference_lower = PartialDateField(blank=True, null=True) first_reference_upper = PartialDateField(blank=True, null=True) end_date_lower = PartialDateField(blank=True, null=True) end_date_upper = PartialDateField(blank=True, null=True) religion = models.ForeignKey(Religion, on_delete=models.CASCADE, blank=True, null=True) secondary_literature = models.ManyToManyField(SecondaryLiterature, blank=True) comment = models.TextField(max_length=1000, blank=True, default='', null=True) def __str__(self): return self.name
class EntityShow(Entity): when_date = PartialDateField(blank=True, null=True) when_time = models.TimeField(blank=True, null=True) entity_type = models.ManyToManyField('EntityShowType', blank=True) def display_show_name_with_date_and_time(self): output = self.name + ", " + self.display_show_when() return output def display_show_when(self): date_iso = str(self.when_date) return date_iso + ", " + self.when_time.isoformat( ) if self.when_time is not None else date_iso def get_absolute_url(self): """"Returns the url to access a detail record for this show""" return reverse('shows-detail', args=[str(self.id)]) class Meta: ordering = ['-when_date', '-when_time']
class MovieSpotModel(models.Model): title = models.CharField(max_length=100) release_year = PartialDateField() location = models.CharField(max_length=300) funfacts = models.CharField(max_length=500, null=True, blank=True) productionCompany = models.CharField(max_length=50) director = models.CharField(max_length=60) writer = models.CharField(max_length=60) actor1 = models.CharField(max_length=60) actor2 = models.CharField(max_length=60, null=True, blank=True) actor3 = models.CharField(max_length=60, null=True, blank=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) objects = MovieManager() class Meta: ordering = ('release_year',) def __str__(self): return self.title
class PetrolReport(models.Model): PETROLEUM_PRODUCTS_CHOICES = [ ('aviation_turbine_fuel', 'Aviation Turbine Fuel'), ('mineral_turpentine_oil', 'Mineral Turpentine Oil'), ('furnace_oil', 'Furnace Oil'), ('petrol', 'Petrol'), ('lpg_in_mt', 'LPG in MT'), ('light_diesel_oil', 'Light Diesel Oil'), ('kerosene', 'Kerosene'), ('diesel', 'Diesel'), ] year = PartialDateField() petroleum_product = models.CharField( max_length=100, choices=PETROLEUM_PRODUCTS_CHOICES, default="aviation_turbine_fuel", ) sale = models.PositiveIntegerField() country = models.CharField(max_length=200) def __str__(self): return str(self.id)
class SecondaryLiterature(models.Model): title = models.CharField(max_length=250, blank=False, default='', null=True) author = models.CharField(max_length=100, blank=False, default='', null=True) editor = models.CharField(max_length=100, blank=True, default='', null=True) book_title = models.CharField(max_length=250, blank=True, default='', null=True) journal = models.CharField(max_length=100, blank=True, default='', null=True) publisher = models.CharField(max_length=100, blank=True, default='', null=True) volume = models.CharField(max_length=25, blank=True, default='', null=True) issue = models.CharField(max_length=25, blank=True, default='', null=True) page_number = models.CharField(max_length=25, blank=True, default='', null=True) place = models.CharField(max_length=25, blank=True, default='', null=True) year = PartialDateField(blank=True, null=True, default='') def __str__(self): return 'Author: ' + self.author + ' | Title: ' + self.title
class Installation(models.Model): name = models.CharField(max_length=250, blank=True, default='') watersystem = models.ForeignKey(Watersystem, on_delete=models.CASCADE, blank=True, null=True) construction_date_lower = PartialDateField(blank=True, null=True) construction_date_upper = PartialDateField(blank=True, null=True) first_reference_lower = PartialDateField(blank=True, null=True) first_reference_upper = PartialDateField(blank=True, null=True) end_functioning_year_lower = PartialDateField(blank=True, null=True) end_functioning_year_upper = PartialDateField(blank=True, null=True) purpose = models.ManyToManyField(Purpose, blank=True) city = models.ForeignKey(City, on_delete=models.CASCADE, blank=True, null=True) neighbourhood = models.ManyToManyField(Neighbourhood, blank=True) latitude = models.DecimalField(max_digits=8, decimal_places=5, blank=True, null=True, default=0) longitude = models.DecimalField(max_digits=8, decimal_places=5, blank=True, null=True, default=0) institution_as_location = models.ForeignKey(Institution, on_delete=models.CASCADE, blank=True, null=True) secondary_literature = models.ManyToManyField(SecondaryLiterature, blank=True) comment = models.TextField(max_length=1000, blank=True, default='', null=True) def __str__(self): return self.name