JSONable model base

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

  1. Play nice with ModelAdmin mixins by chris.dickinson 3 years, 1 month ago
  2. Validating Model subclass by slacy 2 weeks, 2 days ago
  3. Model manager with row caching by jobs@flowgram.com 3 years, 7 months ago
  4. DRY with common model fields by miracle2k 4 years, 7 months ago
  5. Child aware model inheritance by rix 3 years, 2 months ago

Comments

(Forgotten your password?)