allow saving our version of a public catalog
This commit is contained in:
@ -53,8 +53,16 @@ def save_catalog(request):
|
||||
id = data.get('id')
|
||||
|
||||
if id:
|
||||
log.debug('saving existing catalog, id {}'.format(id))
|
||||
cat = get_object_or_404(Catalog, id=id, owner=request.user)
|
||||
try:
|
||||
cat = Catalog.objects.get(id=id)
|
||||
|
||||
if cat.owner == request.user:
|
||||
log.debug('saving existing catalog, id {}'.format(id))
|
||||
else:
|
||||
log.debug('copying public catalog, id {}'.format(id))
|
||||
cat = Catalog(owner=request.user, season=cat.season, region=cat.region)
|
||||
except ObjectDoesNotExist:
|
||||
raise Http404("Catalog not found")
|
||||
else:
|
||||
season = Season.objects.get(id=data.get('season'))
|
||||
region = Region.objects.get(id=data.get('region'))
|
||||
|
||||
Reference in New Issue
Block a user