Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List partner as support partner #203

Closed
lauraroverts opened this issue May 22, 2013 · 10 comments
Closed

List partner as support partner #203

lauraroverts opened this issue May 22, 2013 · 10 comments

Comments

@lauraroverts
Copy link

  • In admin everybody with editor rights can list any partner as a support partner. This should not be possible. Only Akvo staff can list partners as a support partner.
  • Thomas said is important.
@ghost ghost assigned adriancollier May 22, 2013
@adriancollier
Copy link
Contributor

OK, understood as a requirement but this has a few implications:

  1. What about partners such as UNDP who are managing all of their own projects?
  2. What happens if a support partner wants to add a project? (The project cannot be created as the Support Partner would not be able to be added)
  3. We create an additional manual step for every project being created that Akvo must complete - do we have the capacity (and agreement) to support this?

@lauraroverts
Copy link
Author

As we talked about briefly yesterday, it should be like this:
In the admin 'organisations' there must be check boxes where you can check if a partner is a field/support/sponsor/funding partner.
So if a partner is checked a support partner only this list of partners can be chosen from as a support partner in the admin 'projects'. This implicates that Akvo staff decides who is a support partner and who not, so people with editor or admin rights can only choose from these partners.

@ghost ghost assigned zzgvh May 29, 2013
@zzgvh
Copy link
Contributor

zzgvh commented Jun 3, 2013

I see two solutions, one simple and klunky, one complex and cool.

The simple and "Djangoish" way of solving this is to write a validator that checks if an organisation can be a partner of the selected type when the form is submitted. If not, the form is returned to the user with an error message that lists the allowed choices of partner type.

To make a cool solution for this is non-trivial. The reason is that the selection of partner types is dynamically dependent on the choice of organisation. This is not supported by the Django admin. This is not the first time someone has a problem like this however, so there's code to be used as the basis for this like https://bitbucket.org/mlavin/django-selectable which seems to be actively maintained. It uses jqueryui to do its magic.

We have other reasons for working on this problem too. The organisation list is already waaaaaay too long and really needs an auto-complete feature. Another area where this would be very cool is in the project listing where you'd want to change the possible choices for country and continent when an organisation is selected in the filter (and the other way around too, limit the org list to the relevant ones for a country or continent).

@lauraroverts
Copy link
Author

hi @zzgvh. could we shortly skype about this? Would be easier to make clear what kind of sulution the partner team is looking for. I also agree with you the organisation list is too long.

zzgvh added a commit that referenced this issue Jun 13, 2013
The PartnerType is a helper model containing one object for each partner
type organisations can assume in a Partnership.

Add the model definition to rsr.models.

Add Organisation.partner_types many-to-many field that enumerates the
types of partner a certain organisation can assume.

Add schema migration 0037 for PartnerType.

Add data migration 0038 that populates Organisation.partner_types based
on the current partnerships for each organisation.
zzgvh added a commit that referenced this issue Jun 13, 2013
Add signal to rsr.management that adds the objects for each partner
type to PartnerType if they are not already present
zzgvh added a commit that referenced this issue Jun 13, 2013
Set Organisation.partner_types to be read only unless you have change
permission on Organisation.

Change the help text for Organisation.partner_types field in the admin
depending on the read only status.
zzgvh added a commit that referenced this issue Jun 13, 2013
RSR_PartnershipInlineForm.clean_partner_type()

RSR_PartnershipInlineForm.clean_partner_type() checks if the
organisation is allowed to assume the given partner type based on the
objects in Organisation.partner_types for the org in question.

Small refactorings in RSR_PartnershipInlineFormFormSet.
zzgvh added a commit that referenced this issue Jun 13, 2013
The list is only visible if you have change permission on Organisation,
currently meaning Akvo staff groups only
zzgvh added a commit that referenced this issue Jun 13, 2013
To try debug the migration that fails when deployed to UAT
zzgvh added a commit that referenced this issue Jun 13, 2013
The migration depends on the PartnerType objects being present, but
they were created by a signal that wasn't run until after the
migrations.

Fix by adding the PartnerType objects as part of the data migration.
zzgvh added a commit that referenced this issue Jun 13, 2013
since ths is now done in migration 0038 instead
@zzgvh
Copy link
Contributor

zzgvh commented Jun 13, 2013

Deployed to UAT

@adriancollier
Copy link
Contributor

@peeb can you please code check this?
@lauraroverts could you please check out http://uat.akvo.org and see if this is working the way you need it to?

@ghost ghost assigned peeb Jun 27, 2013
@lauraroverts
Copy link
Author

If I click on any organisation in http://uat.akvo.org admin, we can select if a partner is support/sponsor/funding/field partner. This is what we want. Great!

@adriancollier
Copy link
Contributor

Can you also check the negative fo this:

If a partner is not already tagged as a Field/Fudning/Sponsor/Support that they should not be selectable as this?

@zzgvh
Copy link
Contributor

zzgvh commented Jul 2, 2013

Unfortunately they are selectable as all kinds of partners, but the validation only lets you save if you've chosen valid ones. Otherwise you'll get an error message when saving telling you what the problem is.

As mentioned above this can't be solved in a nicer way without some AJAX magic that populates the Partner type field when you select an organisation. Doable but outside the scope of the regular Django admin's capabilities.

@adriancollier
Copy link
Contributor

Works for me - all functionality is as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

4 participants