0

There is a code in which django serializers are used to serialize django model to json type.

result = Items.objects.filter(product_type__name = subcategory)
result = result.filter(item_name__icontains=autoc)
result = serializers.serialize('json', result, fields=('item_name',))

There has to be a place in which serializers have stored the data for Model "Items". I want to know what is the data. Where is the data stored? Thanks in advance.

proprius
  • 502
  • 9
  • 20
  • 1
    What data? Do you mean the output from the call to `serializers.serialize`? It's in your `result` variable, where you put it. – Daniel Roseman Dec 10 '14 at 16:08
  • yes. I meant the serialized data. I guess all of the data is stored in the database but how to search of the data? Moreover, we cannot say that the data is generated for an instance and then vanish away as soon as new instance of "result" is generated. This is because "icontains" matches from the previously stored data. – proprius Dec 10 '14 at 17:55
  • But as I said, it's in the `result` variable. Where else would it be? – Daniel Roseman Dec 10 '14 at 17:56
  • I want to know about the location in database. – proprius Dec 11 '14 at 07:59
  • I'm sorry, I really don't understand. Why would the serialised data be in the database? – Daniel Roseman Dec 11 '14 at 08:01
  • It has to be, otherwise how can filter be applied on a model. Applying filter means there has to be a data stored somewhere from which required data is being extracted. – proprius Dec 11 '14 at 09:10
  • But you're not applying filter to the serialized data, you're applying it to the original db query. – Daniel Roseman Dec 11 '14 at 09:18

0 Answers0