CUCC Expedition Handbook - troggle

Troggle Data Model (python)

Troggle data architecture

Auto-generated on 3 April 2020. (Omitting all the 'Meta' sub-classes.)

# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
#   * Rearrange models' order
#   * Make sure each model has one field with primary_key=True
#   * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free to rename the models, but don't rename db_table values or field names.
#
# Also note: You'll have to insert the output of 'django-admin.py sqlcustom [app_label]'
# into your database.

from __future__ import unicode_literals
from django.db import models


class CoreArea(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    new_since_parsing = models.BooleanField()
    non_public = models.BooleanField()
    short_name = models.CharField(max_length=100)
    name = models.CharField(max_length=200, blank=True)
    description = models.TextField(blank=True)
    parent = models.ForeignKey ('self', blank=True, null=True)


class CoreCave(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    new_since_parsing = models.BooleanField()
    non_public = models.BooleanField()
    official_name = models.CharField(max_length=160)
    kataster_code = models.CharField(max_length=20, blank=True)
    kataster_number = models.CharField(max_length=10, blank=True)
    unofficial_number = models.CharField(max_length=60, blank=True)
    explorers = models.TextField(blank=True)
    underground_description = models.TextField(blank=True)
    equipment = models.TextField(blank=True)
    references = models.TextField(blank=True)
    survey = models.TextField(blank=True)
    kataster_status = models.TextField(blank=True)
    underground_centre_line = models.TextField(blank=True)
    notes = models.TextField(blank=True)
    length = models.CharField(max_length=100, blank=True)
    depth = models.CharField(max_length=100, blank=True)
    extent = models.CharField(max_length=100, blank=True)
    survex_file = models.CharField(max_length=100, blank=True)
    description_file = models.CharField(max_length=200, blank=True)
    url = models.CharField(max_length=200, blank=True)
    filename = models.CharField(max_length=200)


class CoreCaveArea(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    cave_id = models.IntegerField()
    area = models.ForeignKey (CoreArea)


class CoreCaveandentrance(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    cave_id = models.IntegerField()
    entrance_id = models.IntegerField()
    entrance_letter = models.CharField(max_length=20, blank=True)


class CoreCavedescription(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    new_since_parsing = models.BooleanField()
    non_public = models.BooleanField()
    short_name = models.CharField(unique=True, max_length=50)
    long_name = models.CharField(max_length=200, blank=True)
    description = models.TextField(blank=True)


class CoreCavedescriptionLinkedEntrances(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    cavedescription_id = models.IntegerField()
    entrance = models.ForeignKey ('CoreEntrance')


class CoreCavedescriptionLinkedQms(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    cavedescription_id = models.IntegerField()
    qm_id = models.IntegerField()


class CoreCavedescriptionLinkedSubcaves(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    cavedescription_id = models.IntegerField()
    newsubcave_id = models.IntegerField()


class CoreCaveslug(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    cave_id = models.IntegerField()
    slug = models.CharField(unique=True, max_length=50)
    primary = models.BooleanField()


class CoreDataissue(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    new_since_parsing = models.BooleanField()
    non_public = models.BooleanField()
    date = models.DateTimeField()
    parser = models.CharField(max_length=50, blank=True)
    message = models.CharField(max_length=400, blank=True)


class CoreDphoto(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    new_since_parsing = models.BooleanField()
    caption = models.CharField(max_length=1000, blank=True)
    contains_logbookentry = models.ForeignKey ('CoreLogbookentry', blank=True, null=True)
    file = models.CharField(max_length=100)
    is_mugshot = models.BooleanField()
    contains_cave = models.ForeignKey (CoreCave, blank=True, null=True)
    contains_entrance = models.ForeignKey ('CoreEntrance', blank=True, null=True)
    nearest_qm = models.ForeignKey ('CoreQm', db_column='nearest_QM_id', blank=True, null=True)  # Field name made lowercase. 
    lon_utm = models.FloatField(blank=True, null=True)
    lat_utm = models.FloatField(blank=True, null=True)


class CoreDphotoContainsPerson(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    dphoto_id = models.IntegerField()
    person = models.ForeignKey ('CorePerson')


class CoreEntrance(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    new_since_parsing = models.BooleanField()
    non_public = models.BooleanField()
    name = models.CharField(max_length=100, blank=True)
    entrance_description = models.TextField(blank=True)
    explorers = models.TextField(blank=True)
    map_description = models.TextField(blank=True)
    location_description = models.TextField(blank=True)
    approach = models.TextField(blank=True)
    underground_description = models.TextField(blank=True)
    photo = models.TextField(blank=True)
    marking = models.CharField(max_length=2)
    marking_comment = models.TextField(blank=True)
    findability = models.CharField(max_length=1, blank=True)
    findability_description = models.TextField(blank=True)
    alt = models.TextField(blank=True)
    northing = models.TextField(blank=True)
    easting = models.TextField(blank=True)
    tag_station = models.TextField(blank=True)
    exact_station = models.TextField(blank=True)
    other_station = models.TextField(blank=True)
    other_description = models.TextField(blank=True)
    bearings = models.TextField(blank=True)
    url = models.CharField(max_length=200, blank=True)
    filename = models.CharField(max_length=200)
    cached_primary_slug = models.CharField(max_length=200, blank=True)


class CoreEntranceslug(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    entrance_id = models.IntegerField()
    slug = models.CharField(unique=True, max_length=50)
    primary = models.BooleanField()


class CoreExpedition(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    new_since_parsing = models.BooleanField()
    non_public = models.BooleanField()
    year = models.CharField(unique=True, max_length=20)
    name = models.CharField(max_length=100)


class CoreExpeditionday(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    new_since_parsing = models.BooleanField()
    non_public = models.BooleanField()
    expedition = models.ForeignKey (CoreExpedition)
    date = models.DateField()


class CoreLogbookentry(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    new_since_parsing = models.BooleanField()
    non_public = models.BooleanField()
    date = models.DateField()
    expeditionday = models.ForeignKey (CoreExpeditionday, blank=True, null=True)
    expedition = models.ForeignKey (CoreExpedition, blank=True, null=True)
    title = models.CharField(max_length=200)
    cave_slug = models.CharField(max_length=50)
    place = models.CharField(max_length=100, blank=True)
    text = models.TextField()
    slug = models.CharField(max_length=50)
    filename = models.CharField(max_length=200, blank=True)
    entry_type = models.CharField(max_length=50, blank=True)


class CoreNewsubcave(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    new_since_parsing = models.BooleanField()
    non_public = models.BooleanField()
    name = models.CharField(unique=True, max_length=200)


class CoreOthercavename(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    new_since_parsing = models.BooleanField()
    non_public = models.BooleanField()
    name = models.CharField(max_length=160)
    cave = models.ForeignKey (CoreCave)


class CorePerson(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    new_since_parsing = models.BooleanField()
    non_public = models.BooleanField()
    first_name = models.CharField(max_length=100)
    last_name = models.CharField(max_length=100)
    fullname = models.CharField(max_length=200)
    is_vfho = models.BooleanField()
    mug_shot = models.CharField(max_length=100, blank=True)
    blurb = models.TextField(blank=True)
    orderref = models.CharField(max_length=200)
    user_id = models.IntegerField(unique=True, blank=True, null=True)


class CorePersonexpedition(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    new_since_parsing = models.BooleanField()
    non_public = models.BooleanField()
    expedition = models.ForeignKey (CoreExpedition)
    person = models.ForeignKey (CorePerson)
    slugfield = models.CharField(max_length=50, blank=True)
    is_guest = models.BooleanField()
    expo_committee_position = models.CharField(max_length=200, blank=True)
    nickname = models.CharField(max_length=100, blank=True)


class CorePersontrip(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    new_since_parsing = models.BooleanField()
    non_public = models.BooleanField()
    personexpedition = models.ForeignKey (CorePersonexpedition, blank=True, null=True)
    time_underground = models.FloatField()
    logbook_entry = models.ForeignKey (CoreLogbookentry)
    is_logbook_entry_author = models.BooleanField()


class CoreQm(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    new_since_parsing = models.BooleanField()
    non_public = models.BooleanField()
    found_by = models.ForeignKey (CoreLogbookentry, blank=True, null=True)
    ticked_off_by = models.ForeignKey (CoreLogbookentry, blank=True, null=True)
    number = models.IntegerField()
    grade = models.CharField(max_length=1)
    location_description = models.TextField()
    nearest_station_description = models.CharField(max_length=400, blank=True)
    nearest_station_name = models.CharField(max_length=200, blank=True)
    nearest_station = models.ForeignKey ('CoreSurvexstation', blank=True, null=True)
    area = models.CharField(max_length=100, blank=True)
    completion_description = models.TextField(blank=True)
    comment = models.TextField(blank=True)


class CoreScannedimage(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    new_since_parsing = models.BooleanField()
    file = models.CharField(max_length=100)
    scanned_by = models.ForeignKey (CorePerson, blank=True, null=True)
    scanned_on = models.DateField(blank=True, null=True)
    survey_id = models.IntegerField()
    contents = models.CharField(max_length=20)
    number_in_wallet = models.IntegerField(blank=True, null=True)
    lon_utm = models.FloatField(blank=True, null=True)
    lat_utm = models.FloatField(blank=True, null=True)


class CoreSurvexblock(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    name = models.CharField(max_length=100)
    parent = models.ForeignKey ('self', blank=True, null=True)
    text = models.TextField()
    cave_id = models.IntegerField(blank=True, null=True)
    date = models.DateField(blank=True, null=True)
    expeditionday_id = models.IntegerField(blank=True, null=True)
    expedition_id = models.IntegerField(blank=True, null=True)
    survexfile = models.ForeignKey ('CoreSurvexfile', blank=True, null=True)
    begin_char = models.IntegerField()
    survexpath = models.CharField(max_length=200)
    survexscansfolder_id = models.IntegerField(blank=True, null=True)
    totalleglength = models.FloatField()


class CoreSurvexdirectory(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    path = models.CharField(max_length=200)
    cave_id = models.IntegerField(blank=True, null=True)
    primarysurvexfile_id = models.IntegerField(blank=True, null=True)


class CoreSurvexequate(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    cave_id = models.IntegerField(blank=True, null=True)


class CoreSurvexfile(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    path = models.CharField(max_length=200)
    survexdirectory = models.ForeignKey (CoreSurvexdirectory, blank=True, null=True)
    cave_id = models.IntegerField(blank=True, null=True)


class CoreSurvexleg(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    block_id = models.IntegerField()
    stationfrom = models.ForeignKey ('CoreSurvexstation')
    stationto = models.ForeignKey ('CoreSurvexstation')
    tape = models.FloatField()
    compass = models.FloatField()
    clino = models.FloatField()


class CoreSurvexpersonrole(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    survexblock = models.ForeignKey (CoreSurvexblock)
    nrole = models.CharField(max_length=200, blank=True)
    personname = models.CharField(max_length=100)
    person_id = models.IntegerField(blank=True, null=True)
    personexpedition_id = models.IntegerField(blank=True, null=True)
    persontrip_id = models.IntegerField(blank=True, null=True)
    expeditionday_id = models.IntegerField(blank=True, null=True)


class CoreSurvexscansfolder(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    fpath = models.CharField(max_length=200)
    walletname = models.CharField(max_length=200)


class CoreSurvexscansingle(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    ffile = models.CharField(max_length=200)
    name = models.CharField(max_length=200)
    survexscansfolder = models.ForeignKey (CoreSurvexscansfolder, blank=True, null=True)


class CoreSurvexstation(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    name = models.CharField(max_length=100)
    block_id = models.IntegerField()
    equate = models.ForeignKey (CoreSurvexequate, blank=True, null=True)
    x = models.FloatField(blank=True, null=True)
    y = models.FloatField(blank=True, null=True)
    z = models.FloatField(blank=True, null=True)


class CoreSurvextitle(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    survexblock = models.ForeignKey (CoreSurvexblock)
    title = models.CharField(max_length=200)
    cave_id = models.IntegerField(blank=True, null=True)


class CoreSurvey(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    new_since_parsing = models.BooleanField()
    non_public = models.BooleanField()
    expedition = models.ForeignKey (CoreExpedition)
    wallet_number = models.IntegerField(blank=True, null=True)
    wallet_letter = models.CharField(max_length=1, blank=True)
    comments = models.TextField(blank=True)
    location = models.CharField(max_length=400, blank=True)
    subcave = models.ForeignKey (CoreNewsubcave, blank=True, null=True)
    survex_block = models.ForeignKey (CoreSurvexblock, unique=True, blank=True, null=True)
    logbook_entry = models.ForeignKey (CoreLogbookentry)
    centreline_printed_on = models.DateField(blank=True, null=True)
    centreline_printed_by = models.ForeignKey (CorePerson, blank=True, null=True)
    tunnel_file = models.CharField(max_length=100, blank=True)
    tunnel_main_sketch = models.ForeignKey ('self', blank=True, null=True)
    integrated_into_main_sketch_on = models.DateField(blank=True, null=True)
    integrated_into_main_sketch_by = models.ForeignKey (CorePerson, blank=True, null=True)
    rendered_image = models.CharField(max_length=100, blank=True)


class CoreTunnelfile(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    tunnelpath = models.CharField(max_length=200)
    tunnelname = models.CharField(max_length=200)
    bfontcolours = models.BooleanField()
    filesize = models.IntegerField()
    npaths = models.IntegerField()


class CoreTunnelfileSurvexblocks(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    tunnelfile_id = models.IntegerField()
    survexblock = models.ForeignKey (CoreSurvexblock)


class CoreTunnelfileSurvexscans(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    tunnelfile_id = models.IntegerField()
    survexscansingle = models.ForeignKey (CoreSurvexscansingle)


class CoreTunnelfileSurvexscansfolders(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    tunnelfile_id = models.IntegerField()
    survexscansfolder = models.ForeignKey (CoreSurvexscansfolder)


class CoreTunnelfileSurvextitles(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    tunnelfile_id = models.IntegerField()
    survextitle = models.ForeignKey (CoreSurvextitle)


class CoreTunnelfileTunnelcontains(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    from_tunnelfile_id = models.IntegerField()
    to_tunnelfile_id = models.IntegerField()


class DjangoAdminLog(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    action_time = models.DateTimeField()
    object_id = models.TextField(blank=True)
    object_repr = models.CharField(max_length=200)
    action_flag = models.PositiveSmallIntegerField()
    change_message = models.TextField()
    content_type = models.ForeignKey ('DjangoContentType', blank=True, null=True)
    user = models.ForeignKey (AuthUser)


class DjangoContentType(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    name = models.CharField(max_length=100)
    app_label = models.CharField(max_length=100)
    model = models.CharField(max_length=100)


class DjangoMigrations(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    app = models.CharField(max_length=255)
    name = models.CharField(max_length=255)
    applied = models.DateTimeField()


class DjangoRedirect(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    site = models.ForeignKey ('DjangoSite')
    old_path = models.CharField(max_length=200)
    new_path = models.CharField(max_length=200)


class DjangoSession(models.Model):
    session_key = models.CharField(primary_key =True, max_length=40)
    session_data = models.TextField()
    expire_date = models.DateTimeField()


class DjangoSite(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    domain = models.CharField(max_length=100)
    name = models.CharField(max_length=50)


class FlatpagesEntranceredirect(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    originalurl = models.CharField(db_column='originalURL', max_length=200)  # Field name made lowercase. 
    entrance = models.ForeignKey (CoreEntrance)


class FlatpagesRedirect(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    originalurl = models.CharField(db_column='originalURL', unique=True, max_length=200)  # Field name made lowercase. 
    newurl = models.CharField(db_column='newURL', max_length=200)  # Field name made lowercase. 


class RegistrationRegistrationprofile(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    activation_key = models.CharField(max_length=40)
    user = models.ForeignKey (AuthUser, unique=True)


class AuthGroup(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    name = models.CharField(unique=True, max_length=80)


class AuthGroupPermissions(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    group = models.ForeignKey(AuthGroup)
    permission = models.ForeignKey('AuthPermission')


class AuthPermission(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    name = models.CharField(max_length=50)
    content_type = models.ForeignKey('DjangoContentType')
    codename = models.CharField(max_length=100)


class AuthUser(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    password = models.CharField(max_length=128)
    last_login = models.DateTimeField()
    is_superuser = models.BooleanField()
    username = models.CharField(unique=True, max_length=30)
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=30)
    email = models.CharField(max_length=75)
    is_staff = models.BooleanField()
    is_active = models.BooleanField()
    date_joined = models.DateTimeField()


class AuthUserGroups(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    user = models.ForeignKey (AuthUser)
    group = models.ForeignKey (AuthGroup)


class AuthUserUserPermissions(models.Model):
    id = models.IntegerField(primary_key =True)  # AutoField? 
    user = models.ForeignKey (AuthUser)
    permission = models.ForeignKey (AuthPermission)



Return to: Troggle architecture