def tagUser(request): if request.user.is_authenticated(): try: t = Tag.objects.get(name=request.POST['tag']) except: t = Tag(name=request.POST['tag']) t.save() try: utag = UserTag.objects.get(user=request.user, tag=t) except: utag = UserTag(user=request.user, tag=t) utag.save() return jResponse('{"status":"ok"}') return jResponse('{"status":"error"}')
def tagVenue(request): if request.user.is_authenticated(): try: v = Venue.objects.get(pk=request.POST['venueid']) try: t = Tag.objects.get(name=request.POST['tag']) except: t = Tag(name=request.POST['tag']) t.save() try: vtag = VenueTag.objects.get(venue=v, tag=t) except: vtag = VenueTag(venue=v, tag=t) vtag.save() return jResponse('{"status":"ok"}') except: pass return jResponse('{"status":"error"}')
def tagEvent(request): if request.user.is_authenticated(): try: e = Event.objects.get(pk=request.POST['eventid']) try: t = Tag.objects.get(name=request.POST['tag']) except: t = Tag(name=request.POST['tag']) t.save() try: etag = EventTag.objects.get(event=e, tag=t) except: etag = EventTag(event=e, tag=t) etag.save() return jResponse('{"status":"ok"}') except: pass return jResponse('{"status":"error"}')