bug 574271, is_owner and is_publisher methods
This commit is contained in:
Родитель
e335ecf153
Коммит
0076b62007
|
@ -230,9 +230,6 @@ class Collection(amo.models.ModelBase):
|
|||
CollectionAddon.objects.filter(addon=addon, collection=self).delete()
|
||||
self.save() # To invalidate Collection.
|
||||
|
||||
def is_owner(self, user):
|
||||
return (user.id == self.author_id)
|
||||
|
||||
@staticmethod
|
||||
def transformer(collections):
|
||||
if not collections:
|
||||
|
@ -243,6 +240,12 @@ class Collection(amo.models.ModelBase):
|
|||
for c in collections:
|
||||
c.author = authors.get(c.author_id)
|
||||
|
||||
def owned_by(self, user):
|
||||
return (user.id == self.author_id)
|
||||
|
||||
def publishable_by(self, user):
|
||||
return (user in self.users.all())
|
||||
|
||||
|
||||
class CollectionAddon(amo.models.ModelBase):
|
||||
addon = models.ForeignKey(Addon)
|
||||
|
|
Загрузка…
Ссылка в новой задаче