Excellent, thanks
This method i use from django 1.4, never have problem.
2016-07-29 11:36 GMT-05:00 ludovic coues <couesl@gmail.com>:
In /home/ariatel_web/dashboard.ariatel.com.co/apps/did/forms.py, replacing
country = forms.ChoiceField(choices=[ (d.country_name,
d.country_name) for d in DidCountry.objects.filter(is_active=True) ]
with
country = forms.ChoiceField(choices=lambda: [ (d.country_name,
d.country_name) for d in DidCountry.objects.filter(is_active=True) ]
should do the trick. It will make the choices arguments a callable
which will be evaluated when the form is used for the first time, not
when the module is imported.
> You received this message because you are subscribed to the Google Groups
2016-07-29 17:01 GMT+02:00 Jorge Cadena <jorge.cadena@gmail.com>:
>
> Traceback (most recent call last):
> File "manage.py", line 10, in <module>
> execute_from_command_line(sys.argv)
> File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
> line 353, in execute_from_command_line
> utility.execute()
> File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
> line 345, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
> File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
> line 348, in run_from_argv
> self.execute(*args, **cmd_options)
> File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
> line 398, in execute
> self.check()
> File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
> line 426, in check
> include_deployment_checks=include_deployment_checks,
> File
> "/usr/local/lib/python2.7/dist-packages/django/core/checks/registry.py",
> line 75, in run_checks
> new_errors = check(app_configs=app_configs)
> File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py",
> line 13, in check_url_config
> return check_resolver(resolver)
> File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py",
> line 23, in check_resolver
> for pattern in resolver.url_patterns:
> File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py",
> line 33, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py",
> line 417, in url_patterns
> patterns = getattr(self.urlconf_module, "urlpatterns",
> self.urlconf_module)
> File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py",
> line 33, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py",
> line 410, in urlconf_module
> return import_module(self.urlconf_name)
> File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
> __import__(name)
> File
> "/home/ariatel_web/dashboard.ariatel.com.co/dashaboar_ariatel/urls.py", line
> 20, in <module>
> from apps.did.views import CountryViewSet, AreasViewSet
> File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/views.py", line
> 15, in <module>
> from .forms import BuySearchForm
> File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/forms.py", line
> 11, in <module>
> class BuySearchForm(forms.Form):
> File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/forms.py", line
> 12, in BuySearchForm
> country = forms.ChoiceField(choices=[ (d.country_name, d.country_name)
> for d in DidCountry.objects.filter(is_active=True) ], required=False)
> File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py",
> line 258, in __iter__
> self._fetch_all()
> File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py",
> line 1074, in _fetch_all
> self._result_cache = list(self.iterator())
> File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py",
> line 52, in __iter__
> results = compiler.execute_sql()
> File
> "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py",
> line 848, in execute_sql
> cursor.execute(sql, params)
> File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py",
> line 79, in execute
> return super(CursorDebugWrapper, self).execute(sql, params)
> File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py",
> line 64, in execute
> return self.cursor.execute(sql, params)
> File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 95,
> in __exit__
> six.reraise(dj_exc_type, dj_exc_value, traceback)
> File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py",
> line 64, in execute
> return self.cursor.execute(sql, params)
> File
> "/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py",
> line 323, in execute
> return Database.Cursor.execute(self, query, params)
> django.db.utils.OperationalError: no such table: did_didcountry
>
>
> El viernes, 29 de julio de 2016, 9:44:05 (UTC-5), Jorge Cadena escribió:
>>
>> same error, in mariaDB, postgresql, rigth now in sqlite3
>>
>>
>> El viernes, 29 de julio de 2016, 9:07:33 (UTC-5), Jorge Cadena escribió:
>>>
>>> Hi,
>>>
>>> I am dev in django at last 4 years, i missed ./manage.py syncdb,
>>>
>>> Delete all tables from databases (MariaDB, PostgreSQL) command line from
>>> DB, and run python manage.py migrate always same error
>>>
>>> python manage.py migrate
>>> django.db.utils.ProgrammingError: (1146, "Table
>>> 'dashaboard_web.did_didcountry' doesn't exist")
>>>
>>> python manage.py migrate did
>>> django.db.utils.ProgrammingError: (1146, "Table
>>> 'dashaboard_web.did_didcountry' doesn't exist")
>>>
>>> python manage.py makemigrations
>>> django.db.utils.ProgrammingError: (1146, "Table
>>> 'dashaboard_web.did_didcountry' doesn't exist")
>>>
>>> python manage.py sqlmigrate did 0001
>>> django.db.utils.ProgrammingError: (1146, "Table
>>> 'dashaboard_web.did_didcountry' doesn't exist")
>>>
>>> python manage.py migrate --run-syncdb
>>> django.db.utils.ProgrammingError: (1146, "Table
>>> 'dashaboard_web.did_didcountry' doesn't exist")
>>>
>>>
>>> if the tables doesn't exist, why create table new ???
>>> as, create new tables run command python manage.py migrate ??
>>>
> --
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscribe@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/36188b9a-c477-4b9e-aa75-1c7f915e3cac%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
--
Cordialement, Coues Ludovic
+336 148 743 42
--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/qqvMiE35EGg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEuG%2BTY4Wo_L3dd4D%2BGokUyyBeB8_ys2jK49V0iqnVLQYByV0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
Un hombre de carácter podrá ser derrotado pero jamás destruido.
ERNEST HEMINGWAY.
ERNEST HEMINGWAY.
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAC1QQjjqrUQSmg7cn9gRs1V8nyd4vac4p65ny7rDeSP_s%3DyGVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment