Hi, thank you very much for your help! I have to distinguish between the single fields, so I used the later solution.
- chris On 11 Jun., 22:20, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > Hi, > > Do you need to do anything special with the fields of these addresses? > For example, locate users by their city and country? In other words, > do you need the various components of an address (street, locality, > postal code) to be captured as separate DB fields for your application > to work? > > If the answer is no, all you need (as Norman mentions) is a "textarea" > to capture the entire address and may be the country as a separate > field. The advantage is that your code doesn't need to know how each > country's address is rendered -- it's rendered the way each user wants > it rendered (basically just convert line breaks to br, etc.) > > If the answer is yes, you are essentially dealing with two issues: > > 1. capture various international addresses into one uniform DB model. > 2. ability to render each address as per the standard format for the > country of that address. > > For issue #1: You could use a format such as the ADR Microformat to > base your address model on. Seehttp://microformats.org/wiki/adr > > For issue #2: You would need some kind HTML markup and may be CSS that > goes with each country's address format as well as a default HTML + > CSS pair that renders for countries that you don't have explicit > renders for. You could keep such HTML and CSS in the form of Django > templates with the country code as part of the filename so you can > decide which template to use given a specific address instance's > country code. For example, the template fragments could be: > > TEMPLATE_ROOT_DIR/adr/us/address.html > TEMPLATE_ROOT_DIR/adr/ca/address.html > TEMPLATE_ROOT_DIR/adr/at/address.html > TEMPLATE_ROOT_DIR/adr/address.html <--- This would be the default fall > back format. > > Then, a templatetag could render an address instance. The usage would > be: > > {% render_address adr %} > > The templatetag implementation would take the adr instance, load the / > adr/XX/address.html template based on adr.country and render it. > > This page has a good list of various address formats grouped by > country:http://www.bitboost.com/ref/international-address-formats.html#Formats > > -Rajesh D --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---