google-code-export / gaeframework

Automatically exported from code.google.com/p/gaeframework
0 stars 0 forks source link

Bug with Django Forms inheritance #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
I have next two forms:

'''models'''

class Blog(db.Model):
    slug = db.StringProperty('blog url', required=True)
    name = db.StringProperty('blog name', required=True)
    author = db.UserProperty(auto_current_user_add=True, required=True)

'''forms'''

class BlogCreateForm(forms.ModelForm):
    class Meta:
        model   = Blog
        exclude = ('author',)

    def clean_slug(self):
        return "something"

class BlogEditForm(BlogCreateForm):
    class Meta(BlogCreateForm.Meta):
        model   = Blog
        exclude = ('author', 'slug')

What is the expected output?
Form BlogEditForm rendered with two fields: "name" and "slug".

What do you see instead?
Form BlogEditForm rendered with one field "name".

Please provide any additional information below.
 * http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/ext/db/djangoforms.py#850
 * http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#form-inheritance
 * http://stackoverflow.com/questions/4259039/django-form-inheritance-on-google-app-engine

Original issue reported on code.google.com by anton.danilchenko on 26 Jan 2011 at 9:45

GoogleCodeExporter commented 9 years ago
Mistake in description.

What is the expected output?
Form BlogEditForm rendered with one field "name".

What do you see instead?
Form BlogEditForm rendered with two fields: "name" and "slug".

Original comment by anton.danilchenko on 26 Jan 2011 at 9:57