From 993f654f7e3334b235391a8d1f779c3e715a610d Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Thu, 20 Feb 2014 16:21:50 +0200 Subject: Better --- apps/it/models.py | 9 +++++++-- apps/it/templatetags/it_tags.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'apps/it') diff --git a/apps/it/models.py b/apps/it/models.py index 5882d3f..f1d95cc 100644 --- a/apps/it/models.py +++ b/apps/it/models.py @@ -51,10 +51,13 @@ class Article(AbstractGenericItem): class Issue(models.Model): - title = models.CharField(max_length=256, default=_('New Issue')) description = models.TextField() + title = models.CharField(max_length=256, default=_('New Issue')) priority = models.PositiveIntegerField(default=0) - assigned_to = models.ForeignKey(User, null=True, related_name='issues') + assigned_to = models.ForeignKey(User, + null=True, + blank=True, + related_name='issues') users = models.ManyToManyField( User, null=True, @@ -85,6 +88,7 @@ class Issue(models.Model): class Meta: ordering = ['-priority', 'created_at'] + class Task(models.Model): description = models.TextField() issue = models.ForeignKey(Issue, null=True, editable=False) @@ -106,6 +110,7 @@ class Task(models.Model): class Meta: ordering = ['-created_at'] + class Asset(models.Model): name = models.CharField(max_length=256, default='New Asset') description = models.TextField() diff --git a/apps/it/templatetags/it_tags.py b/apps/it/templatetags/it_tags.py index 592ac82..09c7dd1 100644 --- a/apps/it/templatetags/it_tags.py +++ b/apps/it/templatetags/it_tags.py @@ -14,7 +14,7 @@ def markdown(text): @register.simple_tag def new_issue_count(request): - return safestring.mark_safe('14') + return request.user.issues.all().count() @register.simple_tag def new_asset_count(request): -- cgit v1.2.3