diff --git a/.gitignore b/.gitignore index d8a75d7..1b4adab 100644 --- a/.gitignore +++ b/.gitignore @@ -109,3 +109,4 @@ GitHub.sublime-settings !.vscode/launch.json !.vscode/extensions.json .history +/nuitdelinfo_2021/settings.py diff --git a/error/migrations/0001_initial.py b/error/migrations/0001_initial.py new file mode 100644 index 0000000..bcf7dc6 --- /dev/null +++ b/error/migrations/0001_initial.py @@ -0,0 +1,21 @@ +# Generated by Django 3.2.9 on 2021-12-02 20:32 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='ThomasPesquetQuotes', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('text', models.TextField()), + ], + ), + ] diff --git a/nuitdelinfo_2021/settings.py b/nuitdelinfo_2021/settings.py.exemple similarity index 95% rename from nuitdelinfo_2021/settings.py rename to nuitdelinfo_2021/settings.py.exemple index 2f0b5f7..d7af9dc 100644 --- a/nuitdelinfo_2021/settings.py +++ b/nuitdelinfo_2021/settings.py.exemple @@ -135,3 +135,12 @@ STATICFILES_DIRS = (path.join('static'),) # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +ACCOUNT_ACTIVATION_DAYS = 7 +LOGIN_REDIRECT_URL = '/' + +EMAIL_USE_TLS = True +EMAIL_HOST = 'smtp.gmail.com' +EMAIL_PORT = 587 +EMAIL_HOST_USER = 'me@gmail.com' +EMAIL_HOST_PASSWORD = 'password' diff --git a/nuitdelinfo_2021/urls.py b/nuitdelinfo_2021/urls.py index 72a97e6..6286e2e 100644 --- a/nuitdelinfo_2021/urls.py +++ b/nuitdelinfo_2021/urls.py @@ -23,6 +23,8 @@ urlpatterns = [ path("a/", include("rescue.urls")), path("p/", include("people.urls")), path('admin/', admin.site.urls), + path('accounts/', include('django_registration.backends.activation.urls')), + path('accounts/', include('django.contrib.auth.urls')) ] handler400 = "error.views.index" diff --git a/people/migrations/0001_initial.py b/people/migrations/0001_initial.py new file mode 100644 index 0000000..08d66ae --- /dev/null +++ b/people/migrations/0001_initial.py @@ -0,0 +1,32 @@ +# Generated by Django 3.2.9 on 2021-12-02 20:32 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='People', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('first_name', models.CharField(max_length=40)), + ('last_name', models.CharField(max_length=60)), + ('title', models.CharField(max_length=70)), + ('description', models.TextField()), + ('birth', models.DateField()), + ('death', models.DateField()), + ('history', models.TextField()), + ('genealogy', models.TextField()), + ('awards', models.TextField()), + ('pro_life', models.TextField()), + ('testimonials', models.TextField()), + ('sources', models.TextField()), + ], + ), + ] diff --git a/people/migrations/0002_auto_20211202_2127.py b/people/migrations/0002_auto_20211202_2127.py new file mode 100644 index 0000000..769f649 --- /dev/null +++ b/people/migrations/0002_auto_20211202_2127.py @@ -0,0 +1,59 @@ +# Generated by Django 3.2.9 on 2021-12-02 21:27 + +from django.db import migrations, models +import django_quill.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('people', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='people', + name='awards', + field=django_quill.fields.QuillField(null=True), + ), + migrations.AlterField( + model_name='people', + name='death', + field=models.DateField(null=True), + ), + migrations.AlterField( + model_name='people', + name='description', + field=django_quill.fields.QuillField(), + ), + migrations.AlterField( + model_name='people', + name='genealogy', + field=django_quill.fields.QuillField(null=True), + ), + migrations.AlterField( + model_name='people', + name='history', + field=django_quill.fields.QuillField(null=True), + ), + migrations.AlterField( + model_name='people', + name='pro_life', + field=django_quill.fields.QuillField(null=True), + ), + migrations.AlterField( + model_name='people', + name='sources', + field=django_quill.fields.QuillField(), + ), + migrations.AlterField( + model_name='people', + name='testimonials', + field=django_quill.fields.QuillField(null=True), + ), + migrations.AlterField( + model_name='people', + name='title', + field=models.CharField(max_length=70, null=True), + ), + ] diff --git a/people/migrations/0003_auto_20211202_2225.py b/people/migrations/0003_auto_20211202_2225.py new file mode 100644 index 0000000..df83a80 --- /dev/null +++ b/people/migrations/0003_auto_20211202_2225.py @@ -0,0 +1,60 @@ +# Generated by Django 3.2.9 on 2021-12-02 22:25 + +from django.db import migrations, models +import django.db.models.deletion +import django_quill.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('people', '0002_auto_20211202_2127'), + ] + + operations = [ + migrations.AddField( + model_name='people', + name='pending_edit_of', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='people.people'), + ), + migrations.AddField( + model_name='people', + name='validated', + field=models.BooleanField(default=False), + ), + migrations.AlterField( + model_name='people', + name='awards', + field=django_quill.fields.QuillField(blank=True, null=True), + ), + migrations.AlterField( + model_name='people', + name='death', + field=models.DateField(blank=True, null=True), + ), + migrations.AlterField( + model_name='people', + name='genealogy', + field=django_quill.fields.QuillField(blank=True, null=True), + ), + migrations.AlterField( + model_name='people', + name='history', + field=django_quill.fields.QuillField(blank=True, null=True), + ), + migrations.AlterField( + model_name='people', + name='pro_life', + field=django_quill.fields.QuillField(blank=True, null=True), + ), + migrations.AlterField( + model_name='people', + name='testimonials', + field=django_quill.fields.QuillField(blank=True, null=True), + ), + migrations.AlterField( + model_name='people', + name='title', + field=models.CharField(blank=True, max_length=70, null=True), + ), + ] diff --git a/rescue/migrations/0001_initial.py b/rescue/migrations/0001_initial.py new file mode 100644 index 0000000..33f5c92 --- /dev/null +++ b/rescue/migrations/0001_initial.py @@ -0,0 +1,30 @@ +# Generated by Django 3.2.9 on 2021-12-02 20:32 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('people', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Rescue', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=70)), + ('date', models.DateField()), + ('location_long', models.DecimalField(decimal_places=6, max_digits=9)), + ('location_lat', models.DecimalField(decimal_places=6, max_digits=9)), + ('resume', models.CharField(max_length=125)), + ('description', models.TextField()), + ('sources', models.TextField()), + ('rescuers', models.ManyToManyField(related_name='rescued', to='people.People')), + ('saved', models.ManyToManyField(related_name='saved', to='people.People')), + ], + ), + ] diff --git a/rescue/migrations/0002_auto_20211202_2301.py b/rescue/migrations/0002_auto_20211202_2301.py new file mode 100644 index 0000000..305323d --- /dev/null +++ b/rescue/migrations/0002_auto_20211202_2301.py @@ -0,0 +1,24 @@ +# Generated by Django 3.2.9 on 2021-12-02 23:01 + +from django.db import migrations +import django_quill.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('rescue', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='rescue', + name='description', + field=django_quill.fields.QuillField(), + ), + migrations.AlterField( + model_name='rescue', + name='sources', + field=django_quill.fields.QuillField(), + ), + ] diff --git a/templates/django_registration/activation_complete.html b/templates/django_registration/activation_complete.html new file mode 100644 index 0000000..ee8b351 --- /dev/null +++ b/templates/django_registration/activation_complete.html @@ -0,0 +1 @@ +Activation complete :/ diff --git a/templates/django_registration/activation_email_body.txt b/templates/django_registration/activation_email_body.txt new file mode 100644 index 0000000..9016fa4 --- /dev/null +++ b/templates/django_registration/activation_email_body.txt @@ -0,0 +1,2 @@ +activation URL: {{site}}/accounts/activate/{{ activation_key }}/ +The number of days remaining during which the account may be activated: {{ expiration_days }} diff --git a/templates/django_registration/activation_email_subject.txt b/templates/django_registration/activation_email_subject.txt new file mode 100644 index 0000000..37320af --- /dev/null +++ b/templates/django_registration/activation_email_subject.txt @@ -0,0 +1 @@ +Activation email for {{ user }} \ No newline at end of file diff --git a/templates/django_registration/activation_failed.html b/templates/django_registration/activation_failed.html new file mode 100644 index 0000000..ccf3414 --- /dev/null +++ b/templates/django_registration/activation_failed.html @@ -0,0 +1 @@ +Activation failed :/ \ No newline at end of file diff --git a/templates/django_registration/registration_closed.html b/templates/django_registration/registration_closed.html new file mode 100644 index 0000000..d12f288 --- /dev/null +++ b/templates/django_registration/registration_closed.html @@ -0,0 +1 @@ +Registration closed :/ \ No newline at end of file diff --git a/templates/django_registration/registration_complete.html b/templates/django_registration/registration_complete.html new file mode 100644 index 0000000..2f6fb3c --- /dev/null +++ b/templates/django_registration/registration_complete.html @@ -0,0 +1 @@ +Registration complete ! \ No newline at end of file diff --git a/templates/django_registration/registration_form.html b/templates/django_registration/registration_form.html new file mode 100644 index 0000000..19e304b --- /dev/null +++ b/templates/django_registration/registration_form.html @@ -0,0 +1,5 @@ +
+ {% csrf_token %} + {{ form }} + +
diff --git a/templates/registration/logged_out.html b/templates/registration/logged_out.html new file mode 100644 index 0000000..61badb0 --- /dev/null +++ b/templates/registration/logged_out.html @@ -0,0 +1,4 @@ +{% block content %} +

