diff --git a/api/views/__init__.py b/api/views/__init__.py index 21aacd98..6a3fa8e9 100644 --- a/api/views/__init__.py +++ b/api/views/__init__.py @@ -33,8 +33,8 @@ from core.views import can_view, can_edit def check_if(obj, user, test): """ - Detect if it's a single object or a queryset - aply a given test on individual object and return global permission + Detect if it's a single object or a queryset + aply a given test on individual object and return global permission """ if isinstance(obj, QuerySet): for o in obj: @@ -49,7 +49,7 @@ class ManageModelMixin: @action(detail=True) def id(self, request, pk=None): """ - Get by id (api/v1/router/{pk}/id/) + Get by id (api/v1/router/{pk}/id/) """ self.queryset = get_object_or_404(self.queryset.filter(id=pk)) serializer = self.get_serializer(self.queryset) diff --git a/api/views/api.py b/api/views/api.py index 82d9942b..94dcf35c 100644 --- a/api/views/api.py +++ b/api/views/api.py @@ -33,7 +33,7 @@ from core.templatetags.renderer import markdown @renderer_classes((StaticHTMLRenderer,)) def RenderMarkdown(request): """ - Render Markdown + Render Markdown """ try: data = markdown(request.POST["text"]) diff --git a/api/views/club.py b/api/views/club.py index 38ce16be..d379d0b4 100644 --- a/api/views/club.py +++ b/api/views/club.py @@ -43,7 +43,7 @@ class ClubSerializer(serializers.ModelSerializer): class ClubViewSet(RightModelViewSet): """ - Manage Clubs (api/v1/club/) + Manage Clubs (api/v1/club/) """ serializer_class = ClubSerializer diff --git a/api/views/counter.py b/api/views/counter.py index 5b241031..a57093c3 100644 --- a/api/views/counter.py +++ b/api/views/counter.py @@ -45,7 +45,7 @@ class CounterSerializer(serializers.ModelSerializer): class CounterViewSet(RightModelViewSet): """ - Manage Counters (api/v1/counter/) + Manage Counters (api/v1/counter/) """ serializer_class = CounterSerializer @@ -54,7 +54,7 @@ class CounterViewSet(RightModelViewSet): @action(detail=False) def bar(self, request): """ - Return all bars (api/v1/counter/bar/) + Return all bars (api/v1/counter/bar/) """ self.queryset = self.queryset.filter(type="BAR") serializer = self.get_serializer(self.queryset, many=True) diff --git a/api/views/group.py b/api/views/group.py index 5e6436af..f4bb9951 100644 --- a/api/views/group.py +++ b/api/views/group.py @@ -36,7 +36,7 @@ class GroupSerializer(serializers.ModelSerializer): class GroupViewSet(RightModelViewSet): """ - Manage Groups (api/v1/group/) + Manage Groups (api/v1/group/) """ serializer_class = GroupSerializer diff --git a/api/views/launderette.py b/api/views/launderette.py index cdcacd0a..96c831ef 100644 --- a/api/views/launderette.py +++ b/api/views/launderette.py @@ -72,7 +72,7 @@ class LaunderetteTokenSerializer(serializers.ModelSerializer): class LaunderettePlaceViewSet(RightModelViewSet): """ - Manage Launderette (api/v1/launderette/place/) + Manage Launderette (api/v1/launderette/place/) """ serializer_class = LaunderettePlaceSerializer @@ -81,7 +81,7 @@ class LaunderettePlaceViewSet(RightModelViewSet): class LaunderetteMachineViewSet(RightModelViewSet): """ - Manage Washing Machines (api/v1/launderette/machine/) + Manage Washing Machines (api/v1/launderette/machine/) """ serializer_class = LaunderetteMachineSerializer @@ -90,7 +90,7 @@ class LaunderetteMachineViewSet(RightModelViewSet): class LaunderetteTokenViewSet(RightModelViewSet): """ - Manage Launderette's tokens (api/v1/launderette/token/) + Manage Launderette's tokens (api/v1/launderette/token/) """ serializer_class = LaunderetteTokenSerializer @@ -99,7 +99,7 @@ class LaunderetteTokenViewSet(RightModelViewSet): @action(detail=False) def washing(self, request): """ - Return all washing tokens (api/v1/launderette/token/washing) + Return all washing tokens (api/v1/launderette/token/washing) """ self.queryset = self.queryset.filter(type="WASHING") serializer = self.get_serializer(self.queryset, many=True) @@ -108,7 +108,7 @@ class LaunderetteTokenViewSet(RightModelViewSet): @action(detail=False) def drying(self, request): """ - Return all drying tokens (api/v1/launderette/token/drying) + Return all drying tokens (api/v1/launderette/token/drying) """ self.queryset = self.queryset.filter(type="DRYING") serializer = self.get_serializer(self.queryset, many=True) @@ -117,7 +117,7 @@ class LaunderetteTokenViewSet(RightModelViewSet): @action(detail=False) def avaliable(self, request): """ - Return all avaliable tokens (api/v1/launderette/token/avaliable) + Return all avaliable tokens (api/v1/launderette/token/avaliable) """ self.queryset = self.queryset.filter( borrow_date__isnull=True, user__isnull=True @@ -128,7 +128,7 @@ class LaunderetteTokenViewSet(RightModelViewSet): @action(detail=False) def unavaliable(self, request): """ - Return all unavaliable tokens (api/v1/launderette/token/unavaliable) + Return all unavaliable tokens (api/v1/launderette/token/unavaliable) """ self.queryset = self.queryset.filter( borrow_date__isnull=False, user__isnull=False diff --git a/api/views/user.py b/api/views/user.py index bb45a8a2..be3d97f8 100644 --- a/api/views/user.py +++ b/api/views/user.py @@ -50,8 +50,8 @@ class UserSerializer(serializers.ModelSerializer): class UserViewSet(RightModelViewSet): """ - Manage Users (api/v1/user/) - Only show active users + Manage Users (api/v1/user/) + Only show active users """ serializer_class = UserSerializer @@ -60,7 +60,7 @@ class UserViewSet(RightModelViewSet): @action(detail=False) def birthday(self, request): """ - Return all users born today (api/v1/user/birstdays) + Return all users born today (api/v1/user/birstdays) """ date = datetime.datetime.today() self.queryset = self.queryset.filter(date_of_birth=date) diff --git a/api/views/uv.py b/api/views/uv.py index d1099475..e9790e0b 100644 --- a/api/views/uv.py +++ b/api/views/uv.py @@ -29,10 +29,10 @@ def uv_endpoint(request): def find_uv(lang, year, code): """ - Uses the UTBM API to find an UV. - short_uv is the UV entry in the UV list. It is returned as it contains - information which are not in full_uv. - full_uv is the detailed representation of an UV. + Uses the UTBM API to find an UV. + short_uv is the UV entry in the UV list. It is returned as it contains + information which are not in full_uv. + full_uv is the detailed representation of an UV. """ # query the UV list uvs_url = settings.SITH_PEDAGOGY_UTBM_API + "/uvs/{}/{}".format(lang, year) @@ -57,7 +57,7 @@ def find_uv(lang, year, code): def make_clean_uv(short_uv, full_uv): """ - Cleans the data up so that it corresponds to our data representation. + Cleans the data up so that it corresponds to our data representation. """ res = {} diff --git a/club/forms.py b/club/forms.py index 3f450f78..519f54f8 100644 --- a/club/forms.py +++ b/club/forms.py @@ -252,8 +252,8 @@ class ClubMemberForm(forms.Form): def clean_users(self): """ - Check that the user is not trying to add an user already in the club - Also check that the user is valid and has a valid subscription + Check that the user is not trying to add an user already in the club + Also check that the user is valid and has a valid subscription """ cleaned_data = super(ClubMemberForm, self).clean() users = [] @@ -276,7 +276,7 @@ class ClubMemberForm(forms.Form): def clean(self): """ - Check user rights for adding an user + Check user rights for adding an user """ cleaned_data = super(ClubMemberForm, self).clean() diff --git a/club/views.py b/club/views.py index 73c06dd8..574e7b47 100644 --- a/club/views.py +++ b/club/views.py @@ -290,7 +290,7 @@ class ClubMembersView(ClubTabsMixin, CanViewMixin, DetailFormView): def form_valid(self, form): """ - Check user rights + Check user rights """ resp = super(ClubMembersView, self).form_valid(form) diff --git a/core/management/commands/compilestatic.py b/core/management/commands/compilestatic.py index fd956333..51d99f6d 100644 --- a/core/management/commands/compilestatic.py +++ b/core/management/commands/compilestatic.py @@ -31,7 +31,7 @@ from django.conf import settings class Command(BaseCommand): """ - Compiles scss in static folder for production + Compiles scss in static folder for production """ help = "Compile scss files from static folder" diff --git a/core/models.py b/core/models.py index d0db1a94..c51c9aab 100644 --- a/core/models.py +++ b/core/models.py @@ -1490,7 +1490,9 @@ class OperationLog(models.Model): User, related_name="logs", on_delete=models.SET_NULL, null=True ) operation_type = models.CharField( - _("operation type"), max_length=40, choices=settings.SITH_LOG_OPERATION_TYPE, + _("operation type"), + max_length=40, + choices=settings.SITH_LOG_OPERATION_TYPE, ) def is_owned_by(self, user): diff --git a/core/operations.py b/core/operations.py index 3c6eae9b..29740292 100644 --- a/core/operations.py +++ b/core/operations.py @@ -33,16 +33,16 @@ from django.db import connection, migrations class PsqlRunOnly(migrations.RunSQL): """ - This is an SQL runner that will launch the given command only if - the used DBMS is PostgreSQL. - It may be useful to run Postgres' specific SQL, or to take actions - that would be non-senses with backends other than Postgre, such - as disabling particular constraints that would prevent the migration - to run successfully. + This is an SQL runner that will launch the given command only if + the used DBMS is PostgreSQL. + It may be useful to run Postgres' specific SQL, or to take actions + that would be non-senses with backends other than Postgre, such + as disabling particular constraints that would prevent the migration + to run successfully. - See `club/migrations/0010_auto_20170912_2028.py` as an example. - Some explanations can be found here too: - https://stackoverflow.com/questions/28429933/django-migrations-using-runpython-to-commit-changes + See `club/migrations/0010_auto_20170912_2028.py` as an example. + Some explanations can be found here too: + https://stackoverflow.com/questions/28429933/django-migrations-using-runpython-to-commit-changes """ def _run_sql(self, schema_editor, sqls): diff --git a/core/scss/processor.py b/core/scss/processor.py index 39f099f9..8a5c3334 100644 --- a/core/scss/processor.py +++ b/core/scss/processor.py @@ -35,9 +35,9 @@ from core.scss.storage import ScssFileStorage, find_file class ScssProcessor(object): """ - If DEBUG mode enabled : compile the scss file - Else : give the path of the corresponding css supposed to already be compiled - Don't forget to use compilestatics to compile scss for production + If DEBUG mode enabled : compile the scss file + Else : give the path of the corresponding css supposed to already be compiled + Don't forget to use compilestatics to compile scss for production """ prefix = iri_to_uri(getattr(settings, "STATIC_URL", "/static/")) diff --git a/core/templatetags/renderer.py b/core/templatetags/renderer.py index fe982c60..656efca3 100644 --- a/core/templatetags/renderer.py +++ b/core/templatetags/renderer.py @@ -94,7 +94,7 @@ def datetime_format_python_to_PHP(python_format_string): @register.simple_tag() def scss(path): """ - Return path of the corresponding css file after compilation + Return path of the corresponding css file after compilation """ processor = ScssProcessor(path) return processor.get_converted_scss() diff --git a/core/views/__init__.py b/core/views/__init__.py index 62dd1581..df075b9c 100644 --- a/core/views/__init__.py +++ b/core/views/__init__.py @@ -344,19 +344,19 @@ class QuickNotifMixin: class DetailFormView(SingleObjectMixin, FormView): """ - Class that allow both a detail view and a form view + Class that allow both a detail view and a form view """ def get_object(self): """ - Get current group from id in url + Get current group from id in url """ return self.cached_object @cached_property def cached_object(self): """ - Optimisation on group retrieval + Optimisation on group retrieval """ return super(DetailFormView, self).get_object() diff --git a/core/views/forms.py b/core/views/forms.py index 1cfa42d9..392acb3e 100644 --- a/core/views/forms.py +++ b/core/views/forms.py @@ -114,14 +114,11 @@ class SelectFile(TextInput): attrs["class"] = "select_file" else: attrs = {"class": "select_file"} - output = ( - '%(content)s
' - % { - "content": super(SelectFile, self).render(name, value, attrs, renderer), - "title": _("Choose file"), - "name": name, - } - ) + output = '%(content)s
' % { + "content": super(SelectFile, self).render(name, value, attrs, renderer), + "title": _("Choose file"), + "name": name, + } output += ( '' - % { - "content": super(SelectUser, self).render(name, value, attrs, renderer), - "title": _("Choose user"), - "name": name, - } - ) + output = '%(content)s
' % { + "content": super(SelectUser, self).render(name, value, attrs, renderer), + "title": _("Choose user"), + "name": name, + } output += ( '