Test code for posting an object to a subcollection, and accompanying view code. (In this case organizations/n/projects)

To be generalized later.
This commit is contained in:
Michael DeHaan
2013-03-22 14:23:50 -04:00
parent a59d26f42b
commit d179c91537
3 changed files with 38 additions and 28 deletions

View File

@@ -21,7 +21,7 @@ class CommonModel(models.Model):
name = models.CharField(max_length=512, unique=True)
description = models.TextField(blank=True, default='')
created_by = models.ForeignKey('auth.User', on_delete=SET_NULL, null=True, blank=True, related_name='+') # FIXME: want to make required?
created_by = models.ForeignKey('auth.User', on_delete=SET_NULL, null=True, related_name='%s(class)s_created') # not blank=False on purpose for admin!
creation_date = models.DateField(auto_now_add=True)
tags = models.ManyToManyField('Tag', related_name='%(class)s_tags', blank=True)
audit_trail = models.ManyToManyField('AuditTrail', related_name='%(class)s_audit_trails', blank=True)