Django-Form

Working with Formset

As documentation says: A formset is a layer of abstraction to work with multiple forms on the same page. It can be best compared to a data grid. So here I am going to show a very simple django formset implementation example. Here we are going to use the following model, form, template, view: Model class Product(models.Model): name = models.CharField(max_length=50) quantity = models.IntegerField() price = models.IntegerField() class Distributor(models.Model): name = models.CharField(max_length=100) products= models.ManyToManyField(Product) These fairly simple models, where…

Keep reading

RichText Editor in Django Admin Site

I wanted to add a rich text editor within django administrator. Its not that hard to add a rich text editor, as there are editors like ckeditor, tinymce. There are multiple plugins for django like django-ckeditor or django-tinymce etc. It seemed very complicated to use for me. So what I did here is that I have downloaded ckeditor stadard edition and extracted it in my Static folder and loaded the js file within templates>admin>base.html. Now, using firebug, I retrieved the textarea name/id/class in which I…

Keep reading