Skip to content

Commit

Permalink
Add ID photo upload
Browse files Browse the repository at this point in the history
  • Loading branch information
txels committed Feb 27, 2024
1 parent cc0feea commit 98caa0b
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ ship_*/

/static/
!.gitkeep
/media/

local_settings.py

Expand Down
2 changes: 2 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ pytz = "==2020.1"
django-crispy-forms = "*"
django = "==3.2"
crispy-bootstrap4 = "==2022.1"
pillow = "*"

[dev-packages]
wheel = "*"
Fabric3 = "*"
flake8 = "*"
ipdb = "*"
83 changes: 79 additions & 4 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 22 additions & 19 deletions locale/ca/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-26 18:37+0000\n"
"POT-Creation-Date: 2024-02-27 14:57+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -91,35 +91,39 @@ msgstr ""
msgid "Contact"
msgstr "Contacte"

#: shipanaro/admin.py:116 shipanaro/models.py:70
#: shipanaro/admin.py:116 shipanaro/models.py:71
msgid "Address"
msgstr "Adreça"

#: shipanaro/admin.py:129
msgid "Status"
msgstr "Estat"

#: shipanaro/admin.py:138 shipanaro/models.py:95
#: shipanaro/admin.py:138 shipanaro/models.py:96
msgid "Notes"
msgstr "Notes"

#: shipanaro/admin.py:141
msgid "Legacy"
msgstr "Històric"

#: shipanaro/auth/forms.py:66
#: shipanaro/auth/forms.py:81
msgid "first name"
msgstr ""

#: shipanaro/auth/forms.py:67
#: shipanaro/auth/forms.py:82
msgid "last name"
msgstr ""

#: shipanaro/auth/forms.py:101
#: shipanaro/auth/forms.py:151 shipanaro/templates/registration/profile.html:13
msgid "Submit"
msgstr "Enviar"

#: shipanaro/auth/forms.py:164
msgid "Your old password was entered incorrectly. Please enter it again."
msgstr "La teva contrasenya antiga no és correcta. Torna-la a introduir."

#: shipanaro/auth/forms.py:105
#: shipanaro/auth/forms.py:168
msgid "Old password"
msgstr "Contrasenya antiga"

Expand Down Expand Up @@ -233,36 +237,35 @@ msgstr "Número d'identificació"
msgid "ID Type"
msgstr "Tipus d'identificació"

#: shipanaro/models.py:74
#: shipanaro/models.py:69
msgid "ID Photo"
msgstr "Fotografia del document d'identificació"

#: shipanaro/models.py:75
msgid "City"
msgstr "Municipi"

#: shipanaro/models.py:78
#: shipanaro/models.py:79
msgid "Postcode"
msgstr "Codi Postal"

#: shipanaro/models.py:82
#: shipanaro/models.py:83
msgid "Province"
msgstr "Província"

#: shipanaro/models.py:86
#: shipanaro/models.py:87
msgid "Phone"
msgstr "Telèfon"

#: shipanaro/models.py:90
#: shipanaro/models.py:91
msgid "Phone 2"
msgstr "Telèfon 2"

#: shipanaro/models.py:123
#: shipanaro/models.py:124
msgid "Newsletter"
msgstr "Butlletí"

#: shipanaro/templates/registration/join.html:15
#: shipanaro/templates/registration/profile.html:13
msgid "Submit"
msgstr "Enviar"

#: shipanaro/templates/registration/join.html:20
#: shipanaro/templates/registration/join.html:14
#: shipanaro/templates/registration/profile.html:18
#: shipanaro/templates/shipanaro/membership_submitted.html:13
msgid "Cancel membership"
Expand Down
1 change: 1 addition & 0 deletions shipanaro/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class MembershipAdmin(ShipanaroModelAdmin):
(
"nid_type",
"nid",
"id_photo",
),
(
"assigned_sex",
Expand Down
2 changes: 2 additions & 0 deletions shipanaro/auth/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class Meta:
"nationality",
"nid_type",
"nid",
"id_photo",
"address",
"city",
"postal_code",
Expand Down Expand Up @@ -128,6 +129,7 @@ def __init__(self, *args, **kwargs):
Column("nid", css_class="form-group col-md-6 mb-0"),
css_class="form-row",
),
"id_photo",
HTML("<h4>Domicili</h4>"),
"address",
Row(
Expand Down
33 changes: 33 additions & 0 deletions shipanaro/migrations/0015_auto_20240227_1506.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 3.2 on 2024-02-27 15:06

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('shipanaro', '0014_auto_20240225_1127'),
]

operations = [
migrations.AddField(
model_name='membership',
name='id_photo',
field=models.ImageField(null=True, upload_to='id_photos', verbose_name="Fotografia del document d'identificació"),
),
migrations.AlterField(
model_name='membership',
name='city',
field=models.CharField(max_length=70, verbose_name='Municipi'),
),
migrations.AlterField(
model_name='membership',
name='nid',
field=models.CharField(max_length=50, verbose_name="Número d'identificació"),
),
migrations.AlterField(
model_name='membership',
name='nid_type',
field=models.IntegerField(choices=[(7240, 'Passaport'), (7241, 'DNI'), (7242, 'NIE'), (0, 'Desconegut')], verbose_name="Tipus d'identificació"),
),
]
5 changes: 5 additions & 0 deletions shipanaro/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ class Membership(models.Model):
verbose_name=_("ID Type"),
choices=NIDS,
)
id_photo = models.ImageField(
upload_to="id_photos",
verbose_name=_("ID Photo"),
null=True,
)
address = models.CharField(
verbose_name=_("Address"),
max_length=140,
Expand Down
5 changes: 4 additions & 1 deletion shipanaro/settings_django.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"default": env.dj_db_url("SHIPANARO_DATABASE_URL", default="sqlite://db.sqlite")
}

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"

AUTHENTICATION_BACKENDS = [
"django_auth_ldap.backend.LDAPBackend",
Expand Down Expand Up @@ -138,6 +138,9 @@
STATIC_ROOT = os.path.join(BASE_DIR, "static")
STATIC_URL = "/static/"

MEDIA_ROOT = os.path.join(BASE_DIR, "media")


EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
# TODO: prod settings? is this used? the package django-ses in not in Pipfile
# EMAIL_BACKEND = 'django_ses.SESBackend'
Expand Down
3 changes: 0 additions & 3 deletions shipanaro/templates/registration/join.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
<div class="col-lg-9">
<h2>{% trans 'Join the Party' %}</h2>
<p class="lead">Omple el formulari si vols donar-te d'alta com a afiliat</p>
<form method="post" class="mt-4">
{% csrf_token %}
{% crispy form %}
</form>
</div>
<!--div id="profile-actions" class="col-lg-3 mb-4 pt-3 bg-light">
<button type="submit" class="btn btn-danger">{% trans 'Cancel membership' %}</button>
Expand Down

0 comments on commit 98caa0b

Please sign in to comment.