Fixed questions permissions

remotes/origin/enhancement/email-actions
David Barragán Merino 2013-10-30 15:06:30 +01:00
parent 36aaefb88b
commit 1faca07dcd
2 changed files with 4 additions and 15 deletions

View File

@ -38,7 +38,7 @@ class Question(WatchedMixin):
verbose_name=_("assigned_to"))
created_date = models.DateTimeField(auto_now_add=True, null=False, blank=False,
verbose_name=_("created date"))
modified_date = models.DateTimeField(auto_now_add=True, null=False, blank=False,
modified_date = models.DateTimeField(auto_now=True, null=False, blank=False,
verbose_name=_("modified date"))
watchers = models.ManyToManyField(settings.AUTH_USER_MODEL, null=True, blank=True,
related_name="watched_questions",
@ -59,26 +59,15 @@ class Question(WatchedMixin):
class Meta:
verbose_name = "question"
verbose_name_plural = "questions"
ordering = ["project", "created_date", "subject"]
ordering = ["project", "created_date"]
unique_together = ("ref", "project")
permissions = (
("reply_question", _("Can reply questions")),
("change_owned_question", _("Can modify owned questions")),
("change_assigned_question", _("Can modify assigned questions")),
("assign_question_to_other", _("Can assign questions to others")),
("assign_question_to_myself", _("Can assign questions to myself")),
("change_question_state", _("Can change the question state")),
("view_question", _("Can view the question")),
("view_question", "Can view question"),
)
def __str__(self):
return self.subject
def save(self, *args, **kwargs):
if self.id:
self.modified_date = timezone.now()
super(Question, self).save(*args, **kwargs)
@property
def is_closed(self):
return self.status.is_closed

View File

@ -4,7 +4,7 @@ from greenmine.base.permissions import BasePermission
class QuestionPermission(BasePermission):
get_permission = "can_view_question"
get_permission = "view_question"
put_permission = "change_question"
patch_permission = "change_question"
delete_permission = "delete_question"