From a4eb80c1410d3cff2fae0f3358e223d4918de812 Mon Sep 17 00:00:00 2001 From: Arkadiy Korotaev Date: Mon, 20 Jul 2020 16:20:03 +0200 Subject: [PATCH 1/3] fix(makefile): Avoid --user flag usage if previous PIP run has failed - which makes no difference for virtualenv anyway --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2cc1bbf7..9a212f5a 100644 --- a/Makefile +++ b/Makefile @@ -78,8 +78,9 @@ readme: #: demo - Setup demo project using Python3. .PHONY: demo demo: - $(PIP) install -e . --user - $(PIP) install -e demo --user + # running it with and without --user flag because it started to be problematic for some setups + $(PIP) install -e . --user || $(PIP) install -e . + $(PIP) install -e demo --user || $(PIP) install -e demo demodesk migrate --noinput # Create superuser; user will be prompted to manually set a password # When you get a prompt, enter a password of your choosing. From 34eb793f68db7e43eaf39b463cdda27d08fbb9c7 Mon Sep 17 00:00:00 2001 From: Arkadiy Korotaev Date: Mon, 20 Jul 2020 16:41:22 +0200 Subject: [PATCH 2/3] fix(demo): Update demo's INSTALLED_APPS to avoid it crashing after pinax-team library was introduced #820 --- demo/demodesk/config/settings.py | 7 ++++++- requirements.txt | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/demo/demodesk/config/settings.py b/demo/demodesk/config/settings.py index e1ac8106..8d931242 100644 --- a/demo/demodesk/config/settings.py +++ b/demo/demodesk/config/settings.py @@ -38,7 +38,12 @@ INSTALLED_APPS = [ 'django.contrib.sites', 'django.contrib.humanize', 'bootstrap4form', - 'helpdesk' + + 'account', # Required by pinax-teams + 'pinax.invitations', # required by pinax-teams + 'pinax.teams', # team support + 'helpdesk', # This is us! + 'reversion', # required by pinax-teams ] MIDDLEWARE = [ diff --git a/requirements.txt b/requirements.txt index 248a6464..83b8924d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,4 +12,6 @@ pytz six djangorestframework django-model-utils -pinax-teams @ git+https://github.com/auto-mat/pinax-teams.git@slugify#egg=pinax-teams + +# specific commit because the current release has no required library upgrade +pinax-teams @ git+https://github.com/pinax/pinax-teams.git@dd75e1c#egg=pinax-teams From cf98b4a8e944789907d3f83521d2efd7f076e265 Mon Sep 17 00:00:00 2001 From: Arkadiy Korotaev Date: Mon, 20 Jul 2020 16:43:55 +0200 Subject: [PATCH 3/3] fix(public): Fix the public ticket creation by passing user or None to the form.save() method --- helpdesk/views/public.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpdesk/views/public.py b/helpdesk/views/public.py index e046148f..c268b15f 100644 --- a/helpdesk/views/public.py +++ b/helpdesk/views/public.py @@ -97,7 +97,7 @@ class BaseCreateTicketView(abstract_views.AbstractCreateTicketMixin, FormView): # This submission is spam. Let's not save it. return render(request, template_name='helpdesk/public_spam.html') else: - ticket = form.save() + ticket = form.save(user=self.request.user if self.request.user.is_authenticated else None) try: return HttpResponseRedirect('%s?ticket=%s&email=%s&key=%s' % ( reverse('helpdesk:public_view'),