Skip to content

Instantly share code, notes, and snippets.

Darius dariushazimi

Block or report user

Report or block dariushazimi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View model.py
RELATIONSHIP_DOWNSTREAM = 1
RELATIONSHIP_UPSTREAM = 2
RELATIONSHIP_STATUSES = (
(RELATIONSHIP_DOWNSTREAM, 'DownStream'),
(RELATIONSHIP_UPSTREAM, 'UpStream'),
)
class Application(TimeStampModel):
@dariushazimi
dariushazimi / models.py
Last active Apr 22, 2016 — forked from meleksomai/models.py
An example of using many-to-many "through" to augment m2m relationships. See http://www.quora.com/How-do-you-query-with-a-condition-on-a-ManyToMany-model-in-Django for context.
View models.py
# For Python 3.x
from django.db import models
class Person(models.Model):
name = models.CharField(max_length=200)
groups = models.ManyToManyField('Group', through='GroupMember', related_name='people')
class Meta:
ordering = ['name']
You can’t perform that action at this time.