<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Handbook Troggle Data Model</title> <link rel="stylesheet" type="text/css" href="/css/main2.css" /> </head> <body><style>body { background: #fff url(/images/style/bg-system.png) repeat-x 0 0 }</style> <h2 id="tophead">CUCC Expedition Handbook - troggle</h2> <h1>Troggle Data Model (python)</h1> <h3>Troggle data architecture</h3> <figure class="onright"> <a href="../l/trogclass-1.html"><img src="../t/trogclass-2.jpg"></a> <br><figcaption>Class Diagram<br />(Click to enlarge)</figcaption> </figure> Auto-generated on 3 April 2020 with <var>troggle$ python3 manage.py inspectdb</var>. (Omitting all the 'Meta' sub-classes. )<br> Several classes have been edited out of this file between then and 14 September 2023 as they have been deleted as troggle has been tidied up. <p>All the classes below inherit from the django class (models.Model) and are thereby made persistent in the database. All <a href="https://docs.djangoproject.com/en/1.11/ref/models/fields/">persistent instance variables</a> are defined with e.g. "models.BooleanField()" types which is why they look so strange to a normal python programmer. <p>See <a href="/admin/doc/models/">the online auto-documentation</a> for the current set of core objects and their instance variables and foreign keys (anything below with "models.ForeignKey" in the type field is a foreign key. <br> This webpage is manually maintained and may be out of date.<code><pre><span style="color: green"># 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.</span> from django.db import models <span style="color: lime">class</span> <span style="color:blue"><b>Area</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> 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) <span style="color:blue">parent</span> = models.<span style="color:blue">ForeignKey</span> ('self', blank=True, null=True) <span style="color: lime">class</span> <span style="color:blue"><b>Cave</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> 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) <span style="color: lime">class</span> <span style="color:blue"><b>CaveArea</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> cave_id = models.IntegerField() <span style="color:blue">area</span> = models.<span style="color:blue">ForeignKey</span> (CoreArea) <span style="color: lime">class</span> <span style="color:blue"><b>Caveandentrance</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> cave_id = models.IntegerField() entrance_id = models.IntegerField() entrance_letter = models.CharField(max_length=20, blank=True) <span style="color: lime">class</span> <span style="color:blue"><b>Caveslug</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> cave_id = models.IntegerField() slug = models.CharField(unique=True, max_length=50) primary = models.BooleanField() <span style="color: lime">class</span> <span style="color:blue"><b>Dataissue</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> 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) <span style="color: lime">class</span> <span style="color:blue"><b>Entrance</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> 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) <span style="color: lime">class</span> <span style="color:blue"><b>Entranceslug</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> entrance_id = models.IntegerField() slug = models.CharField(unique=True, max_length=50) primary = models.BooleanField() <span style="color: lime">class</span> <span style="color:blue"><b>Expedition</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> new_since_parsing = models.BooleanField() non_public = models.BooleanField() year = models.CharField(unique=True, max_length=20) name = models.CharField(max_length=100) <span style="color: lime">class</span> <span style="color:blue"><b>Logbookentry</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> new_since_parsing = models.BooleanField() non_public = models.BooleanField() date = models.DateField() <span style="color:blue">expedition</span> = models.<span style="color:blue">ForeignKey</span> (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) <span style="color: lime">class</span> <span style="color:blue"><b>Person</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> 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) <span style="color: lime">class</span> <span style="color:blue"><b>Personexpedition</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> new_since_parsing = models.BooleanField() non_public = models.BooleanField() <span style="color:blue">expedition</span> = models.<span style="color:blue">ForeignKey</span> (CoreExpedition) <span style="color:blue">person</span> = models.<span style="color:blue">ForeignKey</span> (CorePerson) slugfield = models.CharField(max_length=50, blank=True) is_guest = models.BooleanField() expo_committee_position = models.CharField(max_length=200, blank=True) <span style="color: lime">class</span> <span style="color:blue"><b>PersonLogbookEntry</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> new_since_parsing = models.BooleanField() non_public = models.BooleanField() <span style="color:blue">personexpedition</span> = models.<span style="color:blue">ForeignKey</span> (CorePersonexpedition, blank=True, null=True) time_underground = models.FloatField() <span style="color:blue">logbook_entry</span> = models.<span style="color:blue">ForeignKey</span> (CoreLogbookentry) is_logbook_entry_author = models.BooleanField() <span style="color: lime">class</span> <span style="color:blue"><b>Qm</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> new_since_parsing = models.BooleanField() non_public = models.BooleanField() number = models.IntegerField() grade = models.CharField(max_length=1) location_description = models.TextField() nearest_station_name = models.CharField(max_length=200, blank=True) area = models.CharField(max_length=100, blank=True) completion_description = models.TextField(blank=True) resolution_station_name = models.CharField(max_length=200, blank=True, null=True) area = models.CharField(max_length=100, blank=True, null=True) page_ref = models.TextField(blank=True, null=True) comment = models.TextField(blank=True, null=True) <span style="color: lime">class</span> <span style="color:blue"><b>Survexblock</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> name = models.CharField(max_length=100) <span style="color:blue">parent</span> = models.<span style="color:blue">ForeignKey</span> ('self', blank=True, null=True) text = models.TextField() cave_id = models.IntegerField(blank=True, null=True) date = models.DateField(blank=True, null=True) expedition_id = models.IntegerField(blank=True, null=True) <span style="color:blue">survexfile</span> = models.<span style="color:blue">ForeignKey</span> ('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() <span style="color: lime">class</span> <span style="color:blue"><b>Survexfile</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> path = models.CharField(max_length=200) <span style="color:blue">primary</span> = models.<span style="color:blue">ForeignKey</span> ( "SurvexFile", related_name="primarysurvex", blank=True, null=True, on_delete=models.SET_NULL ) cave_id = models.IntegerField(blank=True, null=True) <span style="color: lime">class</span> <span style="color:blue"><b>Survexpersonrole</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> <span style="color:blue">survexblock</span> = models.<span style="color:blue">ForeignKey</span> (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) personlogbookentry_id = models.IntegerField(blank=True, null=True) <span style="color: lime">class</span> <span style="color:blue"><b>Survexscansfolder</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> fpath = models.CharField(max_length=200) walletname = models.CharField(max_length=200) <span style="color: lime">class</span> <span style="color:blue"><b>Survexscansingle</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> ffile = models.CharField(max_length=200) name = models.CharField(max_length=200) <span style="color:blue">survexscansfolder</span> = models.<span style="color:blue">ForeignKey</span> (CoreSurvexscansfolder, blank=True, null=True) <span style="color: lime">class</span> <span style="color:blue"><b>Survexstation</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> name = models.CharField(max_length=100) block_id = models.IntegerField() <span style="color:blue">equate</span> = models.<span style="color:blue">ForeignKey</span> (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) <span style="color: lime">class</span> <span style="color:blue"><b>Dwgfile</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> dwgpath = models.CharField(max_length=200) dwgname = models.CharField(max_length=200) bfontcolours = models.BooleanField() filesize = models.IntegerField() npaths = models.IntegerField() <span style="color: lime">class</span> <span style="color:blue"><b>DjangoAdminLog</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> 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() <span style="color:blue">content_type</span> = models.<span style="color:blue">ForeignKey</span> ('DjangoContentType', blank=True, null=True) <span style="color:blue">user</span> = models.<span style="color:blue">ForeignKey</span> (AuthUser) <span style="color: lime">class</span> <span style="color:blue"><b>DjangoContentType</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> name = models.CharField(max_length=100) app_label = models.CharField(max_length=100) model = models.CharField(max_length=100) <span style="color: lime">class</span> <span style="color:blue"><b>DjangoMigrations</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> app = models.CharField(max_length=255) name = models.CharField(max_length=255) applied = models.DateTimeField() <span style="color: lime">class</span> <span style="color:blue"><b>DjangoRedirect</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> <span style="color:blue">site</span> = models.<span style="color:blue">ForeignKey</span> ('DjangoSite') old_path = models.CharField(max_length=200) new_path = models.CharField(max_length=200) <span style="color: lime">class</span> <span style="color:blue"><b>DjangoSession</b></span>(models.Model): session_key = models.CharField(<span style="color: magenta">primary_key</span> =True, max_length=40) session_data = models.TextField() expire_date = models.DateTimeField() <span style="color: lime">class</span> <span style="color:blue"><b>DjangoSite</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> domain = models.CharField(max_length=100) name = models.CharField(max_length=50) <span style="color: lime">class</span> <span style="color:blue"><b>RegistrationRegistrationprofile</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> activation_key = models.CharField(max_length=40) <span style="color:blue">user</span> = models.<span style="color:blue">ForeignKey</span> (AuthUser, unique=True) <span style="color: lime">class</span> <span style="color:blue"><b>AuthGroup</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> name = models.CharField(unique=True, max_length=80) <span style="color: lime">class</span> <span style="color:blue"><b>AuthGroupPermissions</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> <span style="color:blue">group</span> = models.<span style="color:blue">ForeignKey</span>(AuthGroup) <span style="color:blue"><span style="color:blue">permission</span></span> = models.<span style="color:blue">ForeignKey</span>('AuthPermission') <span style="color: lime">class</span> <span style="color:blue"><b>AuthPermission</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> name = models.CharField(max_length=50) <span style="color:blue">content_type</span> = models.<span style="color:blue">ForeignKey</span>('DjangoContentType') codename = models.CharField(max_length=100) <span style="color: lime">class</span> <span style="color:blue"><b>AuthUser</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> 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() <span style="color: lime">class</span> <span style="color:blue"><b>AuthUserGroups</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> <span style="color:blue">user</span> = models.<span style="color:blue">ForeignKey</span> (AuthUser) <span style="color:blue">group</span> = models.<span style="color:blue">ForeignKey</span> (AuthGroup) <span style="color: lime">class</span> <span style="color:blue"><b>AuthUserUserPermissions</b></span>(models.Model): id = models.IntegerField(<span style="color: magenta">primary_key</span> =True) <span style="color: green"># AutoField?</span> <span style="color:blue">user</span> = models.<span style="color:blue">ForeignKey</span> (AuthUser) <span style="color:blue">permission</span> = models.<span style="color:blue">ForeignKey</span> (AuthPermission) </pre></code> <hr /> Return to: <a href="trogarch.html">Troggle architecture</a><br /> Return to: <a href="trogintro.html">Troggle intro</a><br /> Troggle index: <a href="trogindex.html">Index of all troggle documents</a><br /> <hr /> </body> </html>