Logged out!

+ Click here to login again. +{% endblock %} diff --git a/templates/registration/login.html b/templates/registration/login.html new file mode 100644 index 0000000..73fd22d --- /dev/null +++ b/templates/registration/login.html @@ -0,0 +1,37 @@ +{% block content %} + + {% if form.errors %} +

Your username and password didn't match. Please try again.

+ {% endif %} + + {% if next %} + {% if user.is_authenticated %} +

Your account doesn't have access to this page. To proceed, + please login with an account that has access.

+ {% else %} +

Please login to see this page.

+ {% endif %} + {% endif %} + +
+ {% csrf_token %} + + + + + + + + + +
{{ form.username.label_tag }}{{ form.username }}
{{ form.password.label_tag }}{{ form.password }}
+ + +
+ + {# Assumes you setup the password_reset view in your URLconf #} +

Lost password?

+ +

Register

+ +{% endblock %} diff --git a/templates/registration/password_reset_complete.html b/templates/registration/password_reset_complete.html new file mode 100644 index 0000000..5581a6f --- /dev/null +++ b/templates/registration/password_reset_complete.html @@ -0,0 +1,4 @@ +{% block content %} +

The password has been changed!

+

log in again?

+{% endblock %} diff --git a/templates/registration/password_reset_confirm.html b/templates/registration/password_reset_confirm.html new file mode 100644 index 0000000..968951d --- /dev/null +++ b/templates/registration/password_reset_confirm.html @@ -0,0 +1,27 @@ +{% block content %} + {% if validlink %} +

Please enter (and confirm) your new password.

+
+ {% csrf_token %} + + + + + + + + + + + + + +
{{ form.new_password1.errors }} + {{ form.new_password1 }}
{{ form.new_password2.errors }} + {{ form.new_password2 }}
+
+ {% else %} +

Password reset failed

+

The password reset link was invalid, possibly because it has already been used. Please request a new password reset.

+ {% endif %} +{% endblock %} diff --git a/templates/registration/password_reset_done.html b/templates/registration/password_reset_done.html new file mode 100644 index 0000000..db44131 --- /dev/null +++ b/templates/registration/password_reset_done.html @@ -0,0 +1,3 @@ +{% block content %} +

We've emailed you instructions for setting your password. If they haven't arrived in a few minutes, check your spam folder.

+{% endblock %} diff --git a/templates/registration/password_reset_email.html b/templates/registration/password_reset_email.html new file mode 100644 index 0000000..37467b8 --- /dev/null +++ b/templates/registration/password_reset_email.html @@ -0,0 +1,2 @@ +Someone asked for password reset for email {{ email }}. Follow the link below: +{{ protocol}}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %} diff --git a/templates/registration/password_reset_form.html b/templates/registration/password_reset_form.html new file mode 100644 index 0000000..6ff122f --- /dev/null +++ b/templates/registration/password_reset_form.html @@ -0,0 +1,10 @@ +{% block content %} +
+ {% csrf_token %} + {% if form.email.errors %} + {{ form.email.errors }} + {% endif %} +

{{ form.email }}

+ +
+{% endblock %}