обошел баг hvad для вывода стран

remotes/origin/stage6
Alexander Burdeiny 9 years ago
parent 5911c4e32c
commit 11cb733b40
  1. 8
      emencia/django/newsletter/forms.py

@ -169,7 +169,13 @@ class MailingSettingsForm(forms.ModelForm):
# foreign countries
self.initial['co'] = set(self.instance.f_countries.values_list('pk', flat=True))
self.fields['co'].c_queryset = self.instance.f_countries.distinct()
co_query = Country.objects.language().all().order_by('name')
where = " `{db_table}_translation`.`language_code` = '{lang}' "\
.format(
db_table=Country._meta.db_table,
lang=get_language())
co_query = co_query.extra(where=[where])
self.fields['co'].c_queryset = co_query
self.fields['co'].widget.choices = self.fields['co'].choices
# russia cities

Loading…
Cancel
Save