How to merge two lists into one form?

2013-07-21 Thread Tymoteusz Jankowski
I have 2 things:
- list of fruits (eg.: apples, lemons, strawberries)
- list of answers (eg.: 'selling', 'making', 'both')

How can i merge these lists into django form which products something like 
the html here .

The desired form would allow user to pick an ONE answer ('selling', 
'making', 'both') for each fruit (apples, lemons, starberries)

-- 
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.




Re: How to merge two lists into one form?

2013-07-22 Thread Tymoteusz Jankowski
Ok, I've found sort of solution, relatively quick so, I'm happy

CODE:

FRUITS = [
'apples', 'lemons', 'strawberries',
] # hardcoded like here or from db

ANSWERS = [
(0, u''),
(1, u'selling'),
(2, u'making'),
(3, u'both'),
] # hardcoded like here or from db

class ProblematicForm(forms.Form):
regular_field = forms.CharField()

def __init__(self, *args, **kwargs):
super(ProblematicForm, self).__init__(*args, **kwargs)
for name in FRUITS:
 # Here we add our problematic fields
 self.fields[name] = forms.ChoiceField(choices=ANSWERS)


This won't give fieldset (like in linked example), but it wouldn't have.


On Sunday, July 21, 2013 6:56:25 PM UTC+2, Tymoteusz Jankowski wrote:
>
> I have 2 things:
> - list of fruits (eg.: apples, lemons, strawberries)
> - list of answers (eg.: 'selling', 'making', 'both')
>
> How can i merge these lists into django form which products something like 
> the html here <http://jsfiddle.net/2DVvG/>.
>
> The desired form would allow user to pick an ONE answer ('selling', 
> 'making', 'both') for each fruit (apples, lemons, starberries)
>

-- 
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.




Re: Is there a plan to modernize Django-admin?

2015-07-18 Thread Tymoteusz Jankowski
Thanks for clarification, I'll check both: django-admin2 and django-xadmin.


On Sat, Jul 18, 2015 at 2:04 AM Russell Keith-Magee 
wrote:

> On Sat, Jul 18, 2015 at 2:54 AM, xliiv 
> wrote:
>
>> Hi!
>> Like the topic, though I don't mean only frontend.
>> Backend could be also rewritten with for example class-based views and
>> other stuff used in regular Django apps?
>> Would it be a waste? I'm just curious what is your opinion. :)
>>
>
> Hi Tymoteusz,
>
> As a volunteer project, what gets added to Django is whatever gets
> contributed. We don't make plans and then execute on those plans. I'm not
> aware of anyone who is actively working on a major rewrite/refactor of
> Django's admin at the moment.
>
> The state of Django's Admin is a topic that has been discussed many times,
> over many years. I don't think you'd get any disagreement that there is
> room for improvement; but it's also a big project. There have been a number
> of third party projects that propose to replace Django's admin (most
> notably django-admin2, but it's by no means the only project with this
> goal).
>
> The key thing here is that a new admin could be entirely constructed as a
> third-party project. Django's existing admin doesn't do anything special -
> it's "just" a Django app, like any other. If you're particularly motivated,
> you could build your own Django admin using the tools that Django provides
> (and, as of 1.8, documents as official, stable API).
>
> For what it's worth, I've got my own crazy ideas about what a "new" Django
> admin would look like, which I've hinted at at various conferences (hunt
> down any of my conference talks about class based views). However, I'm not
> likely to get any time soon to look at this as a project - I've got plenty
> of other yaks that I'm shaving at the moment :-)
>
> Yours
> Russ Magee %-)
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/A9g1ZODCg44/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJxq849%2BATzYJXiB_cwZE6nw4-m52yfiFhJjTPjPFwOAHUChSg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJnKBfnjsoydWH_Pf8LJ8Ow%3D60ztTTZ4ayeLmK8YUZ20wr-e-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.