Changes between Initial Version and Version 1 of Ticket #16127
- Timestamp:
- May 30, 2011, 11:25:12 AM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #16127
- Property Component Database layer (models, ORM) → Core (Serialization)
- Property Triage Stage Unreviewed → Accepted
-
Ticket #16127 – Description
initial v1 3 3 4 4 models.py 5 5 {{{ 6 6 class Pessoa(models.Model): 7 7 nome = models.CharField(max_length=50) … … 20 20 def __unicode__(self): 21 21 return "%s, %s" % (self.nome, self.cpf) 22 }}} 22 23 23 24 views.py: 24 25 {{{ 25 26 def load_proprietarios(request): 26 27 data = serializers.serialize('json',Proprietario.objects.defer('cpf','telefone','celular','data_nascimento','data_inclusao',),ensure_ascii=False)) 27 28 return HttpResponse(data, mimetype="application/javascript") 29 }}} 28 30 29 31 This is the output: 30 32 {{{ 31 33 [{"pk": 1, "model": "proprietario.proprietario_deferred_celular_cpf_telefone_data_inclusao_data_nascimento", "fields": {}}] 34 }}} 32 35 33 36 Note that the "id" and the "nome" fields (class Proprietario / class abstract Pessoa) does not appear after defer() method.