Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model 'Academic Experience' required #5

Open
amikable-tech opened this issue Sep 23, 2023 · 3 comments · May be fixed by #34
Open

Model 'Academic Experience' required #5

amikable-tech opened this issue Sep 23, 2023 · 3 comments · May be fixed by #34
Assignees

Comments

@amikable-tech
Copy link
Collaborator

Requirements

  1. Educational background starting with the most recent down to the oldest.
  2. Year when degree was achieved should also be included.
  3. Text field with major activities done should also be included.
@amikable-tech amikable-tech self-assigned this Oct 2, 2023
@JoeyStk JoeyStk mentioned this issue Oct 4, 2023
@to-sta to-sta mentioned this issue Oct 4, 2023
@amikable-tech
Copy link
Collaborator Author

hi guys when i created the class AcademicExperience, i ran python3 manage.py makemigrations and i got this error

image

Please what do i do in this situation. or should have i run a different command instead

@JoeyStk & @to-sta

@to-sta
Copy link
Collaborator

to-sta commented Oct 5, 2023

@amikable-tech this prompt is raised because there is a database with data and migrations in the project. Like the message stats:

It is impossible to add a non-nullable field 'user' to personalinformation without specifying a default. This is because the database needs somthing to populate existing rows.

There are mulitple ways of dealing with this:

Setting the null keyword argument for the user field to True or default=None. But these are both just hotfixes. Since we have the db.sqllite3 and the __pycache__/ files in the gitignore, i will delete these files and make another commit. I will also add migrations to the .gitignore file for now @JoeyStk since we are not in production there is no need to keep migrations yet.

class PersonalInformation(models.Model):
    name = models.CharField(max_length=25, blank=False)
    user = models.ForeignKey(User, on_delete=models.CASCADE, null=True)
    ...
class PersonalInformation(models.Model):
    name = models.CharField(max_length=25, blank=False)
    user = models.ForeignKey(User, on_delete=models.CASCADE, default=None)
    ...

Then it should work well 😃. You should copy your changes and then pull the latest version.

@to-sta
Copy link
Collaborator

to-sta commented Oct 5, 2023

Now there is no db.sqllite3 inside the repo as well as migration files (0001_ intial.py,...) and __pycache__. You might have to delete your db.sqllite3 before you make migrations again.

@amikable-tech amikable-tech linked a pull request Oct 5, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants