internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: liqd/a4-opin

Issue:
can't change language on login page



Discussion:

Resolving patch:
diff --git a/euth_wagtail/urls.py b/euth_wagtail/urls.py
--- a/euth_wagtail/urls.py
+++ b/euth_wagtail/urls.py
@@ -5,7 +5,6 @@
 from django.contrib import admin
 from django.contrib.auth.decorators import login_required
 from django.views.decorators.cache import never_cache
-from django.views.generic import TemplateView
 from django.views.i18n import javascript_catalog
 from rest_framework import routers
 from wagtail.wagtailadmin import urls as wagtailadmin_urls
@@ -30,6 +29,7 @@
 from euth.users import urls as user_urls
 from euth.users.api import UserViewSet
 
+from . import urls_accounts
 js_info_dict = {
     'packages': ('adhocracy4.comments',),
 }
@@ -55,6 +55,8 @@
 ]
 
 urlpatterns += i18n_patterns(
+    url(r'^accounts/', include('allauth.account.urls')),
+    url(r'^accounts/social/', include('allauth.socialaccount.urls')),
     url(r'^dashboard/', include(dashboard_urls)),
     url(r'^profile/', include(user_urls)),
     url(r'^orgs/', include(organisations_urls)),
@@ -65,15 +67,13 @@
     url(r'^memberships/', include(memberships_urls)),
     url(r'^offlinephases/', include(offlinephase_urls)),
     url(r'^blueprints/', include(blueprints_urls)),
-    url(r'^adhocracy/',
-        TemplateView.as_view(template_name="activate.html"), name="adhocracy"),
     url(r'^jsi18n/$', javascript_catalog,
         js_info_dict, name='javascript-catalog'),
     url(r'', include(wagtail_urls)),
 )
 
 urlpatterns += [
-    url(r'^accounts/', include('allauth.urls')),
+    url(r'^accounts/', include(urls_accounts)),
 ]
 
 if settings.DEBUG:
diff --git a/euth_wagtail/urls_accounts.py b/euth_wagtail/urls_accounts.py
new file mode 100644
--- /dev/null
+++ b/euth_wagtail/urls_accounts.py
@@ -0,0 +1,13 @@
+from importlib import import_module
+from allauth.socialaccount import providers
+
+urlpatterns = []
+
+for provider in providers.registry.get_list():
+    try:
+        prov_mod = import_module(provider.get_package() + '.urls')
+    except ImportError:
+        continue
+    prov_urlpatterns = getattr(prov_mod, 'urlpatterns', None)
+    if prov_urlpatterns:
+        urlpatterns += prov_urlpatterns


Test patch:
Repository: liqd/a4-opin

Issue:
Add indication for character limitation in the description window of the participation tab.
One of the Pilots noticed this. Is it possible to add an inline manual information to indicate all character limitations? That could be helpful for the users. Thank you :)
![grafik](https://cloud.githubusercontent.com/assets/24652917/25376874/fdaf7a5c-29a5-11e7-86ea-7f3c0a6a7449.png)



Discussion:
Margeret also noticed that information in other templates is not mentioned. Maybe we could add inline manual information in the participation tab for all the templates?

Resolving patch:
diff --git a/euth/dashboard/forms.py b/euth/dashboard/forms.py
--- a/euth/dashboard/forms.py
+++ b/euth/dashboard/forms.py
@@ -171,6 +171,11 @@ class Meta:
             'weight': forms.HiddenInput()
         }
 
+        help_texts = {
+            'name': _('It should be max. 80 characters long.'),
+            'description': _('It should be max. 300 characters long.'),
+        }
+
 
 def get_module_settings_form(settings_instance_or_modelref):
     if hasattr(settings_instance_or_modelref, 'module'):


Test patch:
Repository: liqd/a4-opin

Issue:
styling of categories in dashboard (Safari)
When using Safari the styling of categories in the dashboard is broken. 

![safari styling issue](https://user-images.githubusercontent.com/15954895/28914159-fe84edde-783a-11e7-8ae4-09f0a6b978cd.png)



Discussion:

Resolving patch:
diff --git a/euth/ideas/forms.py b/euth/ideas/forms.py
--- a/euth/ideas/forms.py
+++ b/euth/ideas/forms.py
@@ -7,3 +7,7 @@ class IdeaForm(category_forms.CategorizableForm):
     class Meta:
         model = models.Idea
         fields = ['name', 'description', 'image', 'category']
+
+    def __init__(self, *args, **kwargs):
+        super().__init__(*args, **kwargs)
+        self.fields['category'].empty_label = '---'


Test patch:
Repository: liqd/a4-opin

Issue:
alphabetical sorting jumps to most recent sorting when choosing page two of projects/ organisations
When I sort the participate section for alphabetical order the projects and organisations are not displayed in alphabetical order anymore when I go to any other page. 


Discussion:

Resolving patch:
diff --git a/euth/contrib/templatetags/__init__.py b/euth/contrib/templatetags/__init__.py
new file mode 100644
diff --git a/euth/contrib/templatetags/contrib_tags.py b/euth/contrib/templatetags/contrib_tags.py
new file mode 100644
--- /dev/null
+++ b/euth/contrib/templatetags/contrib_tags.py
@@ -0,0 +1,12 @@
+from django import template
+
+register = template.Library()
+
+
+@register.assignment_tag
+def combined_url_parameter(request_query_dict, **kwargs):
+    combined_query_dict = request_query_dict.copy()
+    for key in kwargs:
+        combined_query_dict.setlist(key, [kwargs[key]])
+    encoded_parameter = '?' + combined_query_dict.urlencode()
+    return encoded_parameter


Test patch:
Repository: liqd/a4-opin

Issue:
add languages to project detail page in wagtail (user manuals)
The titles of the user manuals or only in english and there are no fieldsfor translating them in wagtail. Is it possible to add the languages? :)
![grafik](https://user-images.githubusercontent.com/24652917/36986808-106f0bac-209b-11e8-9170-d48c83d42485.png)
![grafik](https://user-images.githubusercontent.com/24652917/36986822-1cda333a-209b-11e8-9af1-ed7b69386d5f.png)



Discussion:

Resolving patch:
diff --git a/home/templatetags/base_tags.py b/home/templatetags/base_tags.py
--- a/home/templatetags/base_tags.py
+++ b/home/templatetags/base_tags.py
@@ -3,12 +3,22 @@
 from dateutil import parser
 from django import template
 from django.conf import settings
+from django.core.exceptions import ObjectDoesNotExist
 
+from home.models.manual_pages import ManualsDetailPage
 from home.models.snippets import NavigationMenu
 
 register = template.Library()
 
 
+@register.assignment_tag(takes_context=True)
+def get_page_name(context, page):
+    try:
+        return ManualsDetailPage.objects.get(id=page.id).translated_title
+    except ObjectDoesNotExist:
+        return page
+
+
 @register.assignment_tag(takes_context=True)
 def get_site_root(context):
     return context['request'].site.root_page


Test patch:
Repository: liqd/a4-opin

Issue:
dashboard styling: spacing when entering the first information of project
We also need more space between texts, boxes and bottons on the page where I add the first information for a project.

![screen shot 2018-03-01 at 11 44 37](https://user-images.githubusercontent.com/15954895/36840771-7a54da9a-1d46-11e8-9887-3a72d4c4476d.png)



Discussion:

Resolving patch:
diff --git a/euth/projects/forms.py b/euth/projects/forms.py
--- a/euth/projects/forms.py
+++ b/euth/projects/forms.py
@@ -1,11 +1,17 @@
 from django import forms
+from django.utils.translation import ugettext_lazy as _
 
 from adhocracy4.projects.models import Project
 from euth.users.fields import UserSearchField
 
 
 class AddModeratorForm(forms.ModelForm):
-    user = UserSearchField(required=False, identifier='moderators',)
+    user = UserSearchField(required=False,
+                           identifier='moderators',
+                           help_text=_('Type in the username '
+                                       'of a user you would '
+                                       'like to add as moderator.'),
+                           label=_('Search for username'))
 
     class Meta:
         model = Project


Test patch:
Repository: liqd/a4-opin

Issue:
Changing the Organisation Details is not possible
**URL:** 
https://opin.me/en/dashboard/organisations/liquid-democracy/settings/
**user:** 
Initiators, who try to fill in the Organisations details & as an admin too.
**expected behaviour:** 
If I fill in Organisation details, save them and it is there
**behaviour:** 
I fill in the Organisation details, press save and it reloads, but do not save.
**important screensize:**

**device & browser:** 
Firefox 73.0.1 (64-Bit)
**Comment/Question:** 

Screenshot?



Discussion:
Hm, it's actually even better: there are a couple of fields that are required, so when creating an organisation and adding initiators one *has* to set them initially.

When I then use the dashboard to change those settings, it overrides those initial settings to empty :)
sorry I forgot to take my assignment off ages ago, are you on this now @rmader ?
Ah, so it worked before the dashboard, I guess? I suspected the language field thing update. Should I look into fixing this tomorrow or will you do today @rmader ?
It must have something to do with the translatable entries - in the dashboard there's only one while in the dashboard there are tabs at the top for every language. So yes, please continue :)
FWIW: apparently most organisations now have their info set in the english variant, no matter what language they actually use. So it might be easier to ditch the django-parler stuff - or fix it somehow :)

Resolving patch:
diff --git a/euth/dashboard/forms.py b/euth/dashboard/forms.py
--- a/euth/dashboard/forms.py
+++ b/euth/dashboard/forms.py
@@ -81,7 +81,7 @@ def untranslated(self):
         """
         return [field for field in self if '__' not in field.html_name]
 
-    def prefiled_languages(self):
+    def prefilled_languages(self):
         """
         Return languages tabs that need to be displayed.
         """


Test patch:
diff --git a/tests/dashboard/test_dashboard_views.py b/tests/dashboard/test_dashboard_views.py
--- a/tests/dashboard/test_dashboard_views.py
+++ b/tests/dashboard/test_dashboard_views.py
@@ -244,7 +244,7 @@ def test_dashboard_update_organisation(client, organisation):
 
     response = client.get(url)
     form = response.context_data['form']
-    assert form.prefiled_languages() == ['en']
+    assert form.prefilled_languages() == ['en']
     assert len(form.untranslated()) == 9
     assert len(form.translated()) == 10
     assert form.translated()[0][0] == 'en'
Repository: liqd/a4-opin

Issue:
Sort by section changes automatically to "most recent" on productive



Discussion:
When selecting another sorting mode like "most support" the sorting changes automatically back to "most recent" when going to page 2. 
![grafik](https://user-images.githubusercontent.com/24652917/51323838-94180080-1a69-11e9-9eba-ac953c548e49.png)


Resolving patch:
diff --git a/euth/ideas/templatetags/idea_tags.py b/euth/ideas/templatetags/idea_tags.py
--- a/euth/ideas/templatetags/idea_tags.py
+++ b/euth/ideas/templatetags/idea_tags.py
@@ -18,3 +18,12 @@ def get_range(number, listcount):
 @register.simple_tag
 def is_idea_list(module):
     return Idea.objects.filter(module=module).count() > 0
+
+
+@register.simple_tag
+def combined_url_parameter(request_query_dict, **kwargs):
+    combined_query_dict = request_query_dict.copy()
+    for key in kwargs:
+        combined_query_dict.setlist(key, [kwargs[key]])
+    encoded_parameter = '?' + combined_query_dict.urlencode()
+    return encoded_parameter


Test patch:
diff --git a/tests/ideas/test_templatetags.py b/tests/ideas/test_templatetags.py
new file mode 100644
--- /dev/null
+++ b/tests/ideas/test_templatetags.py
@@ -0,0 +1,42 @@
+import pytest
+
+from adhocracy4.test import helpers
+
+
+@pytest.mark.django_db
+def test_get_range(rf):
+    request = rf.get('/')
+    template = ('{% load idea_tags %}'
+                '{% get_range page_number_1 page_num_pages as range_1 %}'
+                '{% get_range page_number_5 page_num_pages as range_5 %}'
+                '{% get_range page_number_11 page_num_pages as range_11 %}'
+                '{{ range_1 }}'
+                '{{ range_5 }}'
+                '{{ range_11 }}')
+    context = {'request': request,
+               'page_number_1': 1,
+               'page_number_5': 5,
+               'page_number_11': 11,
+               'page_num_pages': 12}
+    helpers.render_template(template, context)
+
+    assert range(1, 6) == context['range_1']
+    assert range(3, 8) == context['range_5']
+    assert range(8, 13) == context['range_11']
+
+
+@pytest.mark.django_db
+def test_combined_url_parameter(rf):
+    request = rf.get('/?bla=bums&da=dings')
+    template = ('{% load idea_tags %}'
+                '{% combined_url_parameter request.GET as url_par_1 %}'
+                '{% combined_url_parameter request.GET bla="" as url_par_2 %}'
+                '{{ url_par_1 }}'
+                '{{ url_par_2 }}')
+    context = {'request': request}
+    helpers.render_template(template, context)
+
+    assert 'bla=bums' in context['url_par_1']
+    assert 'da=dings' in context['url_par_1']
+    assert 'bla=' in context['url_par_2']
+    assert 'da=dings' in context['url_par_2']
Repository: liqd/a4-opin

Issue:
Offline events an more info of private projects visible even if not logged in
If I type in/ link to the URL of an offline event, I can see the event’s content and the info tab’s content of a private project.

For example, if you take this URL:
https://opin-stage.liqd.net/de/offlineevents/53/

you can access the information even if you are not logged in with an account.


Discussion:
But our private projects are a bit different than elsewhere. You can see them in the list for example and then request membership.
So, we want the project page to only display the membership request, then? I think, we should hide the offline events, but not the info about the project. You need the info to decide if you want to request membership, I would say. 
@hello-kathi what do you think?
@fuzzylogic2000 That is difficult, but I think you are right. Hiding the offline event is important, because of safety and stuff. So not everyone can come to that offline event. 
Currently, I can also see topics from the community module if I have the link. So, also check the ideas!
Ideas can not be seen if the project is private. For the topics, adding the Permission Required Mixin solved it.

Resolving patch:
diff --git a/euth/offlinephases/rules.py b/euth/offlinephases/rules.py
--- a/euth/offlinephases/rules.py
+++ b/euth/offlinephases/rules.py
@@ -1,8 +1,17 @@
 import rules
 from rules.predicates import is_superuser
 
+from adhocracy4.modules.predicates import (is_context_initiator,
+                                           is_context_member,
+                                           is_context_moderator,
+                                           is_public_context)
+
 from .predicates import is_offlinephase_moderator
 
 rules.add_perm(
     'euth_offlinephases.modify_offlinephase',
     is_offlinephase_moderator | is_superuser)
+
+rules.add_perm('euth_offlinephases.view_offlineevent',
+               is_superuser | is_context_moderator | is_context_initiator |
+               is_context_member | is_public_context)
diff --git a/euth/offlinephases/views.py b/euth/offlinephases/views.py
--- a/euth/offlinephases/views.py
+++ b/euth/offlinephases/views.py
@@ -4,6 +4,7 @@
 from django.urls import reverse
 from django.utils.translation import ugettext_lazy as _
 from django.views import generic
+from rules.contrib.views import PermissionRequiredMixin
 
 from adhocracy4.dashboard import mixins
 from adhocracy4.projects.mixins import ProjectMixin
@@ -12,10 +13,10 @@
 from .mixins import OfflineEventFormMixin
 
 
-class OfflineEventDetailView(
-    generic.DetailView
-):
+class OfflineEventDetailView(PermissionRequiredMixin,
+                             generic.DetailView):
     model = models.OfflineEvent
+    permission_required = 'euth_offlinephases.view_offlineevent'
 
     @property
     def project(self):


Test patch:
Repository: liqd/a4-opin

Issue:
Initiators gets Error 403 when deleting Offline Events
**URL:https://opin.me/de/dashboard/offlineevents/offline-test/delete/
https://opin.me/de/projects/magda-testet-brainstorming/** 
**user: Initiator** 
**expected behaviour: As an Initiator I want to delete an Offline Event and then it is deleted** 
**behaviour:As an Initiator I get an Error 403 if I click on delete in the Project dashboard** 
**important screensize:**
**device & browser: Firefox, Chrome, Safarie** 
**Comment/Question:** 

Screenshot?



Discussion:
@hello-kathi We were meant to fix this one before the release, right? I added a milestone. Could you please check the other issues and assign them with this milestone if they need to be fixed prior to the release? Thank you!

Resolving patch:
diff --git a/euth/offlinephases/views.py b/euth/offlinephases/views.py
--- a/euth/offlinephases/views.py
+++ b/euth/offlinephases/views.py
@@ -167,7 +167,7 @@ class OfflineEventDeleteView(ProjectMixin,
                              generic.DeleteView):
     model = models.OfflineEvent
     success_message = _('The offline event has been deleted')
-    permission_required = ''
+    permission_required = 'a4projects.change_project'
     template_name = 'euth_offlinephases/offlineevent_confirm_delete.html'
     get_context_from_object = True
 


Test patch:
Repository: liqd/a4-opin

Issue:
DTS - Do this. Do that.
**URL:** https://opin-stage.liqd.net/de/blueprints/liquid-democracy-ev/
**user:** *initiator*
**expected behaviour:** *An explaining help text in english. Do this: Start a discussion and moderate it.  Do that: Participants can upload documents to deepen the exchange and share information.*
**behaviour:** *Lorem Ipsum text*


**Comment/Question:** *Would this be a story?* 

If needed or helpful you can add a screenshot. Since issues are public, make sure to not display personal or secret data.
<img width="877" alt="Bildschirmfoto 2020-07-28 um 08 41 19" src="https://user-images.githubusercontent.com/52459078/88628485-565c5500-d0ae-11ea-9630-78ada0dcd294.png">



Discussion:
I forgot that, so it is not an "issue", but I transalted it already in german. (not do this and that, the final one ;) )

Resolving patch:
diff --git a/euth/blueprints/blueprints.py b/euth/blueprints/blueprints.py
--- a/euth/blueprints/blueprints.py
+++ b/euth/blueprints/blueprints.py
@@ -74,8 +74,9 @@ class Aim(Enum):
     communitydebate = (
         'communitydebate',
         _('Find and debate topics and questions.'),
-        [_('Do this.'),
-         _('Do that.')]
+        [_('Start a discussion and moderate it'),
+         _('Participants can upload documents to deepen the exchange '
+           'and share information')]
     )
 
     def __new__(cls, value, label, examples):


Test patch:
Repository: liqd/a4-opin

Issue:
Next Button in DTS is not working
**URL:** https://opin-stage.liqd.net/de/blueprints/liquid-democracy-ev/
**user:** * initiator*
**expected behaviour:** *If I click on next(weiter) then I come to the next page*
**behaviour:** *I can click on it, but nothing happens*
**important screensize:** * desktop?*
**device & browser:** *Desktop, firefox 78.2.(64-Bit)*




Discussion:

Resolving patch:
diff --git a/euth/blueprints/blueprints.py b/euth/blueprints/blueprints.py
--- a/euth/blueprints/blueprints.py
+++ b/euth/blueprints/blueprints.py
@@ -74,8 +74,9 @@ class Aim(Enum):
     communitydebate = (
         'communitydebate',
         _('Find and debate topics and questions.'),
-        [_('Do this.'),
-         _('Do that.')]
+        [_('Start a discussion and moderate it'),
+         _('Participants can upload documents to deepen the exchange '
+           'and share information')]
     )
 
     def __new__(cls, value, label, examples):


Test patch:
Repository: liqd/a4-opin

Issue:
In the Poll Blueprint we refer to the OPIN App
**URL:** https://opin.me/en/dashboard/organisations/opin/blueprints/
**user:** All
**expected behaviour:** 
Run customizable, multi-step polls on OPIN to get detailed opinions on topics from the public or your members. 
Phase 1: Answer the questions and comment on the poll.

**behaviour:** 

Run customizable, multi-step polls on OPIN to get detailed opinions on topics from the public or your members. **Via the OPIN polling app for iOS and Android these polls are also accessible on smartphones.**
Phase 1: Answer the questions and comment on the poll.

**important screensize:**
**device & browser:** 
**Comment/Question:** 
I already changed the text in transifex in the other languages
Screenshot?
<img width="1309" alt="Bildschirmfoto 2022-03-04 um 08 21 10" src="https://user-images.githubusercontent.com/52459078/156718032-d5fa18af-d297-4288-9c0d-e8818940f555.png">




Discussion:

Resolving patch:
diff --git a/euth/blueprints/blueprints.py b/euth/blueprints/blueprints.py
--- a/euth/blueprints/blueprints.py
+++ b/euth/blueprints/blueprints.py
@@ -313,8 +313,7 @@ class Accessibility(BlueprintEnum):
          title=_('Poll'),
          description=_('Run customizable, multi-step polls on OPIN to get '
                        'detailed opinions on topics from the public or your '
-                       'members. Via the OPIN polling app for iOS and Android '
-                       'these polls are also accessible on smartphones.'),
+                       'members.'),
          content=[
              poll_phases.VotingPhase(),
          ],


Test patch:
Repository: liqd/a4-opin

Issue:
View on site from django admin cause 500 and sentry error
**user:** admin
**expected behaviour:** clicking 'view on site' from module page in django admin takes you to page
**behaviour:** it causes a 500 error and triggers santry
**Comment/Question:** this may have an answer https://stackoverflow.com/questions/911887/how-can-i-get-the-django-admins-view-on-site-link-to-work

Sentry error: https://sentry.liqd.net/organizations/liqd/issues/1346/events/?project=8&referrer=alert_email



Discussion:
The proposed solution in the link is already implemented in opin. 

Because the error said "("Reverse for 'module-detail' not found. 'module-detail' is not a valid view "
 'function or pattern name.') I added the urlpattern as is done here:
https://github.com/liqd/a4-meinberlin/blob/87b005a334e8a2404cac786e8336749a547cbe04/meinberlin/apps/projects/urls.py#L20

The also added the module-detail-view as is done here:
https://github.com/liqd/a4-meinberlin/blob/87b005a334e8a2404cac786e8336749a547cbe04/meinberlin/apps/projects/views.py#L381

This retrieves the page and shows it, but also throws a 
Forbidden: /api/follows/this-is-a-text-review/
[14/Mar/2022 14:06:34] "GET /api/follows/this-is-a-text-review/ HTTP/1.1" 403 33


@sabinammm As we only have one module - one project in opin, the best solution would be to give the get_absolute_url of the module the project-link. As this is in a4, that might not be possible. In that case, we can either just disable that link to the site or find a way to overwrite it in the admin.py and make it link to the respective project url. 
You can do both option with the `ModelAdmin.view_on_site`, so please try the latter and add a reverse link to the project url.
https://docs.djangoproject.com/en/3.2/ref/contrib/admin/

Resolving patch:
diff --git a/euth/contrib/admin.py b/euth/contrib/admin.py
new file mode 100644
--- /dev/null
+++ b/euth/contrib/admin.py
@@ -0,0 +1,15 @@
+from django.contrib import admin
+from django.urls import reverse
+
+from adhocracy4.modules import models
+from adhocracy4.modules.admin import ModuleAdmin as A4ModuleAdmin
+
+
+class ModuleAdmin(A4ModuleAdmin):
+
+    def view_on_site(self, obj):
+        return reverse('project-detail', args=[str(obj.project.slug)])
+
+
+admin.site.unregister(models.Module)
+admin.site.register(models.Module, ModuleAdmin)


Test patch: