Questions tagged [django-countries]

django-countries is a pluggable Django app which provides country choices for use with forms, and a country field for models

django-countries is a pluggable Django app which provides country choices for use with forms, and a country field for models.

43 questions
0
votes
0 answers

Change flag icon position django-countries dropdown

I am using the django-countries module to create a country selector in Django, but the flag appears underneath the selection field instead of in it. Flag icon appears underneath selection field This is the code of forms.py: class…
0
votes
1 answer

Django Countries - unable to pre-select the right country in an edit form

Consider this model: class Address(models.Model): line1 = models.CharField(max_length=255, db_index=True, blank=True, null=True) city = models.CharField(max_length=255, db_index=True, blank=True, null=True) state =…
DeA
  • 1,748
  • 3
  • 22
  • 41
0
votes
1 answer

how to use country name as default instead of code in django-countries package

I am using an a django package called django-countries which gives me access to some countries attributes in the world such as country name, country code, country flag and some other more. It seems the default appears to be the country code, i will…
0
votes
1 answer

Django fails upon server startup trying to import module ("doesn't look like a module path")

Seems I'm following the instructions, but somehow Django doesn't see django_countries as an app. Error: System check identified no issues (0 silenced). February 18, 2021 - 23:56:01 Django version 3.1.4, using settings…
logicOnAbstractions
  • 2,178
  • 4
  • 25
  • 37
0
votes
1 answer

LookupError: No installed app with label "admin"

So I'm trying to run my development server using the command "python manage.py runserver" But whenever I try to run it, it gives me this error; Watching for file changes with StatReloader Exception in thread Thread-1: Traceback (most recent call…
Nimetu
  • 39
  • 1
  • 7
0
votes
1 answer

How to use the verbose name of a language choice in Django-Countries with Django Filter

I have this Django Filter: from django_countries.data import COUNTRIES owner__nationality = filters.MultipleChoiceFilter(choices=COUNTRIES, widget=Select2MultipleWidget) So I guessed I just use the original choices field to filter on nationality…
Raf Rasenberg
  • 534
  • 2
  • 14
  • 27
0
votes
4 answers

How to translate a country list in a django views.py?

I am using django and the standard internationalization package as showed in the : excellent marina mele tuto. In a user's form on web and mobile i have to show a list of country names in the user's language. To create the country list, i intend to…
alvaro562003
  • 678
  • 1
  • 6
  • 27
0
votes
1 answer

Select2 + Django: set preferred list items

I use select2]1 with django-countries in order to give the user a dropdown of possible countries. I now would like to either (1) split the dropdown or (2) rearrange the order of the items/countries, i.e.: Currently I get an alphabetically ordered…
Shezan Kazi
  • 4,471
  • 3
  • 14
  • 27
0
votes
1 answer

How to integrate django countries in to an existing model

I have an existing countries class in a database in production but would like to use the Django_Countries model to update all the countries I use. Here is the existing model. It allows users create a country and upload a flag of their country class…
sir_t
  • 133
  • 1
  • 3
  • 12
0
votes
3 answers

django_countries does not display in the form on template

I used {{ form }} as seen here template.html

Change your details


{% csrf_token %} {{ form }}
Aithusa
  • 169
  • 1
  • 14
0
votes
2 answers

Python/Django get country flag from IP

I am using django-countries to get a flag from the CountryField and it works. However, some users don't have a country set on their profiles, but I still have to display a flag. My idea was to get a country from IP and then get a flag from the…
dnmh
  • 2,045
  • 2
  • 34
  • 49
0
votes
1 answer

How to filter from a list of countries in django-countries

In my project, i am using CountryField of django countries inside one of my models. Also, all the countries are displaying in the particular field named 'country'. But what i want is that i have to filter some countries from the list of total…
Vijesh Venugopal
  • 1,621
  • 15
  • 26
0
votes
1 answer

How to set initial value from a model's custom field in a ModelForm in Django

I want the PestReport country to be automatically set in the ModelForm but keep getting the following error using the code below: TypeError at /countries/italy/pestreports/create/ pest_report_create() got an unexpected keyword argument 'country' I…
sgriffee
  • 381
  • 5
  • 18
1 2
3