Normally programming error means that it is going to the wrong database.
If you have multiple databases set they must have the routers configured
correctly.
Advisable to write a separate database for the auth_user.


[image: --]

Maninder Kumar
[image: http://]about.me/maninder.s.kumar
<http://about.me/maninder.s.kumar?promo=email_sig>




On Fri, Jan 17, 2020 at 3:16 PM maninder singh Kumar <
maninder.s.ku...@gmail.com> wrote:

> The models don't contain a foreign key or do they ?
>
>
> [image: --]
>
> Maninder Kumar
> [image: http://]about.me/maninder.s.kumar
> <http://about.me/maninder.s.kumar?promo=email_sig>
>
>
>
>
> On Fri, Jan 17, 2020 at 2:04 PM FLAVIEN HERI <flavien.h...@gmail.com>
> wrote:
>
>> hey guys I have an issue
>>
>> help me to resove this problem,
>>
>> after deleting my files in migration folder keeping  __init__.py
>> but continue give me this bug
>>
>>
>> Environment:
>>
>>
>> Request Method: GET
>> Request URL: http://127.0.0.1:8000/admin/ZSalertprot/province/
>>
>> Django Version: 1.11.26
>> Python Version: 2.7.12
>> Installed Applications:
>> ['django.contrib.admin',
>>  'django.contrib.auth',
>>  'django.contrib.contenttypes',
>>  'django.contrib.sessions',
>>  'django.contrib.messages',
>>  'django.contrib.staticfiles',
>>  'django.contrib.gis',
>>  'ZSalertprot',
>>  'leaflet']
>> Installed Middleware:
>> ['django.middleware.security.SecurityMiddleware',
>>  'django.contrib.sessions.middleware.SessionMiddleware',
>>  'django.middleware.common.CommonMiddleware',
>>  'django.middleware.csrf.CsrfViewMiddleware',
>>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>>  'django.contrib.messages.middleware.MessageMiddleware',
>>  'django.middleware.clickjacking.XFrameOptionsMiddleware']
>>
>>
>>
>> Traceback:
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/core/handlers/exception.py"
>> in inner
>>   41.             response = get_response(request)
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/core/handlers/base.py"
>> in _get_response
>>   187.                 response =
>> self.process_exception_by_middleware(e, request)
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/core/handlers/base.py"
>> in _get_response
>>   185.                 response = wrapped_callback(request,
>> *callback_args, **callback_kwargs)
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/contrib/admin/options.py"
>> in wrapper
>>   552.                 return self.admin_site.admin_view(view)(*args,
>> **kwargs)
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/utils/decorators.py"
>> in _wrapped_view
>>   149.                     response = view_func(request, *args, **kwargs)
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/views/decorators/cache.py"
>> in _wrapped_view_func
>>   57.         response = view_func(request, *args, **kwargs)
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/contrib/admin/sites.py"
>> in inner
>>   224.             return view(request, *args, **kwargs)
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/utils/decorators.py"
>> in _wrapper
>>   67.             return bound_func(*args, **kwargs)
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/utils/decorators.py"
>> in _wrapped_view
>>   149.                     response = view_func(request, *args, **kwargs)
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/utils/decorators.py"
>> in bound_func
>>   63.                 return func.__get__(self, type(self))(*args2,
>> **kwargs2)
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/contrib/admin/options.py"
>> in changelist_view
>>   1564.                 self.list_max_show_all, self.list_editable, self,
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/contrib/admin/views/main.py"
>> in __init__
>>   79.         self.get_results(request)
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/contrib/admin/views/main.py"
>> in get_results
>>   177.         result_count = paginator.count
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/utils/functional.py"
>> in __get__
>>   35.         res = instance.__dict__[self.name] = self.func(instance)
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/core/paginator.py"
>> in count
>>   79.             return self.object_list.count()
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/db/models/query.py"
>> in count
>>   364.         return self.query.get_count(using=self.db)
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/db/models/sql/query.py"
>> in get_count
>>   499.         number = obj.get_aggregation(using, ['__count'])['__count']
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/db/models/sql/query.py"
>> in get_aggregation
>>   480.         result = compiler.execute_sql(SINGLE)
>>
>> File
>> "/home/flavien/MyProjects/analyseprotection/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py"
>> in execute_sql
>>   899.             raise original_exception
>>
>> Exception Type: ProgrammingError at /admin/ZSalertprot/province/
>> Exception Value: relation "ZSalertprot_province" does not exist
>> LINE 1: SELECT COUNT(*) AS "__count" FROM "ZSalertprot_province"
>>
>> my admin contain
>>
>> from django.contrib import admin
>> ### from .models import Alerts, ZS
>> from .models import Alerts, province
>> #from django.contrib.gis.db import OSMGeoAdmin
>> from leaflet.admin import LeafletGeoAdmin
>>
>> # Register your models here.
>>
>> class AlertsAdmin(LeafletGeoAdmin):
>>         #pass
>>         list_display =('name','location')
>>
>>
>> class provinceAdmin(LeafletGeoAdmin):
>>         #pass
>>         list_display =('name','geom')
>>
>>
>> admin.site.register(Alerts, AlertsAdmin)
>> admin.site.register(province, provinceAdmin)
>>
>> my model contain:
>> from __future__ import unicode_literals
>>
>> from django.db import models
>> from django.contrib.gis.db import models
>>
>>
>> # Create your models here.
>> class Alerts(models.Model):
>>         name = models.CharField(max_length=20)
>>         location = models.PointField(srid=4326)
>>    ## objects = models.GeoManager()
>>
>>
>>         def __unicode__(self):
>>                 return self.name
>>
>>         class Meta:
>>                 verbose_name_plural='Alerts'
>>  ### layer mapping dictionnary imported from python manage.py
>> ogrinspect ZSalertprot/data/ZS.shp ZS --srid=4326 --mapping --multi
>>
>> class province(models.Model):
>>     name = models.CharField(max_length=254)
>>     geom = models.MultiPolygonField(srid=4326)
>>
>>
>>     def __unicode__(self):
>>         return self.name
>>     class Meta:
>>                 verbose_name_plural='province'
>>
>> My layer loafin data contains:
>> import os
>> from django.contrib.gis.utils import LayerMapping
>> from .models import province
>>
>>  ### layermapping model imported from :python manage.py ogrinspect
>> ZSalertprot/data/ZS.shp ZS --srid=4326 --mapping --multi
>>
>>
>> province_mapping = {
>>     'name' : 'name',
>>     'geom' : 'MULTIPOLYGON25D',
>>
>> }
>>
>> ### on localise les la base de donnees de
>>
>> province_shp = os.path
>> .abspath(os.path.join(os.path.dirname(__file__),'data/province.shp'))
>>
>> def  run(verbose=True):
>>     lm = LayerMapping(province, province_shp, province_mapping,
>> transform = False,encoding='iso-8859-1')
>>
>>     lm.save(strict = True, verbose = verbose)
>>
>> tahnk you for your help
>>
>>
>>
>>
>> --
>> FLAVIEN HERI
>>
>> *Information management AscociateUNHCR-Kinshasa*
>> Tél:+243978587009
>> Skype: flavien.heri1
>> Facebook: flavien semi
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAG3GEnzn3xdogpB_hZV%3D_6Udnd7mZiGgN47Kk51z8pkuMnPSpA%40mail.gmail.com
>> .
>>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABOHK3QrxedeW628GOVgsw5yqEm0Sy3u%2Bj12OsBMSsDEkM5Ppw%40mail.gmail.com.

Reply via email to