def post(self, request, friendsite_id, *args, **kwargs): try: friendsite = FriendSites.objects.get(id=friendsite_id) friendsite.active = not friendsite.active friendsite.save() if friendsite.active: audit_description = f"Se activa el Sitio :{friendsite_id}" else: audit_description = f"Se desactiva el Sitio :{friendsite_id}" Audits.audit_action(request.user, "", audit_description, "DELETE") return HttpResponse("ok", status=200) except FriendSites.DoesNotExist: return HttpResponse("Cita not found", status=404) except Exception as e: print(e) return HttpResponse("error code", status=500)
def post(self, request, book_id, *args, **kwargs): try: book = BookEntry.objects.get(id=book_id) book.is_active = not book.is_active book.save() if book.is_active: audit_description = f"Se activa el Sitio :{book_id}" else: audit_description = f"Se desactiva el Sitio :{book_id}" Audits.audit_action(request.user, "", audit_description, "DELETE") return HttpResponse("ok", status=200) except BookEntry.DoesNotExist: return HttpResponse("Sitio not found", status=404) except Exception as e: print(e) return HttpResponse("error code", status=500)
def post(self, request, subcritor_id, *args, **kwargs): try: subcritor = Suscriptor.objects.get(id=subcritor_id) subcritor.active = not subcritor.active subcritor.save() if subcritor.active: audit_description = f"Se activa el Sitio :{subcritor_id}" else: audit_description = f"Se desactiva el Sitio :{subcritor_id}" Audits.audit_action(request.user, "", audit_description, "DELETE") return HttpResponse("ok", status=200) except Suscriptor.DoesNotExist: return HttpResponse("Cita not found", status=404) except Exception as e: print(e) return HttpResponse("error code", status=500)
def post(self, request, blog_id, *args, **kwargs): try: blog = BlogEntry.objects.get(id=blog_id) blog.featured = not blog.featured blog.save() if blog.featured: audit_description = f"El blog esta en destacados :{blog_id}" else: audit_description = f"El blog no esta en destacados :{blog_id}" Audits.audit_action(request.user, "", audit_description, "DELETE") return HttpResponse("ok", status=200) except BlogEntry.DoesNotExist: return HttpResponse("Blog not found", status=404) except Exception as e: print(e) return HttpResponse("error code", status=500)