diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e7ed556 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.py[co] +.idea/ +*/settings.py +db.sqlite3 diff --git a/README b/README new file mode 100644 index 0000000..24069ff --- /dev/null +++ b/README @@ -0,0 +1,12 @@ +Rice Bikes Processing App +========================= + +This site is built for use by the employees of Rice Bikes, the student- +run bike shop at Rice University. + +Users can enter the information of a customer, including email address. +When the order is submitted, the customer will receive an email from +the bike shop confirming they have been processed. When the job is +finished, the emloyees can update the status to completed, and the +customer will receive an email notifying them that they can come in +and pick up their bike. diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/admin.py b/app/admin.py new file mode 100644 index 0000000..a5405b4 --- /dev/null +++ b/app/admin.py @@ -0,0 +1,4 @@ +from django.contrib import admin +from app.models import Customer + +admin.site.register(Customer) \ No newline at end of file diff --git a/app/forms.py b/app/forms.py new file mode 100644 index 0000000..f6e96ff --- /dev/null +++ b/app/forms.py @@ -0,0 +1,8 @@ +from django.forms import ModelForm +from app.models import Customer + + +class CustomerForm(ModelForm): + class Meta: + model = Customer + fields = ['first_name', 'last_name', 'email', 'service_description','completed', 'date_submitted'] \ No newline at end of file diff --git a/app/migrations/0001_initial.py b/app/migrations/0001_initial.py new file mode 100644 index 0000000..a52fa43 --- /dev/null +++ b/app/migrations/0001_initial.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import app.models + + +class Migration(migrations.Migration): + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Customer', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('first_name', models.CharField(max_length=100)), + ('last_name', models.CharField(max_length=100)), + ('email', models.CharField(max_length=100, validators=[app.models.validate_email])), + ('service_description', models.CharField(max_length=500)), + ('price', models.IntegerField(default=0)), + ('completed', models.BooleanField(default=False)), + ('date_submitted', models.DateTimeField(verbose_name=b'date submitted')), + ], + options={ + }, + bases=(models.Model,), + ), + ] diff --git a/app/migrations/0002_auto_20150106_2223.py b/app/migrations/0002_auto_20150106_2223.py new file mode 100644 index 0000000..965481d --- /dev/null +++ b/app/migrations/0002_auto_20150106_2223.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('app', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='customer', + name='date_submitted', + field=models.DateTimeField(verbose_name='date submitted'), + preserve_default=True, + ), + ] diff --git a/app/migrations/__init__.py b/app/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/models.py b/app/models.py new file mode 100644 index 0000000..543b7de --- /dev/null +++ b/app/models.py @@ -0,0 +1,22 @@ +from django.db import models +from django.core.exceptions import ValidationError +import re + + +def validate_email(email_string): + possible_match = re.match(r'[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}', email_string) + if possible_match is None: + raise ValidationError(u'%s is not a valid email address' % email_string) + + +class Customer(models.Model): + first_name = models.CharField(max_length=100) + last_name = models.CharField(max_length=100) + email = models.CharField(max_length=100, validators=[validate_email]) + service_description = models.CharField(max_length=500) + price = models.IntegerField(default=0) + completed = models.BooleanField(default=False) + date_submitted = models.DateTimeField('date submitted') + + def __str__(self): + return self.first_name + " " + self.last_name \ No newline at end of file diff --git a/app/templates/app/detail.html b/app/templates/app/detail.html new file mode 100644 index 0000000..eb1d2c5 --- /dev/null +++ b/app/templates/app/detail.html @@ -0,0 +1,7 @@ +{% if error_message %}
{{ error_message }}
{% endif %} + + \ No newline at end of file diff --git a/app/templates/app/index.html b/app/templates/app/index.html new file mode 100644 index 0000000..6f67ca6 --- /dev/null +++ b/app/templates/app/index.html @@ -0,0 +1,19 @@ +{% if customers_list %} +