get_FOO_display() for generic/variable choice fields

2012-01-24 Thread katstevens
I have a model ContactDetail with two choice fields, ContactDetail.dialing_code and ContactDetail.country. These use the standard tuples ('AU', 'Australia') and so on. I know I can use get_country_display() and get_dialing_code_display() to show the longer values, but is there a more generic versi

Re: get_FOO_display() for generic/variable choice fields

2012-01-25 Thread katstevens
My Python-expert partner suggested a clever workaround as follows: As I'm already running through the model._meta.fields beforehand to create header row for my .csv file, I can build a dictionary of the choices to refer to later. choices_lookup_dict = {} header_row = [] for field in model._meta.

Internationalization - top level locale .mo files generated but not recognised in Django 1.5

2013-08-06 Thread katstevens
I am currently upgrading a project from Django 1.3 to 1.5 and having trouble getting Django to recognise my compiled .mo translations. My project is structured as follows: /toplevelfolder /myproject /app1 /app2 /app3 /templates /app1templates

Re: Internationalization - top level locale .mo files generated but not recognised in Django 1.5

2013-08-07 Thread katstevens
To follow up on this - when I moved my locale files to a completely new location and used a different path in my LOCALE_PATHS settings, the translations worked fine. I think it may have been a folder permissions issue. On Tuesday, August 6, 2013 5:02:03 PM UTC+1, katstevens wrote: > >

RegistrationForm subclass not showing up

2011-07-07 Thread katstevens
Hi - I'm new to Django and am using django-registration to set up new users. The basic RegistrationForm shows up fine in my template (which just uses {{ form.as_table }} to generate fields inside the form HTML), but I now want to use the RegistrationFormTermsOfService subclass instead. I set it a

Re: RegistrationForm subclass not showing up

2011-07-08 Thread katstevens
st, import that class from forms and > change your form_call from None to to RegistrationFormTermsofService. > > Hope this helps. > > > > > > > > On Thu, Jul 7, 2011 at 5:34 PM, katstevens wrote: > > Hi - I'm new to Django and am using django-registration t

Re: RegistrationForm subclass not showing up

2011-07-11 Thread katstevens
I think that's it! I'm using v0.7 and will upgrade now - thanks for the heads up. On Jul 8, 6:52 pm, CareerDhaba tech wrote: > I believe you are using an older version of django_registration, since there > is no reference to the backend in your code. The backend is an addition in > the latest (0.

Re: RegistrationForm subclass not showing up

2011-07-11 Thread katstevens
an't understand this behaviour at all. On Jul 11, 10:46 am, katstevens wrote: > I think that's it! I'm using v0.7 and will upgrade now - thanks for > the heads up. > > On Jul 8, 6:52 pm, CareerDhaba tech wrote: > > > > > > > > > I believe you a

Re: RegistrationForm subclass not showing up

2011-07-11 Thread katstevens
lives. Try something like > > def your_view(request): >     # ... >     # your current code >     # ... >     from registration import forms >     assert False, forms.__file__ > > Good luck! > > Cheers, > André > > > > > > > > On Mon, Jul 11, 2011