Re: Urgent Help Needed On Python/Django ModelChoiceFields
Since it's urgent, I'll give an opinion despite not fully understanding your description of the problem. If it's going to be so far removed from what the admin app does by default, I'd go with a custom view outside of the admin, which you can customize to your heart's content. That is, when it's really hard to fit something in an existing box, you should probably build a different box. Bill On Wed, Apr 7, 2010 at 12:35 PM, pedjk wrote: > Ok, I'm quite new to Python and Django so this might actually have a > simple solution. > > I'm coding for a form using Django and I have a ModelChoiceField. Now > what I want to do is make the options for this field customizable. So > if you choose an option, a set of links would be generated allowing > you to move to the next step. > > All I know is that this should show up on the admin page for Django, > and it might require a state table or some sort of back coding from > mysql. > > If anyone could help, this is quite urgent. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@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 post to this group, send email to django-us...@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: Urgent Help Needed On Python/Django ModelChoiceFields
Thanks Bill. I'll clarify. Basically what I want to do is give each option under the choice field a function. So once the user has selected an option under the drop down box, that would initiate a script which would generate a set of links (buttons) at the bottom of the page to take the user to the next step. So if under the drop down menu you choose "Done", that would automatically generate two links. One that says "Stop" and one that says "Close". What the links do isn't important, it's how to get the chosen option to generate the links that I don't know how to do. Someone mentioned to me to use a state table. I'm not sure what that means, but maybe others do. Now the reason I bring up the admin page is because I also want it to be customizable from there. So as an example, if selecting "Done" generates a "Stop" and a "Close" button, I might want to change those button and or their links at a later time, and I would want to do it from the admin page. Hopefully that clarifies things more and thanks again -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Urgent Help Needed On Python/Django ModelChoiceFields
Well, where are things happening? Do you make a new request for each click, or do you want the changes to appear without a browser reload? If the former, the ability to customize seems to imply a model representing a choice, with a foreign key on the same model, allowing it to specify of which choice it is a sub choice, giving you a blah_set queryset. It can contain whatever additional info you need, obviously. Then the buttons can be submit buttons of the form with the select representing the choice, with various values, so you know which button, and the view will interpret the buttons in the context of the selected choice. That is, look up the choice which contains info about what to do for each button. If the latter, that's a bunch of javascript, and yes, you need to manage the connections somewhere, but you don't want to be doing many DB queries every time you load the page, so you probably want to cache the tree, probably in a class variable (in RAM) on startup and whenever the configuration is changed (via a custom form which you must be staff, or whatever to view and submit, not part of the admin app). Or I may still be completely misunderstanding your problem. Bill On Wed, Apr 7, 2010 at 2:54 PM, pedjk wrote: > Thanks Bill. I'll clarify. > > Basically what I want to do is give each option under the choice field > a function. So once the user has selected an option under the drop > down box, that would initiate a script which would generate a set of > links (buttons) at the bottom of the page to take the user to the next > step. > > So if under the drop down menu you choose "Done", that would > automatically generate two links. One that says "Stop" and one that > says "Close". What the links do isn't important, it's how to get the > chosen option to generate the links that I don't know how to do. > > Someone mentioned to me to use a state table. I'm not sure what that > means, but maybe others do. > > Now the reason I bring up the admin page is because I also want it to > be customizable from there. So as an example, if selecting "Done" > generates a "Stop" and a "Close" button, I might want to change those > button and or their links at a later time, and I would want to do it > from the admin page. > > Hopefully that clarifies things more and thanks again > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@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 post to this group, send email to django-us...@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.