2013-04-01 17:51:53 +00:00
|
|
|
# -*- encoding: utf-8 -*-
|
|
|
|
from __future__ import unicode_literals
|
2014-12-21 20:19:05 +00:00
|
|
|
|
2011-01-24 15:18:56 +00:00
|
|
|
from django.db import models
|
2011-01-24 14:58:05 +00:00
|
|
|
|
2011-01-24 15:18:56 +00:00
|
|
|
|
|
|
|
class People(models.Model):
|
|
|
|
name = models.CharField(max_length=255)
|
2013-01-28 09:21:07 +00:00
|
|
|
parent = models.ForeignKey('self')
|
2011-01-24 15:18:56 +00:00
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2011-01-24 15:18:56 +00:00
|
|
|
class Message(models.Model):
|
|
|
|
from_field = models.ForeignKey(People, db_column='from_id')
|
2012-02-05 07:51:37 +00:00
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2012-02-05 07:51:37 +00:00
|
|
|
class PeopleData(models.Model):
|
|
|
|
people_pk = models.ForeignKey(People, primary_key=True)
|
|
|
|
ssn = models.CharField(max_length=11)
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2012-02-05 07:51:37 +00:00
|
|
|
class PeopleMoreData(models.Model):
|
|
|
|
people_unique = models.ForeignKey(People, unique=True)
|
|
|
|
license = models.CharField(max_length=255)
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2012-02-11 20:53:48 +00:00
|
|
|
class DigitsInColumnName(models.Model):
|
|
|
|
all_digits = models.CharField(max_length=11, db_column='123')
|
|
|
|
leading_digit = models.CharField(max_length=11, db_column='4extra')
|
|
|
|
leading_digits = models.CharField(max_length=11, db_column='45extra')
|
2012-08-23 19:07:56 +00:00
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2014-07-05 18:48:57 +00:00
|
|
|
class SpecialName(models.Model):
|
2012-08-23 19:07:56 +00:00
|
|
|
field = models.IntegerField(db_column='field')
|
2012-08-23 20:50:25 +00:00
|
|
|
# Underscores
|
2012-08-23 19:07:56 +00:00
|
|
|
field_field_0 = models.IntegerField(db_column='Field_')
|
|
|
|
field_field_1 = models.IntegerField(db_column='Field__')
|
|
|
|
field_field_2 = models.IntegerField(db_column='__field')
|
2012-08-23 20:50:25 +00:00
|
|
|
# Other chars
|
|
|
|
prc_x = models.IntegerField(db_column='prc(%) x')
|
2013-04-01 17:51:53 +00:00
|
|
|
non_ascii = models.IntegerField(db_column='tamaño')
|
2013-01-31 19:34:36 +00:00
|
|
|
|
2014-07-05 18:48:57 +00:00
|
|
|
class Meta:
|
|
|
|
db_table = "inspectdb_special.table name"
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2013-01-31 19:34:36 +00:00
|
|
|
class ColumnTypes(models.Model):
|
|
|
|
id = models.AutoField(primary_key=True)
|
2013-02-01 01:00:25 +00:00
|
|
|
big_int_field = models.BigIntegerField()
|
2013-08-11 20:19:09 +00:00
|
|
|
bool_field = models.BooleanField(default=False)
|
2013-02-01 01:00:25 +00:00
|
|
|
null_bool_field = models.NullBooleanField()
|
|
|
|
char_field = models.CharField(max_length=10)
|
2014-10-20 18:05:43 +00:00
|
|
|
null_char_field = models.CharField(max_length=10, blank=True, null=True)
|
2013-02-01 01:00:25 +00:00
|
|
|
comma_separated_int_field = models.CommaSeparatedIntegerField(max_length=99)
|
|
|
|
date_field = models.DateField()
|
|
|
|
date_time_field = models.DateTimeField()
|
|
|
|
decimal_field = models.DecimalField(max_digits=6, decimal_places=1)
|
|
|
|
email_field = models.EmailField()
|
|
|
|
file_field = models.FileField(upload_to="unused")
|
|
|
|
file_path_field = models.FilePathField()
|
|
|
|
float_field = models.FloatField()
|
|
|
|
int_field = models.IntegerField()
|
|
|
|
gen_ip_adress_field = models.GenericIPAddressField(protocol="ipv4")
|
|
|
|
pos_int_field = models.PositiveIntegerField()
|
|
|
|
pos_small_int_field = models.PositiveSmallIntegerField()
|
|
|
|
slug_field = models.SlugField()
|
|
|
|
small_int_field = models.SmallIntegerField()
|
|
|
|
text_field = models.TextField()
|
|
|
|
time_field = models.TimeField()
|
|
|
|
url_field = models.URLField()
|
2014-07-14 20:42:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
class UniqueTogether(models.Model):
|
|
|
|
field1 = models.IntegerField()
|
|
|
|
field2 = models.CharField(max_length=10)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
unique_together = ('field1', 'field2')
|