-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #125 from fsinfuhh/gprot_hash_blocking
Add functionality to block gprots based on their hash
- Loading branch information
Showing
8 changed files
with
204 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Generated by Django 4.1 on 2023-07-27 17:43 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
("gprot", "0005_alter_favorite_url"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="BlockedGprots", | ||
fields=[ | ||
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), | ||
("pdf_hash", models.CharField(max_length=64)), | ||
("gprot_title", models.CharField(max_length=100)), | ||
( | ||
"blocked_by", | ||
models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), | ||
), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
mafiasi/gprot/templates/admin/gprot/gprot/change_form.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{% extends "admin/change_form.html" %} | ||
{% load i18n %} | ||
{% block extrastyle %}{{ block.super }} | ||
<style> | ||
.block { | ||
padding: 12px 14px 7px; | ||
margin: 0 0 20px; | ||
background: var(--darkened-bg); | ||
border: 1px solid var(--hairline-color); | ||
border-radius: 4px; | ||
text-align: right; | ||
overflow: hidden; | ||
} | ||
|
||
.block > p { | ||
margin: 10px 7px; | ||
} | ||
.block > a { | ||
float: left; | ||
background: var(--delete-button-bg); | ||
border-radius: 4px; | ||
height: 15px; | ||
line-height: 15px; | ||
margin-bottom: 5px; | ||
color: var(--button-fg); | ||
padding: 10px 7px; | ||
display: block; | ||
} | ||
</style> | ||
{% endblock %} | ||
{% block after_related_objects %} | ||
<div class="block"> | ||
<a href="{% url 'admin:gprot_block' object_id %}">{% translate 'Block this Gprot' %}</a> | ||
<p>{% blocktranslate %}When a Gprot is blocked, a hash is saved that ensures that the same file cannot be uploaded again.{% endblocktranslate %}</p> | ||
</div> | ||
<div style="clear: left;"></div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters