I am new to Django, and for some odd reason my models are not creating a database table and am completely clueless as to why. When I run the command: "python manage.py makemigrations" I get the following shows up int he console output:
Migrations for 'auctions':
auctions/migrations/0001_initial.py
- Create model User
- Create model Item
Which appears to be accurate to me. So then I run the command: "python manage.py migrate" and the following shows up in the console output.
Operations to perform:
Apply all migrations: accounts, admin, auctions, auth, contenttypes, sessions
Running migrations:
No migrations to apply.
Looking into the database and sure enough nothing was created. Below is output of my models.py file:
from django.contrib.auth.models import AbstractUser
from django.db import models
class User(AbstractUser):
def __str__(self):
return f"{self.first_name}"
class Item(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name="item_list")
title = models.CharField(max_length=64)
description = models.CharField(max_length=256, blank=True)
img_url = models.CharField(max_length=256, blank=True)
starting_bid = models.DecimalField(decimal_places=2, max_digits=8)
category = models.CharField(max_length=24, default='No Category')
status = models.BooleanField(default=True)
def __str__(self):
return f"{self.title}, {self.description}"
This is the output of the command: "python manage.py showmigrations"
Glass-Bids nobility$ python manage.py showmigrations
access
(no migrations)
accounts
[X] 0001_initial
admin
[X] 0001_initial
[X] 0002_logentry_remove_auto_add
[X] 0003_logentry_add_action_flag_choices
auctions
[X] 0001_initial
auth
[X] 0001_initial
[X] 0002_alter_permission_name_max_length
[X] 0003_alter_user_email_max_length
[X] 0004_alter_user_username_opts
[X] 0005_alter_user_last_login_null
[X] 0006_require_contenttypes_0002
[X] 0007_alter_validators_add_error_messages
[X] 0008_alter_user_username_max_length
[X] 0009_alter_user_last_name_max_length
[X] 0010_alter_group_name_max_length
[X] 0011_update_proxy_permissions
[X] 0012_alter_user_first_name_max_length
contenttypes
[X] 0001_initial
[X] 0002_remove_content_type_name
sessions
[X] 0001_initial