fpdcc / document-search

Search and management interface for spatial documents at the Forest Preserves of Cook County.
2 stars 0 forks source link

Allow for license number to be any string #114

Closed xmedr closed 1 year ago

xmedr commented 1 year ago

Overview

This removes the validator from the license_number field to allow it to be a string of any characters.

Testing Instructions

xmedr commented 1 year ago

@smcalilly I didn't delete the code for the actual validator in validators.py because the docker command for making a new migration errored out when it tried to apply previous migrations and couldn't find validate_license_num. Keeping it in there for now gets past that error.

Is this okay or is there a way to have a previous migration ignore that requirement? I imagine I could delete the migration that's causing that and rebuild, but that would require bringing down the volumes on production, right?

smcalilly commented 1 year ago

@xmedr sometimes you'll need to edit old migrations that have a bug or completely delete part of it. Definitely something to be careful with.

In this situation, you should be able to delete that function from the migration file and then run the migrations without any issues. I think you'd just delete validators=[docsearch.validators.validate_license_num] from this line and it should work.

Django validators operate on the Python representation of the data rather than interacting with the database itself, so that change won't affect or disrupt the database.

xmedr commented 1 year ago

ah nice okay so editing the migration directly is also an option, good to know! i've got that change in then