platform-coop-toolkit / coop-map-directory-index

The Map/Directory/Index component of the Platform Cooperative Development Kit.
https://directory.platform.coop
BSD 3-Clause "New" or "Revised" License
1 stars 3 forks source link

Organization geographic scope, code availability can't be edited #64

Closed greatislander closed 4 years ago

greatislander commented 4 years ago

Describe the bug

When exploring the choices field as mentioned in https://github.com/platform-coop-toolkit/coop-map-directory-index/pull/59#issuecomment-633746714, I noticed that the geographic scope and code availability fields for organizations are not currently editable in the Django admin.

To Reproduce

Steps to reproduce the behavior:

  1. Edit an organization.
  2. Try to modify the geographic scope or code availability fields and save the organization.
  3. See error: Select a valid choice. 0 is not one of the available choices.

Expected behavior

Geographic scope and code availability can be edited.

Screenshots

Screen Shot 2020-05-26 at 1 07 54 PM

Additional Context

I believe the issue here is that the values the list of choices are integers (unquoted) but the models stipulate a CharField which expects strings. If there's existing data saved in this field this issue could be resolved by changing geo_scope and code_availability to use an IntegerField.

Alternative solutions include quoting the values to make them strings:

choices=[('0', 'Local'), ('1', 'Regional'), ('2', 'National'), ('3', 'International')],

Or changing the values to a more meaningful string:

choices=[('local', 'Local'), ('regional', 'Regional'), ('national', 'National'), ('international', 'International')],

I am happy to open a PR to implement the preferred solution.

erictheise commented 4 years ago

This is true, although a number of fields from Trebor's survey are still being migrated and this work should not be considered complete.

greatislander commented 4 years ago

Thanks, @erictheise. My understanding is that you are still working on importing/inputting 2020 Ecosystem survey data, and that process might impact the final state of these fields. Is that captured by https://github.com/platform-coop-toolkit/coop-map-directory-index/issues/17 and https://github.com/platform-coop-toolkit/coop-map-directory-index/issues/21? Is there any more detail on the progress of that work other than the commit log referencing those tickets? I'd love to get a clearer understanding.

I'm preparing to start work on refining/completing the organizational and individual profile pages (#6 and #7) as well as implementing filtering and searching (#36 and #51), so I want to get a sense of what data changes might still need to be made so I can help move that forward. Happy to have a call do discuss if that helps as well.