Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add material Design #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# macOS files and folders
**/.DS_Store

# PyCharm
.idea
3 changes: 1 addition & 2 deletions .idea/Restaurant_Recommendation_System.iml

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

2 changes: 1 addition & 1 deletion .idea/misc.xml

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

436 changes: 296 additions & 140 deletions .idea/workspace.xml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Restaurant_Recommendation_System/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@

INSTALLED_APPS = [
'restaurant.apps.RestaurantConfig',
'material',
'material.frontend',
'material.admin',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
Expand Down
5 changes: 2 additions & 3 deletions Restaurant_Recommendation_System/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from django.conf.urls import include, url
from django.contrib import admin
from material.frontend import urls as frontend_urls

urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^restaurant/', include('restaurant.urls')),
url(r'', include(frontend_urls)),
]

Binary file modified db.sqlite3
Binary file not shown.
22 changes: 20 additions & 2 deletions restaurant/forms.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
from django import forms
from django.contrib.auth.models import User
from material import Layout, Row, Fieldset

from .models import Restaurant

class CustomerForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput)

class Meta:
model = User
fields = ['username', 'email', 'password']
fields = ['username', 'email', 'password']


class RegistrationForm(forms.Form):
username = forms.CharField()
email = forms.EmailField(label="Email Address")
password = forms.CharField(widget=forms.PasswordInput)
password_confirm = forms.CharField(widget=forms.PasswordInput, label="Confirm password")
first_name = forms.CharField(required=False)
last_name = forms.CharField(required=False)
gender = forms.ChoiceField(choices=((None, ''), ('F', 'Female'), ('M', 'Male'), ('O', 'Other')))
receive_news = forms.BooleanField(required=False, label='I want to receive news and special offers')
agree_toc = forms.BooleanField(required=True, label='I agree with the Terms and Conditions')

layout = Layout('username', 'email',
Row('password', 'password_confirm'),
Fieldset('Personal details',
Row('first_name', 'last_name'),
'gender', 'receive_news', 'agree_toc'))
14 changes: 12 additions & 2 deletions restaurant/templates/restaurant/CustomerRegistration.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<title>Customer Registration</title>
{% include 'material/includes/material_css.html' %}
{% load static %}
<script src="{% static 'material/js/jquery-2.2.0.js' %}"></script>
{% include 'material/includes/material_js.html' %}
{% load material_form %}

</head>
<body>
<h1> Hey!!! Finally I worked!!<h1>
<form method="POST">{% csrf_token %}

{% form form=form %} {% endform %}
<button type="submit" name="_submit" class="btn btn-primary btn-lg">Submit</button>
</form>

</body>
</html>
8 changes: 6 additions & 2 deletions restaurant/templates/restaurant/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
<html lang="en">
<head>
<meta charset="UTF-8">
{% include 'material/includes/material_css.html' %}
{% load static %}
<script src="{% static 'material/js/jquery-2.2.0.js' %}"></script>
{% include 'material/includes/material_js.html' %}

</head>
<body>
{% for obj in allRestaurant %}
<h1> {{obj.name}} <h1>
<h1> {{ obj.name }} </h1>
<p>Address: {{obj.full_address}} <br>
City: {{obj.city}} <br>
No of reviews: {{obj.review_count}} <br>
Expand All @@ -15,7 +19,7 @@ <h1> {{obj.name}} <h1>
Take Reservations:{{obj.Take_Reservations}}<br>
Delivery:{{obj.Delivery}} <br>
TV: {{obj.Has_TV}} <br>
Outdoor Seating: {{obj.Outdoor_Seating}} <br>
Outdoor Seating: {{ obj.Outdoor_Seating }}<br>
Attire: {{obj.Attire}} <br>
Alcohol: {{obj.Alcohol}} <br>
Water Service: {{obj.Water_service}} <br>
Expand Down
6 changes: 5 additions & 1 deletion restaurant/templates/restaurant/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
<head>
<meta charset="UTF-8">
<title>This is my home page</title>
{% include 'material/includes/material_css.html' %}
{% load static %}
<script src="{% static 'material/js/jquery-2.2.0.js' %}"></script>
{% include 'material/includes/material_js.html' %}
</head>
<body background="http://finedinelove.com/wp-content/uploads/2015/10/dine.jpg">
<body>
<h1> This is my home page</h1>
<ul>
{% for Restaurant in allRestaurant %}
Expand Down
9 changes: 4 additions & 5 deletions restaurant/urls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
from django.conf.urls import url

from . import views

app_name = 'restaurant'

urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^(?P<Restaurant_id>[0-9]+)/$', views.detail,name='detail'),
url(r'^CustomerRegister/$', views.CustomerRegister, name='CustomerRegister')
]
url(r'^CustomerRegister/$', views.CustomerRegister, name='CustomerRegister'),
]
11 changes: 6 additions & 5 deletions restaurant/views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from .models import Restaurant
from django .template import loader
from django.shortcuts import render, get_object_or_404,redirect
from django.contrib.auth import authenticate, login
from .forms import CustomerForm
from django.shortcuts import render
from django.template import loader

from .forms import RegistrationForm
from .models import Restaurant


def index(request):
Expand All @@ -23,7 +24,7 @@ def detail(request,Restaurant_id):
return render(request,'restaurant/details.html',context)

def CustomerRegister(request):
form = CustomerForm(request.POST or None)
form = RegistrationForm(request.POST or None)
if form.is_valid():
user = form.save(commit=False)
username = form.cleaned_data['username']
Expand Down