Home > OS >  Problem in panel of Django3.0 after migrations
Problem in panel of Django3.0 after migrations

Time:06-24

Why is the error appearing in django/admin? Migrations ok, I need to have 3 items in the table where I will have results.

class Robot(models.Model):
    """Robot model, speed and position simulation"""
    product = models.IntegerField(choices=CHOOSE)
    velocity = models.FloatField()
    positionX = models.FloatField()
    positionY = models.FloatField()
    angleTHETA = models.FloatField()

    class Meta:`enter code here`
        verbose_name = "Robot"
        verbose_name_plural = "Robots"

    def __str__(self):
        resum = self.get_product_display()
        return resum

ProgrammingError at /admin/robot/robot/ column robot_robot.velocity does not exist LINE 1: ...LECT "robot_robot"."id", "robot_robot"."product", "robot_rob...

==== Hello, can someone help me with the above problem, I keep getting this error: django.db.utils.ProgrammingError: relation "robot_cleanrobot" does not exist LINE 1: SELECT COUNT(*) AS "__count" FROM "robot_cleanrobot"

  1. first migrations done
  2. then pip install -r requirements.txt
  3. python manage.py startapp
  4. settings
  5. makemigrations & migrate
  6. add model
  7. register a view

nothing helps me, I have done many times from scratch, even deleted the whole directory and also nothing,

I changed the model in the new project and nothing


At the beginning it worked ok for the first time, but when I added the float it all went down - I do not know what to do about it. Please help. Thx.

class CleanRobot(models.Model):
    """..."""
    name = models.CharField(max_length=100, null=True, blank=True)

    class Meta:
        verbose_name = "CleanRobot"
        verbose_name_plural = "CleanRobots"

    def __str__(self):
        return self.name

================================= Ok, not working: ok step by step what i am doing:

  1. i create a django project
  2. enable (venv)
  3. makemigrations
  4. migrate
  5. pip install -r requirements.txt
  6. copy to settinigs_local project
  7. python manage.py start app
  8. change settings - add code -> reference to local register application
  9. add code to models
  10. register models
  11. makemigrations
  12. migrate
  13. runserver
  14. dajngo/admin ... Add is ok, by name entering I get error... I have other projects on my computer and they work normally... I have other projects on my computer and they work normally... not today I have deleted the whole folder for the 20th time...

CodePudding user response:

You are getting the error because the database fields that you requested probably do not exist. Remember to run both enter image description here

and also you should have a new non-empty file in your app's migrations folder. Then run migrate command. You should see something like:

enter image description here

If something went wrong, post the message you did get.

CodePudding user response:

Works: I don't know which of these things worked but:

  1. i had alpha name and alpha project name so i changed to alphaapp,
  2. after migration 2 I created a new superuser

Maybe this will be useful for someone ;)

  • Related