skip to Main Content

Javascript – Django 'none' values from ajax

My views: def deleteDepartement(request): object_id = request.POST.get('Id') name= request.POST.get('name') print(object_id) print(name) try: D=Department.objects.get(id=object_id) except: print("NOT FOUND") return redirect('department') JavaScript code: $.ajax({ type: 'POST', url: "{% url 'deleteDepartement' %}", data: { csrfmiddlewaretoken: '{{ csrf_token }}', Id:objectId, name:'test', }, }); I got…

VIEW QUESTION

Postgresql – Using field in Trunc's kind property

I use PostgreSQL in my project and have three related models: class Timer(models.Model): start = models.DateTimeField() end = models.DateTimeField() task = models.ForeignKey( Task, models.CASCADE, related_name="timers", ) class Task(models.Model): name = models.CharField(max_length=64) wanted_duration = models.DurationField() frequency = models.ForeignKey( Frequency, models.CASCADE, related_name="tasks",…

VIEW QUESTION
Back To Top
Search