Skip to content

Commit

Permalink
Django website [ Fixes #1 ] (#106)
Browse files Browse the repository at this point in the history
* Add files via upload

* Django website

* Template of Website

* Added virtualization for Child Labour Data

* Deleted junk files
  • Loading branch information
nightwarriorftw authored and tapaswenipathak committed Jul 29, 2019
1 parent d6f2c2a commit b0a2112
Show file tree
Hide file tree
Showing 603 changed files with 83,718 additions and 0 deletions.
1 change: 1 addition & 0 deletions SieveWeb/SieveWeb/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
db.sqlite3
2 changes: 2 additions & 0 deletions SieveWeb/SieveWeb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Django Website
This is sample django website
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions SieveWeb/SieveWeb/SieveApp/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from django.contrib import admin
from .models import ContactFormModel

admin.site.register(ContactFormModel)
5 changes: 5 additions & 0 deletions SieveWeb/SieveWeb/SieveApp/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class SieveappConfig(AppConfig):
name = 'SieveApp'
24 changes: 24 additions & 0 deletions SieveWeb/SieveWeb/SieveApp/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from django import forms

class ContactForm(forms.Form):
name = forms.CharField(widget= forms.TextInput(attrs =
{
"class": "form-control",
"placeholder": "Name"
}
)
)
email = forms.EmailField(widget = forms.EmailInput(attrs =
{
"class": "form-control",
"placeholder": "Email"
}
)
)
message = forms.CharField(widget = forms.Textarea(attrs =
{
"class": "form-control",
"placeholder": "Message"
}
)
)
23 changes: 23 additions & 0 deletions SieveWeb/SieveWeb/SieveApp/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 2.2.3 on 2019-07-14 17:30

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='ContactFormModel',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=250)),
('email', models.EmailField(max_length=254)),
('message', models.TextField()),
],
),
]
Empty file.
Binary file not shown.
Binary file not shown.
9 changes: 9 additions & 0 deletions SieveWeb/SieveWeb/SieveApp/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.db import models

class ContactFormModel(models.Model):
name = models.CharField(max_length=250)
email = models.EmailField()
message = models.TextField()

def __str__(self):
return self.name
67 changes: 67 additions & 0 deletions SieveWeb/SieveWeb/SieveApp/templates/contact/contact.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{% extends 'base/base.html' %}
{% load static %}

{% block content %}
<!-- ================ contact section start ================= -->
<div class="spacing">
<section class="contact-section section_padding">
<div class="container">
<div class="row">
<div class="col-12">
<h2 class="contact-title">Get in Touch</h2>
</div>
<div class="col-lg-8">
<form class="form-contact contact_form" method="POST" id="contactForm">
{% csrf_token %}
<div class="row">
<div class="col-12">
<div class="form-group">
{{ form.message }}
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
{{ form.name }}
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
{{ form.email }}
</div>
</div>
<div class="col-12">
</div>
</div>
<div class="form-group mt-3">
<button type="submit" class="button button-contactForm btn_1">Send Message</button>
</div>
</form>
</div>
<div class="col-lg-4">
<div class="media contact-info">
<span class="contact-info__icon"><i class="ti-home"></i></span>
<div class="media-body">
<h3>India</h3>
</div>
</div>
<div class="media contact-info">
<span class="contact-info__icon"><i class="ti-tablet"></i></span>
<div class="media-body">
<h3>+91 xxxxxxxxxx</h3>
<p>Mon to Fri 9am to 6pm</p>
</div>
</div>
<div class="media contact-info">
<span class="contact-info__icon"><i class="ti-email"></i></span>
<div class="media-body">
<h3>[email protected]</h3>
<p>Send us your query anytime!</p>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- ================ contact section end ================= -->
{% endblock %}
16 changes: 16 additions & 0 deletions SieveWeb/SieveWeb/SieveApp/templates/contact/contact__.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% extends 'base/base.html'%}

{% block content %}
<div class="container">
<form action='' method="POST">
{% csrf_token %}
{{form.name}}
<br>
{{form.email}}
<br>
{{form.message}}
<br>
<button type="submit" class="btn btn-danger">Submit</button>
</form>
</div>
{% endblock %}
3 changes: 3 additions & 0 deletions SieveWeb/SieveWeb/SieveApp/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
8 changes: 8 additions & 0 deletions SieveWeb/SieveWeb/SieveApp/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.conf.urls import url
from django.shortcuts import render
from .views import contact_page

app_name = "SieveApp"
urlpatterns = [
url(r'^$', contact_page, name='contact'),
]
18 changes: 18 additions & 0 deletions SieveWeb/SieveWeb/SieveApp/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from django.shortcuts import render, redirect
from .models import ContactFormModel
from .forms import ContactForm

def contact_page(request):
form = ContactForm(request.POST or None)

if form.is_valid():
obj = ContactFormModel()
obj.name = form.cleaned_data.get('name')
obj.email = form.cleaned_data.get('email')
obj.message = form.cleaned_data.get('message')
obj.save()
return redirect('/')
context = {
"form": form
}
return render(request,'contact/contact.html', context)
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
131 changes: 131 additions & 0 deletions SieveWeb/SieveWeb/SieveWeb/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
"""
Django settings for SieveWeb project.
Generated by 'django-admin startproject' using Django 2.2.3.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'cgwv_xhha7lofxa79_d0(^tydp%#mudqd$cycccgyy-4s=8a*f'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'SieveApp',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'SieveWeb.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, "templates")],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'SieveWeb.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}


# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/

STATIC_URL = '/static/'

STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static_my_proj")
]

STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static_cdn", "static_root")

MEDIA_URL = '/media/'

MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static_cdn", "media_root")
23 changes: 23 additions & 0 deletions SieveWeb/SieveWeb/SieveWeb/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from django.conf import settings
from django.conf.urls.static import static

from django.contrib import admin
from django.conf.urls import url, include
from .views import home_page, about_page, report_page


urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', home_page, name='home_page'),
url(r'^about/$', about_page, name='about_page'),
url(r'^report/$', report_page, name='report_page'),
url(r'^sieve/', include('SieveApp.urls', namespace = 'sieveapp')),
]



if settings.DEBUG:
urlpatterns = urlpatterns + \
static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns = urlpatterns + \
static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
10 changes: 10 additions & 0 deletions SieveWeb/SieveWeb/SieveWeb/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.shortcuts import render

def home_page(request):
return render(request, 'index.html', {})

def about_page(request):
return render(request, 'about.html', {})

def report_page(request):
return render(request, 'report.html', {})
16 changes: 16 additions & 0 deletions SieveWeb/SieveWeb/SieveWeb/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for SieveWeb project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'SieveWeb.settings')

application = get_wsgi_application()
21 changes: 21 additions & 0 deletions SieveWeb/SieveWeb/manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys


def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'SieveWeb.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)


if __name__ == '__main__':
main()
Loading

0 comments on commit b0a2112

Please sign in to comment.