#Unable to makemigrations

42 messages · Page 1 of 1 (latest)

rotund hedge
#

Hello! I have these requirements satisfied:

asgiref==3.7.2
backports.zoneinfo==0.2.1
Django==5.0.0
psycopg==3.1.16
psycopg-binary==3.1.16
sqlparse==0.4.4
typing_extensions==4.9.0
tzdata==2023.3

And I also have a WebApp/models.py. I have added WebApp in settings.py, but after running makemigrations, I keep getting `No changes detected``

manic marsh
#

python manage.py showmigrations

rotund hedge
# manic marsh `python manage.py showmigrations`
admin
 [X] 0001_initial
 [X] 0002_logentry_remove_auto_add
 [X] 0003_logentry_add_action_flag_choices
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```
#
from django.db import models

class Users(models.Model):
    faculty_id = models.SmallIntegerField(verbose_name = "Faculty ID", primary_key = True)
    faculty_name = models.CharField(verbose_name = "Faculty Name", max_length = 50)
    superuser = models.BooleanField(verbose_name = "Check for superuser", default = False)

    def __str__(self) -> str:
        return self.faculty_id
#

models.py

manic marsh
#

So what is WebApp? It's not recognized as app with migrations

rotund hedge
#
INSTALLED_APPS = [
    'WebApp',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]
#

I have this

manic marsh
rotund hedge
#

I wrote it

#

It's supposed to create a table in PostgreSQL 15

manic marsh
rotund hedge
#

project name

manic marsh
#

Yes, and how it module come to be and of what it consists?

rotund hedge
#

That's how it was made

manic marsh
#

can show a tree of it?

#

should have worked unless you removed something

rotund hedge
manic marsh
#

it doesn't have migrations dir, it means it's excluded from migrations system

rotund hedge
#

How do I add it?

manic marsh
#

ah wait

#

right, you said it's project

#

project is not an app

#

you need python manage.py startapp

rotund hedge
manic marsh
#
  • name for app
rotund hedge
#

Ah right

#

I think I messed that up

#

Worked like a charm, thanks so much

manic marsh
rotund hedge
#

That's supposed to be a sort of login portal (haven't added a pwd field yet), that will basically direct the app to know if the logged in user is a superuser or not

manic marsh
#

Why would it? You didn't specify anything that says it's an authorization model it will be treated like any other one

#

And django will keep using built-in user model

rotund hedge
#

Right, I will look into it

#

Thanks

manic marsh
#

That's important, because fixing it later might be a pain. If you can't drop your db it definetely will be

rotund hedge
#

Cool, I will fix it rn and move on