Question

I cannot modify or remove my Parameter model because it is somehow used by schemamigration command. Everything works fine with other models.

When I remove Parameter.name field and run schemamigration my_app --auto command I get:

FieldError: Unknown field(s) (name) specified for Parameter

When I remove the model and run schemamigration my_app --auto command I get:

ImportError: cannot import name Parameter

My models.py:

class Parameter(models.Model):
    algorithm = models.ForeignKey(Algorithm, related_name='parameters',
                                  null=True, blank=True, 
                                  verbose_name=_('Algorithm'))
    name = models.CharField(_('Option'), max_length=255, null=True)
    required = models.BooleanField(_('Required'), blank=True)
    default = models.CharField(_('Default'), max_length=255, 
                               null=True, blank=True)
    label = models.CharField(_('Label'), max_length=255, null=True, blank=True)
    description = models.TextField(_('Description'), null=True, blank=True)
    description_lt = models.TextField(_('Description LT'), null=True, blank=True)

How could I find out whats wrong? And how could I fix it?

Was it helpful?

Solution

From the error above it seems you are registering both your model and your fields with either an admin instance, or a form instance django will complain if you remove either of them, search your files or 3rd party modules if you use your model in any of them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top