Vous n'êtes pas identifié(e).
Bonjour,
j'ai crée un model mais quand je lance la commande python manage.py syncdb j'ai cette erreur:
Name error :name 'model' is not defined.
voici mon code:
class Enseignent(models.Model):
name = models.CharField(max_length=42)
firstname = models.CharField(max_length=42)
speciality= models.charfied(max_length=30)
sex = models.CharField(max_length=42)
login = models.CharField(max_length=100)
password = models.CharField(max_length=42)
country = models.CharField(max_length=42)
town = models.charfied(max_length=30)
def __unicode__(self):
return self.name
s'il vous plait c'est urgent pour moi.
merci
Hors ligne
Bonsoir,
Un pile d'exécution serait plus parlante. Il faut croire que quelquepart dans le models.py il y a un model au lieu de models.
En outre, le champs town fait appel à un charfield au lieu d'un CharField
Cordialement,
Xavier Ordoquy.
Le 27 sept. 2012 à 18:07, carlos <car00x _AT_ hotmail.com> a écrit :
> Bonjour,
> j'ai crée un model mais quand je lance la commande python manage.py
> syncdb j'ai cette erreur:
>
> Name error :name 'model' is not defined.
> voici mon code:
>
>
>
> class Enseignent(models.Model):
> name = models.CharField(max_length=42)
> firstname = models.CharField(max_length=42)
> speciality= models.charfied(max_length=30)
> sex = models.CharField(max_length=42)
> login = models.CharField(max_length=100)
> password = models.CharField(max_length=42)
> country = models.CharField(max_length=42)
> town = models.charfied(max_length=30)
>
> def __unicode__(self):
> return self.name
>
>
>
> s'il vous plait c'est urgent pour moi.
> merci
> _______________________________________________
> django mailing list
> django _AT_ lists.afpy.org
> http://lists.afpy.org/mailman/listinfo/django
Hors ligne
ok je fais les correction mais l'erreur persiste toujours
Hors ligne
l'erreur cè plutôt:
name error: name 'models' in not defined
merci
Hors ligne
Bonsoir,
Tu as bien importé models ?
from django.db import models
Cordialement,
Xavier,
Linovia.
Le 27 sept. 2012 à 20:06, carlos <car00x _AT_ hotmail.com> a écrit :
> l'erreur cè plutôt:
> name error: name 'models' in not defined
> merci
> _______________________________________________
> django mailing list
> django _AT_ lists.afpy.org
> http://lists.afpy.org/mailman/listinfo/django
Hors ligne
dans le fichier views.py?
Hors ligne
excuse moi j'avais pas importé ça dans le fichier model.py
now ça marche, merci bcp
Hors ligne