Opened 8 years ago
Last modified 5 years ago
#26819 closed Bug
Using a ArrayField on Meta.unique_together throws "unhashable type: 'list'" on validate_unique method — at Initial Version
Reported by: | Gleber Diniz | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
It happens on a second save (when there is already data to be validated)
On this line: "if row_data in seen_data:", because row_data contains a list and seen_data is a set (row_data: (1, [1, 1]) / seen_data: set())
Example to reproduce:
models:
class Map(models.Model): name = models.CharField(_('name'), max_length=128) class MapSpot(models.Model): map = models.ForeignKey('body.Map', related_name='spots') position = ArrayField(models.IntegerField(), size=2) class Meta: unique_together = [('map', 'position')]
admin:
class MapSpotInline(admin.TabularInline): model = MapSpot extra = 0 @admin.register(Map) class MapAdmin(admin.ModelAdmin): inlines = [MapSpotInline]
Note:
See TracTickets
for help on using tickets.