Skip to content

PostalCode unique key contais id + othee fields #213

@ihor-nahuliak

Description

@ihor-nahuliak

Postal code mode has strange unique keys:
https://github.com/coderholic/django-cities/blob/master/cities/models.py#L347

@python_2_unicode_compatible
class PostalCode(Place, SlugModel):
    # ...
    class Meta:
        unique_together = (
            ('country', 'region', 'subregion', 'city', 'district', 'name', 'id', 'code'),
            ('country', 'region_name', 'subregion_name', 'district_name', 'name', 'id', 'code'),
        )

Id field is already unique as primary key. What is the sense of these 2 unique keys above?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions