vnoelifant / charity-finder

3 stars 0 forks source link

19 projects model #23

Closed vnoelifant closed 1 year ago

vnoelifant commented 1 year ago

Hello Bob. These changes include the model setup for Projects fields, as defined in the "Get All Projects Response Structure" section in https://www.globalgiving.org/api/methods/get-all-projects/. I did not import the bulk data yet that is created from my dump_data.py script. I will plan to do that tomorrow. Here are a few questions I have so far:

  1. Can you review my Field types/options from the Projects model and Regions model in models.py, based on the "Get All Projects Response Structure" and "Element Definitions for Get All Projects Response" section in https://www.globalgiving.org/api/methods/get-all-projects/? Any suggestions for modifications if needed? Note that I added Regions as I think it is a more generic type of search that the user can do, as opposed to a specific country. An example is ""Asia and Oceania."

  2. Do you think I am missing any models that should be created based on the "Get All Projects Response Structure" and "Element Definitions for Get All Projects Response" section in https://www.globalgiving.org/api/methods/get-all-projects/?

  3. I was not sure how to write the models such that the "country" element (primary country of where project resides and the "countries" element (The list of all countries that are tagged to this projects. Includes the primary country as well as any secondary countries) are distinct from one another. Any guidance on how to write these fields out to match their intent? Moreover, how can I best ensure that I don't create conflicts from the countries data from the Organization model?

vnoelifant commented 1 year ago

Also, @bbelderbos, note that while there are similar data fields between organizations and and their projects (like countries, themes), their are still differences on what each of them means. For instance, this is for "organizations" as per https://www.globalgiving.org/api/methods/get-all-organizations-download/. Screenshot (280)

While "countries" for "projects" means "The list of all countries that are tagged to this projects. Includes the primary country as well as any secondary countries" as per https://www.globalgiving.org/api/methods/get-all-projects/.

vnoelifant commented 1 year ago

Hi @bbelderbos in response to this error message below I received posted in slack, I changed a couple of the Projects' related name fields per commit b921c3a. Then I didn't receive the errors. But hopefully the database still makes sense. I will check it sometime my morning more, along with chat with you further, if you can.

ERRORS:
charity_finder.Organization.countries: (fields.E304) Reverse accessor 'Country.countries' for 'charity_finder.Organization.countries' clashes with reverse accessor for 'charity_finder.Project.countries'.
        HINT: Add or change a related_name argument to the definition for 'charity_finder.Organization.countries' or 'charity_finder.Project.countries'.
charity_finder.Organization.countries: (fields.E305) Reverse query name for 'charity_finder.Organization.countries' clashes with reverse query name for 'charity_finder.Project.countries'.
        HINT: Add or change a related_name argument to the definition for 'charity_finder.Organization.countries' or 'charity_finder.Project.countries'.
charity_finder.Organization.themes: (fields.E304) Reverse accessor 'Theme.themes' for 'charity_finder.Organization.themes' clashes with reverse accessor for 'charity_finder.Project.themes'.
        HINT: Add or change a related_name argument to the definition for 'charity_finder.Organization.themes' or 'charity_finder.Project.themes'.
charity_finder.Organization.themes: (fields.E305) Reverse query name for 'charity_finder.Organization.themes' clashes with reverse query name for 'charity_finder.Project.themes'.
        HINT: Add or change a related_name argument to the definition for 'charity_finder.Organization.themes' or 'charity_finder.Project.themes'.
charity_finder.Project.countries: (fields.E304) Reverse accessor 'Country.countries' for 'charity_finder.Project.countries' clashes with reverse accessor for 'charity_finder.Organization.countries'.
        HINT: Add or change a related_name argument to the definition for 'charity_finder.Project.countries' or 'charity_finder.Organization.countries'.
charity_finder.Project.countries: (fields.E305) Reverse query name for 'charity_finder.Project.countries' clashes with reverse query name for 'charity_finder.Organization.countries'.
        HINT: Add or change a related_name argument to the definition for 'charity_finder.Project.countries' or 'charity_finder.Organization.countries'.
charity_finder.Project.themes: (fields.E304) Reverse accessor 'Theme.themes' for 'charity_finder.Project.themes' clashes with reverse accessor for 'charity_finder.Organization.themes'.
        HINT: Add or change a related_name argument to the definition for 'charity_finder.Project.themes' or 'charity_finder.Organization.themes'.
charity_finder.Project.themes: (fields.E305) Reverse query name for 'charity_finder.Project.themes' clashes with reverse query name for 'charity_finder.Organization.themes'.
        HINT: Add or change a related_name argument to the definition for 'charity_finder.Project.themes' or 'charity_finder.Organization.themes'.