bug 574271, is_owner and is_publisher methods

This commit is contained in:
Dave Dash 2010-08-02 16:29:01 -07:00
Родитель e335ecf153
Коммит 0076b62007
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -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)