tags:

views:

27

answers:

1

Hello, I have problems with making my models to work. Here is my appname.misc.models file

from django.db import models

class user(models.Model):
    login=models.CharField(max_length=20)
    email=models.EmailField(max_length=50)
    banned=models.BooleanField()
    key=models.CharField(max_length=15)
    rights=models.CharField(max_length=10)
    password=models.CharField(max_length=50)
    question=models.CharField(max_length=200)
    answer=models.CharField(max_length=50)
    active=models.BooleanField()

Here in another app with sth like this

from django.db import models
from appname.misc import models as misc
class news(models.Model):
    title=models.SlugField()
    shortbody=models.CharField(max_length=250)
    fullBody=models.TextField()
    author=models.ForeignKey('misc.user')

And when I type manage.py sqlall news i got sth like this link text

I also tried to remove import statment and try do do this that way

author=models.ForeignKey('misc.user')

but still get error. Thx in advance for any help.

A: 

Can you try importing the user class directly? Something like:

from appname.misc.models import user 

class news(models.Model):
    title=models.SlugField()
    shortbody=models.CharField(max_length=250)
    fullBody=models.TextField()
    author=models.ForeignKey(user)

I also tried to do it according to your post and the error is the same – Artur 1 min ago

OK let us get something checked out first.

Is the app you are depending on i.e. appname part of the INSTALLED_APPS in your settings file?

If the answer to the question is "yes" then you can safely run syncdb and should see the tables get created. If you still get an error, please post the details.

Manoj Govindan
I have all of them installed and do syncdb and it created the tables without complaining . So in the future if similar errors will occurs(in sqlall) don't care of them? And this kind of errors won't mess the relationship between tables or affect tables in any negative way? Thx for help
Artur
Strictly speaking it is not at error but a warning. And it says as much. To answer your question, yes, you can ignore __similar__ warnings in the future. `syncdb` will work fine.
Manoj Govindan
Ok thanks for help and quick answers.
Artur
@Artur: If you feel my answer helped you solve the problem you can "accept" it by clicking on the tick mark icon next to it. Accepting answers is a Good Practice in Stack Overflow :)
Manoj Govindan
Done will remember ;)
Artur