no such table: userprofiles_userprofile_restaurant


Please briefly explain why you feel this question should be reported .

Report Cancel

I have a model of restaurant and userprofile. Restaurant has all the restaurant information and userprofile has information related to user like username, all the restaurants that he/she has, address, order he/she has, restaurant he/she has favorited, and is_owner.But i am getting an error

OperationalError at /admin/auth/user/2/change/ no such table:

I checked the list of tables created using python dbshell
and then .tables which shows only table of restaurant and

my is

class Restaurant(models.Model):
    owner = models.ForeignKey(User)
    name = models.CharField(max_length=150, db_index=True)
    slug = models.SlugField(max_length=150, db_index=True)
    address = models.CharField(max_length=100)
    city = models.CharField(max_length=100)
    lat = models.DecimalField(max_digits=9, decimal_places=6, default=0.0)
    lag = models.DecimalField(max_digits=9, decimal_places=6, default=0.0)
    phone_number = models.PositiveIntegerField()
    owner_email = models.EmailField()
    opening_status = models.IntegerField(choices=OPENING_STATUS, default=OPEN)
    website = models.URLField(max_length=300, blank=True, null=True)
    features = models.ManyToManyField(FeatureChoice, related_name='restaurants_features')
    twitter_handle = models.CharField(max_length=15, blank=True, null=True)
    other_details = models.TextField()
    is_favorite = models.BooleanField(default=False)

class UserProfile(models.Model):
    user = models.OneToOneField(User)
    restaurant = models.ManyToManyField(Restaurant, blank=True)
    address = models.CharField(max_length=150, blank=True, null=True)
    # order_history = models.ManyToManyField(Order)
    favorites = models.ManyToManyField(Restaurant, related_name='favorited_by')

why python makemigrations userprofiles and python migrate did not create a table userprofiles_userprofile_restaurant ?

0 Answer 40 views 0