Commits

Doug Tyler  committed 5d0c153

Add meta classes to models; Removed default values from UserStory

  • Participants
  • Parent commits a95c324

Comments (0)

Files changed (2)

File user_stories/stories/admin.py

+from django.contrib import admin
+from django.contrib.auth.models import User
+from django.contrib.sites.models import Site
+from django.contrib.auth.models import Group
+from user_stories.stories.models import Role, Priority, UserStory
+
+
+class PriorityInline(admin.TabularInline):
+    model = Priority
+    extra = 1
+
+
+class PriorityAdmin(admin.ModelAdmin):
+    inlines = [PriorityInline]
+
+
+admin.site.register(Role)
+admin.site.register(Priority, PriorityAdmin)
+admin.site.register(UserStory)
+
+admin.site.unregister(User)
+admin.site.unregister(Group)
+admin.site.unregister(Site)

File user_stories/stories/models.py

     def __unicode__(self):
         return self.name
 
+    class Meta:
+        verbose_name_plural = 'priorities'
+
 
 class UserStory(models.Model):
-    role = models.ForeignKey('Role', default='Visitor')
+    role = models.ForeignKey('Role')
     action = models.CharField(max_length=140)
     reason = models.CharField(max_length=140)
-    priority = models.ForeignKey('Priority', default='Low')
+    priority = models.ForeignKey('Priority')
     date_added = models.DateTimeField(auto_now=False, auto_now_add=True)
     date_updated = models.DateTimeField(auto_now=True, auto_now_add=True)
 
             self.action,
             self.reason
         )
+
+    class Meta:
+        verbose_name = 'User Story'
+        verbose_name_plural = 'User Stories'