Hi,

I'm trying to figure out how to solve the following issue without
succeed.

I have a model like this:

class Product(models.Model):
   ...
   measure_cm = models.FloatField(...)
   measure_in = models.FloatField(...)
  ...

The fields contain the same information (a relevant dimension of a
product) expressed in centimeter and in inches respectively.

I would able, in the view and in the template, to do something like
this:

...
this_product = Product.objects.get(pk=product_id)
this_product_measure = this_product.measure

and dynamically assigning to this_product_measure the value of
this_product.measure_cm or this_product.measure_in based on a variable
stored in the session, representing a user preference.

Actually I manage this with an "if request.session['user_preference']"
statement, but it would be nice to catch the right value on every view
without repeating the if statement.

How can I do this?

Thank you in advance



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to