I'm beginning (again) with django (1.7.5).
I've created :
I've done enough code to make my application work, I can open the admin pannel, navigate through pages... But when I try to create my database, Article model isn't detected by django (I've tried with syncdb, migrate and makemigrations) : Django just acts like the models simply doesn't exists! I don't really know where the problem comes from, and I don't know if it comes from something I forgot, or if it is related to the new features of django 1.7 (with all the migration stuff I don't really understand).
Here are my source files :
main/models.py :
from django.db import models
# Create your models here.
class Article(models.Model):
title = models.CharField(max_length = 100)
content = models.TextField(null = True)
date = models.DateTimeField(auto_now_add = True, auto_now = False,
verbose_name = "Date de parution")
slug = models.SlugField(max_length = 50)
def __unicode__(self):
return (u"%s" % (self.title,))
def __str__(self):
return ("%s" % (self.title,))
main/admin.py :
from django.contrib import admin
from main.models import Article
# Register your models here.
admin.site.register(Article)
admin.autodiscover() is enabled in hypnose.urls.py.
It could be something really stupid but I'm stuck here since this morning. Did I forget something? Thank you for your help!
Make sure that you added the main
app to INSTALLED_APPS
.