diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..e308575ae --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "DockerRun.DisableDockerrc": true +} \ No newline at end of file diff --git a/gettingstarted/settings.py b/gettingstarted/settings.py index 9ea552a0c..5b8babefa 100644 --- a/gettingstarted/settings.py +++ b/gettingstarted/settings.py @@ -25,9 +25,9 @@ SECRET_KEY = "CHANGE_ME!!!! (P.S. the SECRET_KEY environment variable will be used, if set, instead)." # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = False -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['*'] # Application definition diff --git a/gettingstarted/urls.py b/gettingstarted/urls.py index 13b759582..dc31e8561 100644 --- a/gettingstarted/urls.py +++ b/gettingstarted/urls.py @@ -1,4 +1,4 @@ -from django.urls import path, include +from django.urls import path from django.contrib import admin diff --git a/hello/admin.py b/hello/admin.py index 8c38f3f3d..682ed84d2 100644 --- a/hello/admin.py +++ b/hello/admin.py @@ -1,3 +1,7 @@ from django.contrib import admin - -# Register your models here. +from .models import Document +# Register your models here. + +@admin.register(Document) +class DocumentAdmin(admin.ModelAdmin): + list_display = ['email', 'document_id', 'document_utility'] \ No newline at end of file diff --git a/hello/forms.py b/hello/forms.py new file mode 100644 index 000000000..b5d8ba00d --- /dev/null +++ b/hello/forms.py @@ -0,0 +1,7 @@ +from django import forms +from .models import Document + +class DocumentForm(forms.ModelForm): + class Meta: + model = Document + fields = ('document_id', 'document_utility','email' ) \ No newline at end of file diff --git a/hello/migrations/0002_auto_20210705_1845.py b/hello/migrations/0002_auto_20210705_1845.py new file mode 100644 index 000000000..a98ef4845 --- /dev/null +++ b/hello/migrations/0002_auto_20210705_1845.py @@ -0,0 +1,27 @@ +# Generated by Django 2.2.12 on 2021-07-05 18:45 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('hello', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Document', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('description', models.CharField(blank=True, max_length=255)), + ('document', models.FileField(upload_to='documents/')), + ('uploaded_at', models.DateTimeField(auto_now_add=True)), + ], + ), + migrations.AlterField( + model_name='greeting', + name='when', + field=models.DateTimeField(auto_now_add=True, verbose_name='date created'), + ), + ] diff --git a/hello/migrations/0003_auto_20210705_2345.py b/hello/migrations/0003_auto_20210705_2345.py new file mode 100644 index 000000000..876f926c6 --- /dev/null +++ b/hello/migrations/0003_auto_20210705_2345.py @@ -0,0 +1,39 @@ +# Generated by Django 2.2.12 on 2021-07-05 23:45 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('hello', '0002_auto_20210705_1845'), + ] + + operations = [ + migrations.RemoveField( + model_name='document', + name='description', + ), + migrations.RemoveField( + model_name='document', + name='document', + ), + migrations.AddField( + model_name='document', + name='document_id', + field=models.FileField(default=1, upload_to='static/', verbose_name='Proof of identity'), + preserve_default=False, + ), + migrations.AddField( + model_name='document', + name='document_utility', + field=models.FileField(default=1, upload_to='static/', verbose_name='Proof of residence'), + preserve_default=False, + ), + migrations.AddField( + model_name='document', + name='email', + field=models.EmailField(default=1, max_length=254), + preserve_default=False, + ), + ] diff --git a/hello/models.py b/hello/models.py index 8229092ef..cea78c25d 100644 --- a/hello/models.py +++ b/hello/models.py @@ -3,3 +3,18 @@ # Create your models here. class Greeting(models.Model): when = models.DateTimeField("date created", auto_now_add=True) + + +class Document(models.Model): + document_id = models.FileField(upload_to='static/', verbose_name='Proof of identity') + document_utility = models.FileField(upload_to='static/', verbose_name='Proof of residence') + email = models.EmailField() + uploaded_at = models.DateTimeField(auto_now_add=True) + + def file_link(self): + if self.document_id: + return "download" % (self.document_id.url,) + else: + return "No attachment" + + file_link.allow_tags = True \ No newline at end of file diff --git a/hello/static/index.jpeg b/hello/static/index.jpeg new file mode 100644 index 000000000..949471f32 Binary files /dev/null and b/hello/static/index.jpeg differ diff --git a/hello/templates/base.html b/hello/templates/base.html index 97ec07386..fb2c2effa 100644 --- a/hello/templates/base.html +++ b/hello/templates/base.html @@ -1,7 +1,7 @@
-
-
- This is a sample Python application deployed to Heroku. It's a reasonably simple app - but a good foundation for understanding how to get the most out of the Heroku platform.
- Getting Started with Python - Source on GitHub +A proof of identity can be your passport, national ID or driving license.
+A proof of residence can be any recent utility bill in your name.
+ + +git clone https://github.com/heroku/python-getting-started.git - this will create a local copy of the source code for the appcd python-getting-started - change directory into the local source code repositoryheroku git:remote -a <your-app-name> - associate the Heroku app with the repository