Thursday, January 24, 2013

Re: how do I dynamically modify a choice field

On 24/01/2013 10:30pm, frocco wrote:
> Thanks Mike,
>
> Since I am new to django, how would I code this?
>
> In my for loop, my row.stock field has a value.
> Lets say row.stock is 20
> I want my choice field to show 1 to 20
>
> The next row.stock might have 12
> I want my choice field to show 1 to 12
>
> In other words, I do not want the user to select more stock than is
> available.

That would be easy enough (look up range in the Python docs) but I'm not
sure what you want to do is a good idea.

What happens if you present a range from 1 to 12 and while the user is
thinking about it someone else buys half a dozen?

Personally, I would be assuming orders will be un-satisfied and
re-design to cater for that gracefully. Perhaps you really need a
back-ordering system?

Mike


>
> Thanks again for your help.
>
>
> On Wednesday, January 23, 2013 10:36:46 AM UTC-5, frocco wrote:
>
> Hello,
>
> In my view, I am displaying rows of data that have a choice field in
> a form.
> one form for each row
>
> I want to change the choice this before printing.
>
> one row can have 1 to 5 choices
> another row can have 1 to 10 choices depending on values in each row.
>
> --
> 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/-/YTrTuwNU0zwJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@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-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate