Hello,

I have just started using Django - looks very promising!

I am trying to implement  something resembling a web-based shop. A
simplified overview of my situation is as follows:

models.py
---------------

class Country(models.Model)
     name     = CharField(max_length  = 100)
     currency = CharField(max_length  = 3)


class Product(models.Model)
      name   = CharField(max_length = 100)
      price     = FloatField()
      country = ForeignKey(Country , editable = False)


class Transaction(models.Model)
      country   = ForeignKey( Country , editable = False)
      product  = ForeignKey( Product )
      date        = DateField()

views.py
-----------

class NewTransaction(ModelForm):
       class Meta:
                model = Transaction

def newtransaction(request , country):
       return render_to_response(...)

.......
Now, an important aspect of this shop is that it operates in several
different countries, and the available product are different in
different countries. The database can typically contain four Product
objects:

     ["Norwegian_Product1" , "Norwegian_Product2" ,
"Swedish_Product1" , "Swedish_Product2"]

Based on the url the customer used I know which country she is in, and
whether I should present the Norwegian products or the Swedish
product. This id comes as the second argument to the view function,
but when rendering the NewTransaction form I do not understand how to
limit the rendereing ov available product to only those available in
the customers country?!


Any tips greatly appreciated.

Regards

Joakim Hove




--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to