Commit 4b1ed1a2 authored by Elger Jonker's avatar Elger Jonker

bugfixes


Former-commit-id: 379aa385
parent 49a878b9
......@@ -319,6 +319,16 @@ class UrlSubmissionAdmin(ImportExportModelAdmin, admin.ModelAdmin):
actions = []
@transaction.atomic
def reset_judgement(self, request, queryset):
for urlsubmission in queryset:
urlsubmission.has_been_accepted = False
urlsubmission.has_been_rejected = False
urlsubmission.save()
self.message_user(request, "URL be accepted/rejected again.")
reset_judgement.short_description = "Reset acceptance / rejection."
actions.append('reset_judgement')
@transaction.atomic
def accept(self, request, queryset):
for urlsubmission in queryset:
......@@ -330,19 +340,17 @@ class UrlSubmissionAdmin(ImportExportModelAdmin, admin.ModelAdmin):
# it's possible that the url already is in the system. If so, tie that to the submitted organization.
# could be dead etc... (stacking?)
try:
url = Url.objects.all().filter(url=urlsubmission.url, is_dead=False).first()
except Url.DoesNotExist:
url = Url.objects.all().filter(url=urlsubmission.url, is_dead=False).first()
if not url:
log.debug('adding new url: %s' % urlsubmission.url)
# if it already exists, then add the url to the organization.
url = Url(url=urlsubmission.url)
url.save()
# the organization is already inside the submission and should exist in most cases.
try:
url.organization.add(urlsubmission.for_organization)
url.save()
except Exception as e:
log.error(e)
url.organization.add(urlsubmission.for_organization)
url.save()
# add some tracking data to the submission
urlsubmission.url_in_system = url
......
......@@ -59,13 +59,14 @@
<tr>
<th width="20%">Organization</th>
<th width="30%">Address</th>
<th width="10%">Acceptation</th>
<th width="20%">Added on</th>
<th width="5%">Acceptation</th>
<th width="10%">Added on</th>
<th width="15%">Search</th>
</tr>
</thead><tbody>
{% endifchanged %}
<tr style="background-color: {{ organization.added_by_team.color }};" title="Added by {{ organization.added_by_team.name }}">
<tr style="background-color: {{ organization.added_by_team.color }}33;" title="Added by {{ organization.added_by_team.name }}">
<td>{{ organization.organization_name }}</td>
<td>{{ organization.organization_address }}</td>
{% if organization.has_been_accepted %}
......@@ -76,6 +77,13 @@
<td style="color: gray;">pending</td>
{% endif %}
<td>{{ organization.added_on|naturaltime }}</td>
<td>
<a href="https://www.duckduckgo.com/?q={{ organization.organization_name }}" target="_blank">duckduckgo</a>,
<a href="https://www.google.com/search?q={{ organization.organization_name }}" target="_blank">google</a>
{% if contest.target_country == "NL" %}
<a href="https://www.kvk.nl/zoeken/?source=all&q={{ organization.organization_name }}" target="_blank">kvk</a>
{% endif %}
</td>
</tr>
{% empty %}
<tr><td colspan="7">-</td></tr>
......@@ -96,7 +104,7 @@
</tr>
{% endifchanged %}
<tr style="background-color: {{ url.added_by_team.color }};" title="Added by {{ url.added_by_team.name }}">
<tr style="background-color: {{ url.added_by_team.color }}33;" title="Added by {{ url.added_by_team.name }}">
<td>{{ url.url }} (try: <a href="http://{{ url.url }}" target="_blank">http</a>,
<a href="https://{{ url.url }}" target="_blank">https</a>)</td>
{% if url.has_been_accepted %}
......
......@@ -20,13 +20,14 @@
<tr>
<th width="20%">Organization</th>
<th width="30%">Address</th>
<th width="10%">Acceptation</th>
<th width="20%">Added on</th>
<th width="5%">Acceptation</th>
<th width="10%">Added on</th>
<th width="15%">Search</th>
</tr>
</thead><tbody>
{% endifchanged %}
<tr style="background-color: {{ organization.added_by_team.color }};" title="Added by {{ organization.added_by_team.name }}">
<tr style="background-color: {{ organization.added_by_team.color }}33;" title="Added by {{ organization.added_by_team.name }}">
<td>{{ organization.organization_name }}</td>
<td>{{ organization.organization_address }}</td>
{% if organization.has_been_accepted %}
......@@ -37,6 +38,13 @@
<td style="color: gray;">pending</td>
{% endif %}
<td>{{ organization.added_on|naturaltime }}</td>
<td>
<a href="https://www.duckduckgo.com/?q={{ organization.organization_name }}" target="_blank">duckduckgo</a>,
<a href="https://www.google.com/search?q={{ organization.organization_name }}" target="_blank">google</a>
{% if contest.target_country == "NL" %}
<a href="https://www.kvk.nl/zoeken/?source=all&q={{ organization.organization_name }}" target="_blank">kvk</a>
{% endif %}
</td>
</tr>
{% empty %}
<tr><td colspan="7">-</td></tr>
......
......@@ -24,7 +24,7 @@
</tr>
{% endifchanged %}
<tr style="background-color: {{ url.added_by_team.color }};" title="Added by {{ url.added_by_team.name }}">
<tr style="background-color: {{ url.added_by_team.color }}33;" title="Added by {{ url.added_by_team.name }}">
<td>{{ url.url }} (try: <a href="http://{{ url.url }}" target="_blank">http</a>,
<a href="https://{{ url.url }}" target="_blank">https</a>)</td>
{% if url.has_been_accepted %}
......
......@@ -180,8 +180,8 @@ class ConfigurationAdmin(SortableAdminMixin, ImportExportModelAdmin, admin.Model
list_display = ('country', 'organization_type', 'is_displayed', 'is_the_default_option', 'is_scanned',
'is_reported')
search_fields = (['country', 'organization_type', ])
list_filter = ('country', 'organization_type', 'is_displayed', 'is_the_default_option', 'is_scanned',)
fields = ('country', 'organization_type', 'is_displayed', 'is_the_default_option', 'is_scanned', )
list_filter = ('country', 'organization_type', 'is_displayed', 'is_the_default_option', 'is_scanned', 'is_reported')
fields = ('country', 'organization_type', 'is_displayed', 'is_the_default_option', 'is_scanned', 'is_reported')
actions = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment