Browse Source

fix: remove django-floppyforms

pull/3734/head
LeandroJatai 5 months ago
parent
commit
9dd6a21018
  1. 1
      requirements/requirements.txt
  2. 5
      sapl/parlamentares/forms.py
  3. 8
      sapl/settings.py
  4. 65
      sapl/templates/floppyforms/image_thumbnail.html
  5. 5
      sapl/utils.py
  6. 1
      setup.py

1
requirements/requirements.txt

@ -6,7 +6,6 @@ dj-database-url==0.5.0
django-braces==1.14.0 django-braces==1.14.0
django-crispy-forms==1.7.2 django-crispy-forms==1.7.2
django-contrib-postgres==0.0.1 django-contrib-postgres==0.0.1
django-floppyforms==1.8.0
django-extra-views==0.12.0 django-extra-views==0.12.0
django-model-utils==3.1.2 django-model-utils==3.1.2
django-extensions==2.1.4 django-extensions==2.1.4

5
sapl/parlamentares/forms.py

@ -13,7 +13,6 @@ from django.forms import ModelForm
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import django_filters import django_filters
from floppyforms.widgets import ClearableFileInput
from image_cropping.widgets import CropWidget, ImageCropWidget from image_cropping.widgets import CropWidget, ImageCropWidget
from sapl.base.models import Autor, TipoAutor from sapl.base.models import Autor, TipoAutor
@ -26,10 +25,6 @@ from .models import (Coligacao, ComposicaoColigacao, Filiacao, Frente, Legislatu
Mandato, Parlamentar, Partido, Votante, Bloco, FrenteParlamentar, BlocoMembro) Mandato, Parlamentar, Partido, Votante, Bloco, FrenteParlamentar, BlocoMembro)
class ImageThumbnailFileInput(ClearableFileInput):
template_name = 'floppyforms/image_thumbnail.html'
class CustomImageCropWidget(ImageCropWidget): class CustomImageCropWidget(ImageCropWidget):
""" """
Custom ImageCropWidget that doesn't show the initial value of the field. Custom ImageCropWidget that doesn't show the initial value of the field.

8
sapl/settings.py

@ -75,10 +75,11 @@ INSTALLED_APPS = (
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'django.forms',
'django_extensions', 'django_extensions',
'crispy_forms', 'crispy_forms',
'floppyforms',
'waffle', 'waffle',
@ -197,6 +198,8 @@ CACHES = {
ROOT_URLCONF = 'sapl.urls' ROOT_URLCONF = 'sapl.urls'
FORM_RENDERER = 'django.forms.renderers.TemplatesSetting'
TEMPLATES = [ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
@ -333,9 +336,6 @@ DAB_FIELD_RENDERER = \
CRISPY_TEMPLATE_PACK = 'bootstrap4' CRISPY_TEMPLATE_PACK = 'bootstrap4'
CRISPY_ALLOWED_TEMPLATE_PACKS = 'bootstrap4' CRISPY_ALLOWED_TEMPLATE_PACKS = 'bootstrap4'
CRISPY_FAIL_SILENTLY = not DEBUG CRISPY_FAIL_SILENTLY = not DEBUG
FLOPPY_FORMS_USE_GIS = False
FORM_RENDERER = 'django.forms.renderers.DjangoTemplates'
# suprime texto de ajuda default do django-filter # suprime texto de ajuda default do django-filter
FILTERS_HELP_TEXT_FILTER = False FILTERS_HELP_TEXT_FILTER = False

65
sapl/templates/floppyforms/image_thumbnail.html

@ -1,65 +0,0 @@
{% load i18n staticfiles thumbnail %}
{% load webpack_static from webpack_loader %}
<div id="div_{{ field.auto_id }}"
class="control-group
{% if form_show_errors %}
{% if field.errors %} error{% endif %}
{% endif %}
{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
{% if field.label %}
<label for="{{ field.id_for_label }}"
class="control-label
{{ label_class }}
{% if field.field.required %}
requiredField
{% endif %}">
{{ field.label|safe }}{% if field.field.required %}
<span class="asteriskField">*</span>{% endif %}
</label>
{% endif %}
<div class="controls {{ field_class }}">
<div class="fileupload fileupload-new"
data-provides="fileupload">
{% if value.url %}
<div class="row">
<div class="col-md-12">
<img src="{{ value.url }}"
height="300" width="300"
alt="{{ value }}" class="img-thumbnail"/>
</div>
</div>
<div class="row">
<div class="col-md-12">
<input type="checkbox"
name="{{ checkbox_name }}"
id="{{ checkbox_id }}" />
<label for="{{ checkbox_id }}">
{% trans "Clear" %}
</label>
</div>
</div>
{% else %}
<div class="row">
<div class="col-md-12">
<img src="{% webpack_static 'img/perfil.png' %}"
class="img-thumbnail"/>
</div>
</div>
{% endif %}
<div>
<br />
<div class="form-inline">
<input type="{{ type }}" name="{{ name }}"
{% if required %}required{% endif %}
class="filestyle"
data-icon="false"
data-classButton="btn btn-outline-primary"
data-classInput="form-control">
</div>
</div>
</div>
{% include 'bootstrap3/layout/help_text_and_errors.html' %}
</div>
</div>

5
sapl/utils.py

@ -31,14 +31,13 @@ from django.db import models
from django.db.models import Q from django.db.models import Q
from django.db.models.fields.related import ForeignKey from django.db.models.fields.related import ForeignKey
from django.forms import BaseForm from django.forms import BaseForm
from django.forms.widgets import SplitDateTimeWidget from django.forms.widgets import SplitDateTimeWidget, ClearableFileInput
from django.http.response import JsonResponse, HttpResponse from django.http.response import JsonResponse, HttpResponse
from django.utils import six, timezone from django.utils import six, timezone
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import django_filters import django_filters
from easy_thumbnails import source_generators from easy_thumbnails import source_generators
from floppyforms import ClearableFileInput
import magic import magic
import requests import requests
from unipath.path import Path from unipath.path import Path
@ -310,7 +309,7 @@ class SaplGenericRelation(GenericRelation):
class ImageThumbnailFileInput(ClearableFileInput): class ImageThumbnailFileInput(ClearableFileInput):
template_name = 'floppyforms/image_thumbnail.html' template_name = 'widgets/image_thumbnail.html'
class RangeWidgetOverride(forms.MultiWidget): class RangeWidgetOverride(forms.MultiWidget):

1
setup.py

@ -16,7 +16,6 @@ install_requires = [
'dj-database-url==0.5.0', 'dj-database-url==0.5.0',
'django-braces==1.9.0', 'django-braces==1.9.0',
'django-crispy-forms==1.7.2', 'django-crispy-forms==1.7.2',
'django-floppyforms==1.7.0',
'django-extra-views==0.12.0', 'django-extra-views==0.12.0',
'django-model-utils==3.1.2', 'django-model-utils==3.1.2',
'django-extensions==2.1.4', 'django-extensions==2.1.4',

Loading…
Cancel
Save