mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #19299 -- Fixed Nullification of Foreign Keys To CharFields
Thanks tunixman for the report and Baptiste Mispelon and Shai Berger for reviews.
This commit is contained in:
@@ -72,12 +72,21 @@ class BooleanModel(models.Model):
|
||||
string = models.CharField(max_length=10, default='abc')
|
||||
|
||||
|
||||
class PrimaryKeyCharModel(models.Model):
|
||||
string = models.CharField(max_length=10, primary_key=True)
|
||||
|
||||
|
||||
class FksToBooleans(models.Model):
|
||||
"""Model wih FKs to models with {Null,}BooleanField's, #15040"""
|
||||
bf = models.ForeignKey(BooleanModel)
|
||||
nbf = models.ForeignKey(NullBooleanModel)
|
||||
|
||||
|
||||
class FkToChar(models.Model):
|
||||
"""Model with FK to a model with a CharField primary key, #19299"""
|
||||
out = models.ForeignKey(PrimaryKeyCharModel)
|
||||
|
||||
|
||||
class RenamedField(models.Model):
|
||||
modelname = models.IntegerField(name="fieldname", choices=((1, 'One'),))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user