mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Merged custom_columns_regress into the custom_columns test package.
This commit is contained in:
parent
7fe554b2a3
commit
d42a45de40
5 changed files with 66 additions and 130 deletions
|
@ -23,6 +23,7 @@ from django.utils.encoding import python_2_unicode_compatible
|
|||
|
||||
@python_2_unicode_compatible
|
||||
class Author(models.Model):
|
||||
Author_ID = models.AutoField(primary_key=True, db_column='Author ID')
|
||||
first_name = models.CharField(max_length=30, db_column='firstname')
|
||||
last_name = models.CharField(max_length=30, db_column='last')
|
||||
|
||||
|
@ -36,8 +37,10 @@ class Author(models.Model):
|
|||
|
||||
@python_2_unicode_compatible
|
||||
class Article(models.Model):
|
||||
Article_ID = models.AutoField(primary_key=True, db_column='Article ID')
|
||||
headline = models.CharField(max_length=100)
|
||||
authors = models.ManyToManyField(Author, db_table='my_m2m_table')
|
||||
primary_author = models.ForeignKey(Author, db_column='Author ID', related_name='primary_set', null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.headline
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue