mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Followed style guide for model attribute ordering.
This commit is contained in:
parent
dd8ed64113
commit
e817ae74da
27 changed files with 148 additions and 135 deletions
|
@ -17,22 +17,22 @@ objects, and a ``Publication`` has multiple ``Article`` objects:
|
|||
class Publication(models.Model):
|
||||
title = models.CharField(max_length=30)
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
||||
class Meta:
|
||||
ordering = ('title',)
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
||||
class Article(models.Model):
|
||||
headline = models.CharField(max_length=100)
|
||||
publications = models.ManyToManyField(Publication)
|
||||
|
||||
def __str__(self):
|
||||
return self.headline
|
||||
|
||||
class Meta:
|
||||
ordering = ('headline',)
|
||||
|
||||
def __str__(self):
|
||||
return self.headline
|
||||
|
||||
What follows are examples of operations that can be performed using the Python
|
||||
API facilities. Note that if you are using :ref:`an intermediate model
|
||||
<intermediary-manytomany>` for a many-to-many relationship, some of the related
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue