When I add new field without default value to my model
some_field = models.IntegerField()
and run makemigrations I get this message
`You are trying to add a non-nullable field 'some_field' to sometable without a default; we can't do that (the…
I have an existing app which has two models:
class A(models.Model):
#...
class B(models.Modele):
a = models.ForeignKey(A)
# ..
and I had django 1.6, now I upgraded to 1.7.1 and I did:
python manage.py makemigrations myapp
and it created…
I have a model in my app :
class PutAwayProductsPosition(models.Model):
products = models.ForeignKey(Product, on_delete=models.CASCADE)
put_position = models.CharField(max_length=50, default=0)
is_put =…
I am working with Django v4.* which I connected it to Postgres DB on the localhost,
I have created my model (Article) then makemigrations then migrate
then I have changed the model by adding extra field, as a result it didn't take effect so I have…
I am trying to add models, but whenever I run python manage.py makemigrations I get the following error
ModuleNotFoundError: No module named 'django.contrib.staticfilesaccounts'
accounts is an app in my project, the structure of the files is as…
I am writing a Django app that provides a very simple model called Submittable, which users of the app are supposed to inherit from when they want to use other functionalities of the app.
# app1
class Submittable(models.Model):
is_submitted =…
hello guys I'm doing a django tutorial and i missed a change the instructor did in models.py so i fix it but when trying to make the migration to the db it gives me a code that I don't understand or i don't know what to do, here is what it…
I'm trying to use multiple databases in my Django project i.e. MongoDB and MySQL.
# settings.py
DATABASES = {
'default': {
'NAME': 'sql_db',
'ENGINE': 'django.db.backends.mysql',
'USER': 'root',
'PASSWORD':…
I moved my project from my windows machine to Mac using GitHub
when I run python manage.py runserver
it worked fine showing my login page and since I didn't do any migration the app crashed,
so I executed python manage.py makemigrations I thought…
im just stuck with error while making migrations to my django project.
in my project which is already 50% dveloped i use owner model to represent owner of shop and then i used user model for login and for registration purpose.
so i tried to use user…
i develope a django project on my local system, and now i deployed that to a server.
i used MySql as database. whenever i try to migrate my models (using python manage.py migrate or python manage.py makemigrations) to server's new database, it shows…
I have a working project and I would like to add one new field to one of the models.
I have added the new field and ran the makemigrations command and then I got ValueError: too many values to unpack
This is the model:
class Line(models.Model): …