Create app and obtain models from inspectdb

This commit is contained in:
PCoder 2021-07-27 09:30:24 +05:30
parent c43394701e
commit a6f2fe912d
7 changed files with 165 additions and 0 deletions

0
app/__init__.py Normal file
View file

3
app/admin.py Normal file
View file

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
app/apps.py Normal file
View file

@ -0,0 +1,6 @@
from django.apps import AppConfig
class AppConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'app'

View file

150
app/models.py Normal file
View file

@ -0,0 +1,150 @@
# 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
# * Make sure each ForeignKey and OneToOneField has `on_delete` set to the desired behavior
# * 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.
from django.db import models
class AlembicVersion(models.Model):
version_num = models.CharField()
class Meta:
managed = False
db_table = 'alembic_version'
class Field(models.Model):
id = models.AutoField()
name = models.CharField(blank=True, null=True)
class Meta:
managed = False
db_table = 'field'
class FieldsPeople(models.Model):
person = models.ForeignKey('Person', models.DO_NOTHING, blank=True, null=True)
field = models.ForeignKey(Field, models.DO_NOTHING, blank=True, null=True)
class Meta:
managed = False
db_table = 'fields_people'
class Method(models.Model):
id = models.AutoField()
name = models.CharField(blank=True, null=True)
class Meta:
managed = False
db_table = 'method'
class MethodsPeople(models.Model):
person = models.ForeignKey('Person', models.DO_NOTHING, blank=True, null=True)
method = models.ForeignKey(Method, models.DO_NOTHING, blank=True, null=True)
class Meta:
managed = False
db_table = 'methods_people'
class Person(models.Model):
id = models.AutoField()
source_id = models.IntegerField(blank=True, null=True)
title = models.CharField(blank=True, null=True)
first_name = models.CharField(blank=True, null=True)
last_name = models.CharField(blank=True, null=True)
organisation = models.CharField(blank=True, null=True)
position = models.CharField(blank=True, null=True)
country = models.CharField(blank=True, null=True)
contact_email = models.CharField(blank=True, null=True)
personal_url = models.CharField(blank=True, null=True)
biography = models.TextField(blank=True, null=True)
field_indexer = models.TextField(db_column='_indexer', blank=True, null=True) # Field renamed because it started with '_'.
class Meta:
managed = False
db_table = 'person'
class Range(models.Model):
id = models.AutoField()
source_id = models.IntegerField(blank=True, null=True)
gmba_id = models.CharField(blank=True, null=True)
name = models.CharField(blank=True, null=True)
countries = models.CharField(blank=True, null=True)
class Meta:
managed = False
db_table = 'range'
class RangesPeople(models.Model):
person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True)
range = models.ForeignKey(Range, models.DO_NOTHING, blank=True, null=True)
class Meta:
managed = False
db_table = 'ranges_people'
class Resource(models.Model):
id = models.AutoField()
source_id = models.IntegerField(blank=True, null=True)
title = models.CharField(blank=True, null=True)
url = models.CharField(blank=True, null=True)
citation = models.TextField(blank=True, null=True)
abstract = models.TextField(blank=True, null=True)
class Meta:
managed = False
db_table = 'resource'
class ResourcesPeople(models.Model):
person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True)
resource = models.ForeignKey(Resource, models.DO_NOTHING, blank=True, null=True)
class Meta:
managed = False
db_table = 'resources_people'
class Scale(models.Model):
id = models.AutoField()
name = models.CharField(blank=True, null=True)
class Meta:
managed = False
db_table = 'scale'
class ScalesPeople(models.Model):
person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True)
scale = models.ForeignKey(Scale, models.DO_NOTHING, blank=True, null=True)
class Meta:
managed = False
db_table = 'scales_people'
class TaxaPeople(models.Model):
person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True)
taxon = models.ForeignKey('Taxon', models.DO_NOTHING, blank=True, null=True)
class Meta:
managed = False
db_table = 'taxa_people'
class Taxon(models.Model):
id = models.AutoField()
name = models.CharField(blank=True, null=True)
class Meta:
managed = False
db_table = 'taxon'

3
app/tests.py Normal file
View file

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

3
app/views.py Normal file
View file

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.