This commit is contained in:
rolux 2011-10-26 14:52:48 +00:00
commit b494370bd0
3 changed files with 9 additions and 5 deletions

View file

@ -107,8 +107,8 @@ class Annotation(models.Model):
def set_public_id(self):
public_id = Annotation.objects.filter(item=self.item, id__lt=self.id).count()
self.public_id = "%s/%s" % ( self.item.itemId, ox.to26(public_id))
Annotation.objects.filter(id=self.id).update(public_id=public_id)
self.public_id = "%s/%s" % (self.item.itemId, ox.to26(public_id))
Annotation.objects.filter(id=self.id).update(public_id=self.public_id)
def save(self, *args, **kwargs):
if not self.id:

View file

@ -257,9 +257,9 @@ def moveFiles(request):
data['director'] = []
else:
data['director'] = data['director'].split(', ')
i = get_item(data)
i = get_item(data, user=request.user)
else:
i = get_item({'imdbId': data['itemId']})
i = get_item({'imdbId': data['itemId']}, user=request.user)
changed = [i.itemId]
for f in models.File.objects.filter(oshash__in=data['ids']):
if f.item.id != i.itemId and f.editable(request.user):

View file

@ -253,6 +253,8 @@ class Item(models.Model):
update_poster = False
update_ids = False
if not self.id:
if self.user:
self.level = settings.CONFIG['rightsLevel'][self.user.get_profile().get_level()]
if not self.itemId:
self.itemId = str(uuid.uuid1())
super(Item, self).save(*args, **kwargs)
@ -943,7 +945,9 @@ class Item(models.Model):
self.save()
elif os.path.exists(poster):
with open(poster) as f:
self.poster.save('poster.jpg', ContentFile(f.read()))
data = f.read()
if data:
self.poster.save('poster.jpg', ContentFile(data))
def make_siteposter(self):
poster = self.path('siteposter.jpg')