1 2 3 4 5 | class JsonableModel(models.Model):
class Meta:
abstract = True
def to_json(self):
return render_to_string('models/%s.json' % self._meta.module_name,{'object':self})
|
More like this
- Play nice with ModelAdmin mixins by chris.dickinson 3 years, 1 month ago
- Validating Model subclass by slacy 2 weeks, 2 days ago
- Model manager with row caching by jobs@flowgram.com 3 years, 7 months ago
- DRY with common model fields by miracle2k 4 years, 7 months ago
- Child aware model inheritance by rix 3 years, 2 months ago
Comments