Skip to content

Commit

Permalink
🚨 fix linter errors, formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
krmax44 committed Sep 16, 2024
1 parent 328996a commit f202375
Show file tree
Hide file tree
Showing 27 changed files with 415 additions and 494 deletions.
1 change: 0 additions & 1 deletion froide_campaign/migrations/0026_auto_20200902_1657.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Generated by Django 3.0.8 on 2020-09-02 14:57

import django.contrib.postgres.fields.jsonb
from django.db import migrations, models


Expand Down
1 change: 0 additions & 1 deletion froide_campaign/migrations/0027_auto_20200921_1007.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Generated by Django 3.0.8 on 2020-09-21 08:07

import django.contrib.postgres.fields.jsonb
from django.db import migrations, models


Expand Down
1 change: 0 additions & 1 deletion froide_campaign/migrations/0030_auto_20201102_1342.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Generated by Django 3.0.8 on 2020-11-02 12:42

import django.contrib.postgres.fields.jsonb
from django.db import migrations, models


Expand Down
1 change: 0 additions & 1 deletion froide_campaign/migrations/0031_auto_20201102_1809.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Generated by Django 3.0.8 on 2020-11-02 17:09

import django.contrib.postgres.fields.jsonb
from django.db import migrations, models


Expand Down
1 change: 0 additions & 1 deletion froide_campaign/migrations/0033_auto_20201130_1458.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Generated by Django 3.0.8 on 2020-11-30 13:58

import django.contrib.postgres.fields.jsonb
from django.db import migrations, models


Expand Down
1 change: 0 additions & 1 deletion froide_campaign/migrations/0035_auto_20210108_1915.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Generated by Django 3.1.4 on 2021-01-08 18:15

import django.contrib.postgres.fields.jsonb
from django.db import migrations, models


Expand Down
3 changes: 1 addition & 2 deletions froide_campaign/migrations/0037_auto_20210204_1309.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by Django 3.1.4 on 2021-02-04 12:09

import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
from django.db import migrations


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion froide_campaign/migrations/0040_auto_20210204_1528.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by Django 3.1.4 on 2021-02-04 14:28

from django.db import migrations, models
from django.db import migrations


class Migration(migrations.Migration):
Expand Down
23 changes: 9 additions & 14 deletions froide_campaign/providers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,23 @@


class ProviderProtocol(Protocol):
def __init__(self, campaign, **kwargs):
...
def __init__(self, campaign, **kwargs): ...

def get_queryset(self):
...
def get_queryset(self): ...

def get_serializer(self, obj_or_list, **kwargs):
...
def get_serializer(self, obj_or_list, **kwargs): ...

def get_item_data(self, obj: Any, foirequests=None, detail=False) -> Dict[str, Any]:
...
def get_item_data(
self, obj: Any, foirequests=None, detail=False
) -> Dict[str, Any]: ...

def make_ident(self, obj: Any) -> str:
...
def make_ident(self, obj: Any) -> str: ...

def get_request_url_context(
self, obj: Any, language=Optional[str]
) -> Dict[str, Any]:
...
) -> Dict[str, Any]: ...

def get_publicbodies(self, obj: Any) -> List[PublicBody]:
...
def get_publicbodies(self, obj: Any) -> List[PublicBody]: ...


def first(x):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{% extends "admin/change_list.html" %}
{% load i18n %}

{% block content %}
{{ block.super }}
<div>
<form method="post" action="{% url 'admin:froide_campaign-admin_upload' %}" enctype="multipart/form-data">{% csrf_token %}
<p>
<input type="file" name="file"/>
<input type="submit" value="{% trans "Upload information objects as CSV" %}"/>
</p>
</form>
</div>
{% endblock %}
{{ block.super }}
<div>
<form method="post"
action="{% url 'admin:froide_campaign-admin_upload' %}"
enctype="multipart/form-data">
{% csrf_token %}
<p>
<input type="file" name="file" />
<input type="submit" value="{% trans "Upload information objects as CSV" %}" />
</p>
</form>
</div>
{% endblock content %}
94 changes: 40 additions & 54 deletions froide_campaign/templates/froide_campaign/_info_object.html
Original file line number Diff line number Diff line change
@@ -1,58 +1,44 @@
{% load i18n %}

{% load follow_tags %}

<tr>
<td>
{% block action_column %}
{% if object.foirequest %}
<a href="{{ object.foirequest.get_absolute_url }}">
{{ object.foirequest.readable_status }}
{% if object.campaign.category %}
– {{ object.campaign.category }}
{% endif %}
</a>
{% elif object.resolved %}
{% trans "Information already public" %}
{% elif object.campaign.paused %}
<span class="btn btn-default" disabled="disabled">
{% trans "Campaign currently suspended" %}
</span>
{% else %}
<a class="btn btn-primary" href="{{ object.make_request_url }}&amp;redirect={{ campaign_url|urlencode }}{{ "?"|urlencode }}{{ getvars_complete|urlencode }}">
{% if object.campaign.category %}
{% blocktrans with name=object.campaign.category %}Request {{ name }}{% endblocktrans %}
{% else %}
{% trans "Make request" %}
{% endif %}
</a>
{% endif %}

