<https://lh3.googleusercontent.com/-AgxjGxsI_E4/Vbi08T65vrI/AAAAAAAAANM/IbA-Okg71iI/s1600/Erreur_modeles_geoloc.PNG>
Hello again
I have created a django app with some models and quickly resgistered an
admin class. I made migrations and migrated whitout any trouble, but then
when I ran the server and went on the web page, I got that :
It is allthemore weird since I didn't add my django app to the
installed_app settings.
I have found something close on the web, but nothing exactly like this with
the "zip_import" FROM "pages_page" problem... In what I found, it was
talked about a problem with the database, but since my migrations went
well, I don't see what could cause this...
My database is PostGreSQL, if it helps to know
My app's name is geoloc, and I am now showing you my models so that you
could understand the error better :
# coding: utf-8
from django.db import models
from mezzanine.pages.models import Page
from django.core.exceptions import ValidationError
from django.core.validators import RegexValidator
from geopy.geocoders import GoogleV3 as GoogleMaps
from geopy.geocoders.googlev3 import GeocoderQueryError
from django.contrib.sites.models import Site
from datetime import timedelta, datetime as dt
from mezzanine.utils.sites import current_site_id
from mezzanine.conf import settings
def _get_current_domain():
return Site.objects.get(id=current_site_id()).domain
class Adresse(models.Model):
indication_emplacement = models.CharField(max_length=256)
adresse_localisable = models.CharField(max_length=128, blank=True)
lat = models.DecimalField(max_digits=10, decimal_places=7, blank=True,
null=True, verbose_name="Latitude")
lon = models.DecimalField(max_digits=10, decimal_places=7, blank=True,
null=True, verbose_name="Longitude")
def clean(self):
super(Adresse, self).clean()
if self.lat and not self.lon:
raise ValidationError("Longitude required if specifying
latitude.")
if self.lon and not self.lat:
raise ValidationError("Latitude required if specifying
longitude.")
if not (self.lat and self.lon) and not self.adresse_localisable:
self.adresse_localisable = self.indication_emplacement.replace(
"\n",", ")
def __unicode__(self):
return self.indication_emplacement
class Fiche_service(models.Model):
name = models.CharField(max_length=64, verbose_name="Nom", blank=True)
phone_verif = RegexValidator(regex=r'^\+?1?\d{9,15}$',
message="Le numéro de téléphone doit être entré dans le format:
'+999999999', jusqu'à 15 chiffres autorisés.")
phone = models.CharField(max_length=16, validators=[phone_verif], blank=
True, verbose_name="N° de téléphone",
help_text="Le numéro de téléphone doit être entré dans le
format: '+999999999', jusqu'à 15 chiffres autorisés.") # validators should
be a list
adresse = models.OneToOneField(Adresse, primary_key=True)
def clean(self):
from django.core.exceptions import ValidationError
if self.name == '':
raise ValidationError('Please enter a name for the service')
def __unicode__(self):
return self.name
class Geoloc_map(Page):
services = models.ManyToManyField(Fiche_service)
def __unicode__(self):
return super(Geoloc_map, self).title
class Meta:
verbose_name = "TEST_NEW_META_NAME"
And the content of my admin.py file :
from django.contrib import admin
from mezzanine.pages.admin import PageAdmin
from .models import Geoloc_map
admin.site.register(Geoloc_map, PageAdmin)
--
You received this message because you are subscribed to the Google Groups
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.