python


Django Migrate Fails due to Type Conflict


Here is my Chapter model code:
class Chapter(models.Model):
name = models.CharField(max_length=180)
is_canon = models.BooleanField(default=True)
series_id = models.ForeignKey('Series', on_delete=models.CASCADE,
blank=True, null=True)
def __str__(self):
return self.name
When running python3 manage.py makemigrations, I provided a one off value of 'NULL' for the new field series_id in order to populate existing rows, when I should have backed out and added blank=True, null=True to the definition, as it is now in the code provided above. So, now, I want to run python3 manage.py migrate, but of course the migration fails because I've got a bunch of 'NULL' strings in places where django is expecting actual NULL values/integer values.
How to I get rid of those 'NULL' values and reset things so I can migrate?
Thank you for your time.
Adding to Pythonista comment. You could roll back to the previous migration. Delete the migration file and create it once again. That is the cleanest way in my opinion.

Related Links

Using converters in Pandas read_hdf similar to read_csv
python3 package path of local file
Viewing other user profile
Python Tkinter, Stop a threading function
Python runtime warning when move unit test to a package
UserWarning on Django website for Raven client
Organise .rst files for sphinx?
Scatter Plot of a Specific Column in Python using matplotlib
How to make difference between email html body and html attachment in python?
Cobb-Douglas maximization in python
Django won't serve some static files
Flask return SUM into Jinja2 list
i tried this sql request on python but is not working
Passing command line arguments in python by pytest
Not using grid anywhere in class still gives error 'cannot use geometry manager pack inside . which already has slaves managed by grid' in tkinter
Minimax Alogrithm for TicTacToe [python]

Categories

HOME
sql-server-2008
raspbian
google-contacts
wxwidgets
webdav
schemacrawler
sudo
uiactivityviewcontroller
outlook-web-addins
xul
abcpdf
informatica-powercenter
nuxt.js
equalizer
symfony2-easyadmin
bar-chart
yeoman-generator
linq-to-sql
koa
azure-servicebus-queues
compare-and-swap
web-frontend
fetch-api
superagent
pygooglechart
ioc-container
spring-insight
google-drive-realtime-api
pycparser
npm-publish
floating-accuracy
ical-dotnet
distributed-transactions
mcrypt
pycurl
uicollectionviewlayout
sql-import-wizard
audioqueue
zurb-foundation-apps
foxit
aerogear
java.util.calendar
application-loader
risk-analysis
rx-groovy
adodb
cpu-speed
node-inspector
colt
lumx
reserved-words
resource-files
hamsterdb
facebook-sdk-3.1
dig
awesomeprint
angularjs-timeout
phpsh
qsqltablemodel
radchart
redirectstandardoutput
concurrent-programming
point-sprites
ubuntu-11.04
tcxgrid
coff
goliath
junit3
server-error
sendfile
symbol-server
rijndael
external-assemblies
scala-2.8
swfloader
handheld
writing

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App