Hello.
This is the model, which I take as an example:
Models.py
class orderEmergencyList(models.Model):
STATUS = [
("CE","EMAIL SENDS"),
("CR","EMAIL RECEIVED"),
("OA","ORDER ACCEPTED"),
("OR","ORDER REFUSED"),
("OD","ORDER OFF"),
]
ticket = models.IntegerField(default=1000, blank=True)
email=models.EmailField(blank=True)
status = models.CharField(max_length=3,choices= STATUS,default= "SO")
What I have to do is look for a provider from the database OrdenEmergenciaLista by ticket and email.
And then delete it.
order=orderEmergencyList.objects.filter(ticket=ticket_).filter(email=email_).first()
order.delete()
This is correct? or should I perform an order.save()
Then I need to know how many rows in the orderEmergencyList database there are with ticket=ticket_
order=orderEmergencyList.objects.filter(ticket=ticket_)
return len(order)
Is that way correct, by using the len function?