-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add a 'in cooperation with' field to site submissions #120
Conversation
…s co-developed with
@mojeto Any change to review this PR? |
Hi @maartenkling, thank you for the PR. Last few days were busy for me. I'll do a proper review sometime later this week. Stay tuned and sorry for delay. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution 🎉
The code looks good and I was about to just hit approve but remembered about the configurable site ordering (see comments).
Also, contributions aren't taken into account for sites/children count which is used in several places:
- Within the map markers on the developers index page (see javascript, page context and api)
- To order the developers below the map (see [template][map-tpl] and python)
Although to be fair, we can see there already are some comment indicating that the count my be off so this can probably be tackled in a separate PR.
@@ -3,10 +3,13 @@ | |||
from operator import itemgetter | |||
|
|||
from bs4 import BeautifulSoup | |||
from core import panels | |||
from core.forms import SubmitFormBuilder | |||
from core.utilities import has_recaptcha, validate_only_one_instance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those imports should stay where they were as it is enforced by isort.
I'm not sure why the CI didn't run on this PR. If it still doesn't run on next commit, you can run make lint-py
from within the Vagrant box to verify that it's all good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allright I'll revert that change.
pages = self.children() | ||
pages = WagtailSitePage.objects.filter( | ||
Q(path__startswith=self.path) | Q(in_cooperation_with=self) | ||
).distinct() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is losing the custom ordering defined in the children
method (controlled in the admin via the sites_ordering
field).
It should be possible to re-add the ordering without much issue for the alphabetical
and created
options. However it might be problematic for the path option as it was meant to allow manual ordering of pages but you won't be able to control the contributions (i.e. site not owned directly) would all appear either first or last (depending on whether the other developer profile was created before or after yours). Any ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I can add an option to a CompanyPage
, whether to 'mix' the cooperations with self-developed sites, or show cooperations separately from developed sites.
When the sorting preference is 'alphabetical' or 'created', the option can be applied on the separate queries / whole query.
When the sorting preference is 'path (manual)', maybe always show the self-developed sites (manually ordered) first, and then the cooperations (ordered by creation_date) after that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While adding an additional option would indeed help covering all the use-cases, I would rather keep it simple for now (until we have a need for more control):
alphabetical
: order all sites together bytitle
created
: order all sites together byfirst_published_at
path
: order all self-developed sites bypath
first, then all cooperations sites bypath
How does that sound?
Continuing work in #125. Thanks @thijskramer and @maartenkling. |
This feature adds an 'in cooperation with' field to site submissions, so that is possible to provide a 'partner' that co-developed on a project.
It looks like this in the admin:
Which renders on the website like this:
And on a company page, all sites the company co-developed on are shown as well: