I keep getting the message “NameError: name ‘Bootstrap4contentBootstrap4Blockquote’ is not defined” and i’m not sure why.
Here is the model:
class Bootstrap4ContentBootstrap4Blockquote(models.Model):
cmsplugin_ptr = models.ForeignKey('CmsCmsplugin', models.DO_NOTHING, primary_key=True)
quote_content = models.TextField()
quote_origin = models.TextField()
quote_alignment = models.CharField(max_length=255)
attributes = models.TextField()
class Meta:
managed = False
db_table = 'bootstrap4_content_bootstrap4blockquote'
I moved the cmscmsplugin before it both in my models.py and schema.py and still same message.
I ran python manage.py makemigrations, python manage.py migrate, python manage.py runserver and i still get the above error message.
What could be the issue?
Please provide the full traceback message you’re receiving.
Also, as a side note, you have in your model:
class Meta:
managed = False
db_table = 'bootstrap4_content_bootstrap4blockquote'
This means that that table already exists and is not to be managed by Django. Therefore, neither makemigrations
nor migrate
are going to do anything with that model.
1 Like
Something else I just noticed.
In your error message you quote:
“NameError: name ‘Bootstrap4contentBootstrap4Blockquote’ is not defined”
You show your model defined as:
class Bootstrap4ContentBootstrap4Blockquote(models.Model):
Notice that they’re not the same.
Wherever it is in the rest of your project (not here in the models.py file) that you’re making a reference to Bootstrap4contentBootstrap4Blockquote
is the mistake. It needs to match the name defined for the model: Bootstrap4ContentBootstrap4Blockquote
1 Like
thank you for responding, i fixed the camel casing and now the error has disappeared for that issue. Thank You.