Re: [Django] #17301: Defining fieldsets in a form class

2014-07-09 Thread Django
#17301: Defining fieldsets in a form class
-+-
 Reporter:  msiedlarek   |Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:  duplicate
 Keywords:  form, forms, | Triage Stage:  Accepted
  fieldsets  |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by bpeschier):

 * status:  new => closed
 * resolution:   => duplicate


Comment:

 Closing as a duplicate of #6630, which has more discussion and a similar
 approach

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.94b628d72cec0ee3a58b814f4c6e507b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #17301: Defining fieldsets in a form class

2014-02-10 Thread Django
#17301: Defining fieldsets in a form class
-+-
 Reporter:  msiedlarek   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  form, forms, | Triage Stage:  Accepted
  fieldsets  |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by rm_):

 * cc: riccardo.magliocchetti@… (added)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.6def16a5c15efe072581c222fabd29e9%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #17301: Defining fieldsets in a form class

2012-02-16 Thread Django
#17301: Defining fieldsets in a form class
-+-
 Reporter:  msiedlarek   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Forms|  Version:  SVN
 Severity:  Normal   |   Resolution:
 Keywords:  form, forms, | Triage Stage:  Accepted
  fieldsets  |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by msiedlarek):

 I was actually aware of the second problem, but somehow no good solution
 came to my mind. What you say sounds good, thanks!

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #17301: Defining fieldsets in a form class

2012-02-15 Thread Django
#17301: Defining fieldsets in a form class
-+-
 Reporter:  msiedlarek   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Forms|  Version:  SVN
 Severity:  Normal   |   Resolution:
 Keywords:  form, forms, | Triage Stage:  Accepted
  fieldsets  |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by lrekucki):

 I found two odd things in your patch:

 One was partially already in Django:

 {{{
 try:
 parents = [b for b in bases if issubclass(b, ModelForm)]
 except NameError:
 # We are defining ModelForm itself.
 parents = None
 }}}

 Your patch changes {{{ModelForm}}} to {{{BaseModelForm}}} which makes the
 "{{{try: except:}}}" look silly, because it will never trigger. It's also
 now duplicated in {{{BaseFormMetaclass}}}.

 Second, is the doubled call to {{{BaseFormOptions.__init__}}}.

 I fixed the second by adding {{{make_options}}} method on the metaclass,
 which can be then overriden, and the first by using {{{isinstance(b,
 cls)}}} instead of {{{issubclass}}}. This has a small caveat, that it will
 consider any class using this metaclass as a parent of the form (not just
 subclasses of BaseForm/BaseModelForm), but I'm pretty sure that anyone
 doing this, really knows the implications.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #17301: Defining fieldsets in a form class

2012-02-15 Thread Django
#17301: Defining fieldsets in a form class
-+-
 Reporter:  msiedlarek   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Forms|  Version:  SVN
 Severity:  Normal   |   Resolution:
 Keywords:  form, forms, | Triage Stage:  Accepted
  fieldsets  |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by AndrewIngram):

 Could you make modelform_factory accept fieldsets as an optional
 parameter, much like fields and excludes? It likes like it would be a
 pretty small addition but it means the admin site could leverage the same
 functionality quite easily.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #17301: Defining fieldsets in a form class

2012-02-09 Thread Django
#17301: Defining fieldsets in a form class
-+-
 Reporter:  msiedlarek   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Forms|  Version:  SVN
 Severity:  Normal   |   Resolution:
 Keywords:  form, forms, | Triage Stage:  Accepted
  fieldsets  |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by msiedlarek):

 * needs_docs:  0 => 1
 * needs_better_patch:  1 => 0


Comment:

 Given some thought on Carl Meyer's voice in fieldsets discussion
 (https://groups.google.com/forum/?_escaped_fragment_=msg/django-
 developers/dCQAmD1BBzY/tMesCJk96qEJ#!msg/django-
 developers/dCQAmD1BBzY/tMesCJk96qEJ) I've decided not to implement any
 presentation-layer features into basic form fieldsets and leave it as a
 feature for logical organization of fields. Note, that fieldsets'
 `classes`, or using tags other than `` can easily be achieved
 using templates and I believe that's where those features belong.

 Patch can be considered checkin-ready now (including tests). There's only
 one problem - documentation desperately needs touch of some better English
 speaker than myself.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #17301: Defining fieldsets in a form class

2011-11-28 Thread Django
#17301: Defining fieldsets in a form class
-+-
 Reporter:  msiedlarek   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Forms|  Version:  SVN
 Severity:  Normal   |   Resolution:
 Keywords:  form, forms, | Triage Stage:  Accepted
  fieldsets  |  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  1
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by anonymous):

 * needs_better_patch:  0 => 1


Comment:

 This is actually a great idea! It's possible in current state of the patch
 by subclassing both Form and Fieldset, but it probably can be made easier
 for developer. I'll certainly think about it.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #17301: Defining fieldsets in a form class

2011-11-28 Thread Django
#17301: Defining fieldsets in a form class
-+-
 Reporter:  msiedlarek   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Forms|  Version:  SVN
 Severity:  Normal   |   Resolution:
 Keywords:  form, forms, | Triage Stage:  Accepted
  fieldsets  |  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by akaariai):

 * stage:  Unreviewed => Accepted


