HI Jorge,

What do you mean you want to search by country?

I think the easiest way would be to add a filter for the country field in
admin. The thing is with the countries plugin, you only save the 2-letter
version of the country (for example GB for Great Britain, ES for Spain, SE
for Sweden and so on): The other part of the field is only a display
preference, so you won't be able to search for the field (also the name is
localized, so if you are running on a spanish computer it will display
everything in spanish). I think the best way would be to use a filter on
the search page (like I said earlier).

Regards,

Andréas


2015-11-22 23:04 GMT+01:00 Jorge Fernandez-de-Cossio-Diaz <
[email protected]>:

> I have a Model containing a CountryField (using
> https://pypi.python.org/pypi/django-countries):
>
> class Person(models.Model):
>     name = models.CharField(max_length=100)
>     country = CountryField(
>         countries_flag_url='//flags.example.com/{code}.png 
> <http://flags.example.com/%7Bcode%7D.png>')
>
> I want to be able to search in admin interface by country. But it doesn't 
> work. What can I do?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3ba081c2-49ed-4e2c-b542-3bdb28a22f91%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/3ba081c2-49ed-4e2c-b542-3bdb28a22f91%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALXYUbmrFJLH3296yEsaGuG7rcbi63-yKEGoBDJAhYFVezMz3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to