{% if object.foirequest and request.user.is_authenticated and request.user != object.foirequest.user %}
{% follow_form "request" object.foirequest follow_only=True verbose=False %}
{% endif %}
{% endblock %}
</td>
<td>
{% block description_column %}
{% if object.foirequest %}
{{ object.get_description }}
{% elif object.resolved %}
{% if object.resolution_link %}
<a href="{{ object.resolution_link }}">
{% endif %}

{{ object.get_description }}

{% if object.resolution_link %}
</a>
{% endif %}
{% if object.resolution_text %}
<p>{{ object.resolution_text }}</p>
{% endif %}
{% else %}
{{ object.get_description }}
{% endif %}
{% endblock %}
</td>
<td>
{% block action_column %}
{% if object.foirequest %}
<a href="{{ object.foirequest.get_absolute_url }}">
{{ object.foirequest.readable_status }}
{% if object.campaign.category %}– {{ object.campaign.category }}{% endif %}
</a>
{% elif object.resolved %}
{% trans "Information already public" %}
{% elif object.campaign.paused %}
<span class="btn btn-default" disabled="disabled">{% trans "Campaign currently suspended" %}</span>
{% else %}
<a class="btn btn-primary"
href="{{ object.make_request_url }}&amp;redirect={{ campaign_url|urlencode }}{{ "?"|urlencode }}{{ getvars_complete|urlencode }}">
{% if object.campaign.category %}
{% blocktrans with name=object.campaign.category %}Request {{ name }}{% endblocktrans %}
{% else %}
{% trans "Make request" %}
{% endif %}
</a>
{% endif %}
{% if object.foirequest and request.user.is_authenticated and request.user != object.foirequest.user %}
{% follow_form "request" object.foirequest follow_only=True verbose=False %}
{% endif %}
{% endblock action_column %}
</td>
<td>
{% block description_column %}
{% if object.foirequest %}
{{ object.get_description }}
{% elif object.resolved %}
{% if object.resolution_link %}<a href="{{ object.resolution_link }}">{% endif %}
{{ object.get_description }}
{% if object.resolution_link %}</a>{% endif %}
{% if object.resolution_text %}<p>{{ object.resolution_text }}</p>{% endif %}
{% else %}
{{ object.get_description }}
{% endif %}
{% endblock description_column %}
</td>
</tr>
29 changes: 10 additions & 19 deletions froide_campaign/templates/froide_campaign/_info_object_no_foi.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
{% load i18n %}

<tr>
<td>
<a class="btn btn-primary" href="{{ object.get_search_url }}">
{% trans "Search online" %}
</a>
</td>
<td>
{% if object.foirequest %}
<a href="{{ object.foirequest.get_absolute_url }}">
{% endif %}
{{ object.get_description }}
{% if object.foirequest %}
</a>
{% endif %}
<br/>
{% if object.foirequest %}
{{ object.foirequest.readable_status }}
{% endif %}
</td>
<td>
<a class="btn btn-primary" href="{{ object.get_search_url }}">{% trans "Search online" %}</a>
</td>
<td>
{% if object.foirequest %}<a href="{{ object.foirequest.get_absolute_url }}">{% endif %}
{{ object.get_description }}
{% if object.foirequest %}</a>{% endif %}
<br />
{% if object.foirequest %}{{ object.foirequest.readable_status }}{% endif %}
</td>
</tr>
43 changes: 21 additions & 22 deletions froide_campaign/templates/froide_campaign/_questionaire.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
{% load i18n %}

{% load markup %}
{% load form_helper %}

{% if questionaire and iobj and foirequest %}
<form method="post" action="{% url 'campaign-add_campaign_report' questionaire_id=questionaire.id iobj_id=iobj.id foirequest_id=foirequest.id %}">
{% csrf_token %}
<h3>{{ questionaire.title }}</h3>
<div>{{ questionaire.description|markdown }}</div>
{% if report_count %}
<p>
{% blocktranslate count report_count=report_count %}
<form method="post"
action="{% url 'campaign-add_campaign_report' questionaire_id=questionaire.id iobj_id=iobj.id foirequest_id=foirequest.id %}">
{% csrf_token %}
<h3>{{ questionaire.title }}</h3>
<div>{{ questionaire.description|markdown }}</div>
{% if report_count %}
<p>
{% blocktranslate count report_count=report_count %}
You already made a submission.
{% plural %}
You already made {{ report_count }} submissions.
{% endblocktranslate %}
</p>
{% endif %}
{% render_form form %}
<p class="text-end">
<button class="btn btn-primary" type="submit">
{% if questionaire.multiple_reports %}
{% translate "Add entry" %}
{% else %}
{% translate "Save" %}
</p>
{% endif %}
</button>
</p>
</form>
{% endif %}
{% render_form form %}
<p class="text-end">
<button class="btn btn-primary" type="submit">
{% if questionaire.multiple_reports %}
{% translate "Add entry" %}
{% else %}
{% translate "Save" %}
{% endif %}
</button>
</p>
</form>
{% endif %}
6 changes: 3 additions & 3 deletions froide_campaign/templates/froide_campaign/base.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "base.html" %}

{% block app_body %}
{% block main %}{% endblock %}
{% endblock %}
{% block main %}
{% endblock main %}
{% endblock app_body %}
Loading

0 comments on commit f202375

Please sign in to comment.