Comment:

 Just a quick question: Would it be possible to design this in a way where
 you have something more generic which Fieldset bases upon? I just ask this
 because it might be nice to have `TabGroups` for tabular forms (where each
 tab could perhaps have fieldsets...). A possible idea would be that forms
 can have `FieldGroups`, which can have fields or more `FieldGroups`.
 Fieldset would be a special case of a `FieldGroup`.

 I don't know if implementing the feature in more generic terms is easy or
 not. If it would make this overly complicated, feel free to ignore this
 comment.

 I am marking this accepted based on [http://groups.google.com/group
 /django-developers/browse_thread/thread/742400983d410736 this] django-
 developers thread.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #17301: Defining fieldsets in a form class

2011-11-27 Thread Django
#17301: Defining fieldsets in a form class
-+-
 Reporter:  msiedlarek   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Forms|  Version:  SVN
 Severity:  Normal   |   Resolution:
 Keywords:  form, forms, | Triage Stage:
  fieldsets  |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by msiedlarek):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 '''TODO'''

 There's one more feature I'd like to add - ``classes`` fieldset option,
 similar to this in ``ModelAdmin``.
 But I pre-wrote enough already - give me some +1s for encouragement. :)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



[Django] #17301: Defining fieldsets in a form class

2011-11-26 Thread Django
#17301: Defining fieldsets in a form class
-+
 Reporter:  msiedlarek   |  Owner:  nobody
 Type:  New feature  | Status:  new
Component:  Forms|Version:  SVN
 Severity:  Normal   |   Keywords:  form, forms, fieldsets
 Triage Stage:  Unreviewed   |  Has patch:  1
Easy pickings:  0|  UI/UX:  0
-+
 '''Motivation'''

 For a large form grouping of fields is not just the pretty-rendering and
 template-related issue and I believe there should be way to logically
 group fields a form class definition. It would also be convenient to have
 Django automatically render those group of fields, just as easy as it is
 now to do `{{ form.as_p }}`.

 '''Idea'''

 The idea is to use existing and well-known conventions. Example:

 {{{#!python
 class PersonForm(forms.Form):
 home_phone = CharField()
 cell_phone = CharField()
 first_name = CharField()
 last_name = CharField()

 class Meta:
 fieldsets = (
 (None, {
 'fields': ('first_name', 'last_name'),
 }),
 ("Phone numbers", {
 'fields': ('cell_phone', 'home_phone'),
 }),
 )
 }}}

 Note usage of conventions already known to many users -- `Meta` class for
 options (used in models and `ModelForm` already) and `fieldsets` tuple,
 just like one in `ModelAdmin` options.

 The idea is also not to break anything already working meaning being
 backward compatible. Forms without fieldsets explicitly defined by user
 should render normally.

 Having a form defined as above user can easily use it in a template.
 Example:

 {{{
 
 {{ form.as_table }}
 
 
 }}}

 Renders to:

 {{{
 
 
 
 
 First name:
 
 
 
 Last name:
 
 
 
 
 
 Phone numbers
 
 
 Cell phone:
 
 
 
 Home phone:
 
 
 
 
 
 
 }}}

 Which I believe is a good default behavior. Other examples:

 {{{
 
 {% for fieldset in form.fieldsets %}
 
 {{ fieldset.legend_tag }}
 
 {{ fieldset.as_table }}
 
 
 {% endfor %}
 
 
 }}}

 {{{
 
 {% for fieldset in form.fieldsets %}
 
 {{ fieldset.legend_tag }}
 
 {% for field in fieldset %}
 
 {{ field.label_tag }}
 {{ field }}
 
 {% endfor %}
 
 
 {% endfor %}
 
 
 }}}

 {{{
 
 {% for fieldset in form.fieldsets %}
 
 {{ fieldset.legend_tag }}
 
 {% for field in fieldset.visible_fields %}
 
 {{ field.label_tag }}
 {{ field }}
 
 {% endfor %}
 
 {% for field in fieldset.hidden_fields %}
 {{ field }}
 {% endfor %}
 
 
 
 {% endfor %}
 
 
 }}}

 '''Implementation'''

 Yeah, there's a patch. Short description of implementation for those
 afraid of reading the diff:

 1. Creating `BaseFormOptions` class, similar to this already present in
 `ModelForm` class (for defining model for form). `ModelFormOptions` now
 subclasses it. `BaseFormMetaclass` now handles options-related stuff.
 (note that this behavior may be used in future for other form options)
 2. Separating all rendering from `Form` class to a new one - `Fieldset`.
 Form not having any fieldsets defined uses the single, dummy fieldset for
 all its fields.
 3. No editing any of already existing tests. Everything should be backward
 compatible.
 4. Providing some tests for new behavior - form options and fieldsets.
 5. Providing some documentation. Unfortunately my English skills are, as
 you see, not that impressive, so it definitely need some touch. Now it's
 more like set of examples.

 '''Patch'''

 Patch is attached.  You can read it on Trac here or on my Django github
 fork: https://github.com/mikoskay/django/compare/master...form-fieldsets

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/g