nothing to do with 0 files

This commit is contained in:
j 2011-09-04 20:36:10 +02:00
parent fbfd86ced3
commit f535656941

View file

@ -163,6 +163,7 @@ class Item(models.Model):
return default return default
def access(self, user): def access(self, user):
#check rights level
if self.public: if self.public:
return True return True
elif user.is_authenticated() and \ elif user.is_authenticated() and \
@ -752,6 +753,9 @@ class Item(models.Model):
files = archive.models.File.objects.filter(item=self, files = archive.models.File.objects.filter(item=self,
streams__available=True, streams__available=True,
streams__source=None) streams__source=None)
if files.count() == 0:
return
def get_level(users): def get_level(users):
if users.filter(is_superuser=True).count() > 0: level = 0 if users.filter(is_superuser=True).count() > 0: level = 0
elif users.filter(is_staff=True).count() > 0: level = 1 elif users.filter(is_staff=True).count() > 0: level = 1