Management form in Model Formsets
Hi, I am using Django 1.2 and developing using Model formsets. Using JavaScript, I am allowing the user to dynamically "Add another" formset on the template, but I can't figure out what exactly I have to modify in the management forms, for all the formsets to be successfully saved. The documentation points out to three properties in the management form - form-TOTAL_FORMS, form-INITIAL_FORMS and form-MAX_NUM_FORMS. But I don't understand, which properties I have to exactly modify and how, when a new formset is being added dynamically using JavaScript ? Thanks :) Regards, Samar -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Ecs6EVDku_YJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Management form in Model Formsets
Thanks Thomas! I checked the script and tried to follow it. It seems that for Django 1.2, *not* modifying the form-TOTAL_FORMS, form-INITIAL_FORMS and form-MAX_NUM_FORMS works properly!! Regards, Samar On Sunday, 1 July 2012 22:12:37 UTC+5:30, Thomas Orozco wrote: > > You might want to check this snippet out: djangosnippets.org/snippets/1389 > */* > Le 1 juil. 2012 06:27, "Knight Samar" a écrit : > >> Hi, >> >> I am using Django 1.2 and developing using Model formsets. Using >> JavaScript, I am allowing the user to dynamically "Add another" formset on >> the template, but I can't figure out what exactly I have to modify in the >> management forms, for all the formsets to be successfully saved. >> >> The documentation points out to three properties in the management form - >> form-TOTAL_FORMS, form-INITIAL_FORMS and form-MAX_NUM_FORMS. But I don't >> understand, which properties I have to exactly modify and how, when a new >> formset is being added dynamically using JavaScript ? >> >> Thanks :) >> >> Regards, >> Samar >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/django-users/-/Ecs6EVDku_YJ. >> To post to this group, send email to django-users@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/0MFh_Lo5aDEJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Getting children of an ABC
I am using Django 1.3.1 and I have the following piece of models: class masterData(models.Model): uid = models.CharField(max_length=20,primary_key=True) class Meta: abstract = True; class Type1(masterData): pass; class Type2(masterData): pass; Now, I am trying to get a list of all child classes of masterData. I have tried: masterData.__subclasses__() The very interesting thing that I found about the above is that it works flawlessly in *python manage.py shell* and does NOT work at all when running the webserver! So how do I get the models derived from an Abstract Base Class model ? Regards, Samar -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Django not enforcing blank=False on a model
Hi, I have a model > from django.db import models > > class Organization(models.Model): > name = models.CharField(max_length=100, > blank = False, #mandatory > help_text = "Name of your Organization", > verbose_name = '', > unique = True, > primary_key = True, > ) > > and a piece of code > from organization.models import Organization > o = Organization.objects.create() > o.save() which works *without raising an IntegrityError!* And the following also works just the same! > from organization.models import Organization > o = Organization() o.save() I am using SQLite3(SQLite 3.7.9 2011-11-01 00:52:41 c7c6050ef060877ebe77b41d959e9df13f8c9b5e) as the database backend and it shows the following as the schema: CREATE TABLE "organization_organization" ( "name" varchar(100) NOT NULL > PRIMARY KEY ); Even if SQLite3 was buggy, shouldn't Django itself enforce the constraint on ORM layer ? I have deleted .pyc files and also the .sqlite3 file before testing again. I am using Django 1.5.1 What am I missing ? Why is Django *NOT* enforcing blank=False ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.