Answer the question
In order to leave comments, you need to log in
How to serialize id in django?
There is a standard serializer.
def patients_department(request):
stories_department = serializers.serialize('json', Disaese_history.objects.filter(exit_day=None),
use_natural_foreign_keys=True, use_natural_primary_keys=True)
return HttpResponse(stories_department)
department:(...)
doctor:(...)
enter_day:(...)
exit_day:(...)
number:(...)
patient:(...)
pay:(...)
class Disaese_history(models.Model):
patient = models.ForeignKey(Patient, default=None, null=True, on_delete=models.CASCADE)
department = models.ForeignKey(Department, default=None, null=True, on_delete=models.CASCADE)
number = models.CharField(max_length=10)
pay = models.ForeignKey(Pay, default=None, on_delete=models.CASCADE)
enter_day = models.DateField()
exit_day = models.DateField(default=None, null=True)
doctor = models.ForeignKey(User, default=None, null=True, on_delete=models.CASCADE)
def __str__(self):
return '{0}'.format(self.number)
class Meta:
verbose_name = 'Исория болезни'
verbose_name_plural = "Медицинские карты"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question