Commit 3a2bcf87 authored by Emman Gatmaitan's avatar Emman Gatmaitan

Initial commit

parents
Pipeline #146 failed with stages
File added
from django.contrib import admin
from django.contrib.auth.models import User ,Group
from .models import PersonT ,DonationT ,HouseholdT ,PetT ,PhysicalAssetT ,ProgramT ,VolunteerRecordT ,VolunteerRoleT ,SkillT
admin.site.unregister(User)
admin.site.unregister(Group)
admin.site.register(PersonT)
admin.site.register(DonationT)
admin.site.register(HouseholdT)
admin.site.register(PetT)
admin.site.register(PhysicalAssetT)
admin.site.register(ProgramT)
admin.site.register(VolunteerRecordT)
admin.site.register(VolunteerRoleT)
admin.site.register(SkillT)
# Register your models here.
from django.apps import AppConfig
class DellastradaConfig(AppConfig):
name = 'dellastrada'
# Generated by Django 2.1.7 on 2019-05-09 02:23
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='AuthGroup',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=80, unique=True)),
],
options={
'db_table': 'auth_group',
'managed': False,
},
),
migrations.CreateModel(
name='AuthGroupPermissions',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
],
options={
'db_table': 'auth_group_permissions',
'managed': False,
},
),
migrations.CreateModel(
name='AuthPermission',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('codename', models.CharField(max_length=100)),
],
options={
'db_table': 'auth_permission',
'managed': False,
},
),
migrations.CreateModel(
name='AuthUser',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128)),
('last_login', models.DateTimeField(blank=True, null=True)),
('is_superuser', models.IntegerField()),
('username', models.CharField(max_length=150, unique=True)),
('first_name', models.CharField(max_length=30)),
('last_name', models.CharField(max_length=150)),
('email', models.CharField(max_length=254)),
('is_staff', models.IntegerField()),
('is_active', models.IntegerField()),
('date_joined', models.DateTimeField()),
],
options={
'db_table': 'auth_user',
'managed': False,
},
),
migrations.CreateModel(
name='AuthUserGroups',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
],
options={
'db_table': 'auth_user_groups',
'managed': False,
},
),
migrations.CreateModel(
name='AuthUserUserPermissions',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
],
options={
'db_table': 'auth_user_user_permissions',
'managed': False,
},
),
migrations.CreateModel(
name='DjangoAdminLog',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('action_time', models.DateTimeField()),
('object_id', models.TextField(blank=True, null=True)),
('object_repr', models.CharField(max_length=200)),
('action_flag', models.PositiveSmallIntegerField()),
('change_message', models.TextField()),
],
options={
'db_table': 'django_admin_log',
'managed': False,
},
),
migrations.CreateModel(
name='DjangoContentType',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('app_label', models.CharField(max_length=100)),
('model', models.CharField(max_length=100)),
],
options={
'db_table': 'django_content_type',
'managed': False,
},
),
migrations.CreateModel(
name='DjangoMigrations',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('app', models.CharField(max_length=255)),
('name', models.CharField(max_length=255)),
('applied', models.DateTimeField()),
],
options={
'db_table': 'django_migrations',
'managed': False,
},
),
migrations.CreateModel(
name='DjangoSession',
fields=[
('session_key', models.CharField(max_length=40, primary_key=True, serialize=False)),
('session_data', models.TextField()),
('expire_date', models.DateTimeField()),
],
options={
'db_table': 'django_session',
'managed': False,
},
),
migrations.CreateModel(
name='DonationT',
fields=[
('donation_id', models.IntegerField(primary_key=True, serialize=False)),
('amount', models.IntegerField()),
('donation_date', models.DateField()),
],
options={
'db_table': 'donation_t',
'managed': False,
},
),
migrations.CreateModel(
name='HouseholdT',
fields=[
('household_id', models.IntegerField(primary_key=True, serialize=False)),
('address_number', models.IntegerField()),
('adress_street', models.IntegerField()),
('adress_city', models.IntegerField()),
('bec_number', models.IntegerField()),
('number_of_members', models.IntegerField(db_column='number_of_Members')),
('has_medical_equipment', models.IntegerField()),
('allow_victims', models.IntegerField()),
('allow_evacuation', models.IntegerField()),
],
options={
'db_table': 'household_t',
'managed': False,
},
),
migrations.CreateModel(
name='PersonT',
fields=[
('person_id', models.IntegerField(db_column='person_ID', primary_key=True, serialize=False)),
('first_name', models.CharField(max_length=10)),
('middle_name', models.CharField(max_length=15)),
('last_name', models.CharField(max_length=15)),
('birthday', models.DateField()),
('contact_number', models.IntegerField(blank=True, null=True)),
('email', models.CharField(blank=True, max_length=255, null=True)),
('religion', models.CharField(blank=True, max_length=20, null=True)),
('occupation', models.CharField(blank=True, max_length=30, null=True)),
('family_role', models.CharField(max_length=6)),
],
options={
'db_table': 'person_t',
'managed': False,
},
),
migrations.CreateModel(
name='PetT',
fields=[
('pet_id', models.IntegerField(db_column='pet_ID', primary_key=True, serialize=False)),
('pet_name', models.CharField(max_length=15)),
('pet_type', models.CharField(max_length=5)),
('is_dangerous', models.IntegerField()),
],
options={
'db_table': 'pet_t',
'managed': False,
},
),
migrations.CreateModel(
name='PhysicalAssetT',
fields=[
('asset_id', models.IntegerField(primary_key=True, serialize=False)),
('asset_type', models.CharField(max_length=20)),
('asset_kind', models.CharField(max_length=20)),
('asset_quantity', models.IntegerField()),
],
options={
'db_table': 'physical_asset_t',
'managed': False,
},
),
migrations.CreateModel(
name='ProgramT',
fields=[
('program_id', models.IntegerField(primary_key=True, serialize=False)),
('program_name', models.CharField(max_length=20)),
],
options={
'db_table': 'program_t',
'managed': False,
},
),
migrations.CreateModel(
name='VolunteerRecordT',
fields=[
('record_id', models.IntegerField(primary_key=True, serialize=False)),
('role', models.CharField(max_length=20)),
('number_of_hours', models.IntegerField()),
('date_effective', models.DateField()),
],
options={
'db_table': 'volunteer_record_t',
'managed': False,
},
),
migrations.CreateModel(
name='VolunteerRoleT',
fields=[
('volunteer_role_id', models.IntegerField(primary_key=True, serialize=False)),
('team_preference', models.CharField(max_length=50)),
('assistance_preference', models.CharField(max_length=50)),
],
options={
'db_table': 'volunteer_role_t',
'managed': False,
},
),
]
# Generated by Django 2.1.7 on 2019-05-09 04:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dellastrada', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='SkillT',
fields=[
('skill_name', models.CharField(max_length=6, primary_key=True, serialize=False)),
('person_id', models.IntegerField()),
],
options={
'db_table': 'skill_t',
'managed': False,
},
),
]
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Make sure each ForeignKey has `on_delete` set to the desired behavior.
# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free to rename the models, but don't rename db_table values or field names.
from django.db import models
class DonationT(models.Model):
donation_id = models.IntegerField(primary_key=True)
person = models.ForeignKey('PersonT', models.DO_NOTHING)
amount = models.DecimalField(max_digits=7, decimal_places=2)
donation_date = models.DateField()
beneficiary = models.CharField(max_length=20)
class Meta:
managed = False
db_table = 'donation_t'
class HouseholdT(models.Model):
household_id = models.IntegerField(primary_key=True)
address_number = models.IntegerField()
adress_street = models.CharField(max_length=30)
adress_city = models.CharField(max_length=8)
bec_number = models.IntegerField()
number_of_members = models.IntegerField(db_column='number_of_Members') # Field name made lowercase.
has_medical_equipment = models.IntegerField()
allow_victims = models.IntegerField()
allow_evacuation = models.IntegerField()
class Meta:
managed = False
db_table = 'household_t'
class PersonT(models.Model):
person_id = models.IntegerField(primary_key=True)
household = models.ForeignKey(HouseholdT, models.DO_NOTHING)
first_name = models.CharField(max_length=30)
middle_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)
birthday = models.DateField()
contact_number = models.IntegerField(blank=True, null=True)
email = models.CharField(max_length=255, blank=True, null=True)
religion = models.CharField(max_length=20, blank=True, null=True)
occupation = models.CharField(max_length=30, blank=True, null=True)
family_role = models.CharField(max_length=6)
class Meta:
managed = False
db_table = 'person_t'
class PetT(models.Model):
pet_id = models.IntegerField(db_column='pet_ID', primary_key=True) # Field name made lowercase.
household = models.ForeignKey(HouseholdT, models.DO_NOTHING)
pet_name = models.CharField(max_length=15)
pet_type = models.CharField(max_length=5)
is_dangerous = models.IntegerField()
class Meta:
managed = False
db_table = 'pet_t'
class PhysicalAssetT(models.Model):
asset_id = models.IntegerField(primary_key=True)
household = models.ForeignKey(HouseholdT, models.DO_NOTHING)
asset_type = models.CharField(max_length=20)
asset_kind = models.CharField(max_length=20)
asset_quantity = models.IntegerField()
class Meta:
managed = False
db_table = 'physical_asset_t'
class ProgramT(models.Model):
program_id = models.IntegerField(primary_key=True)
person = models.ForeignKey(PersonT, models.DO_NOTHING)
program_name = models.CharField(max_length=20)
class Meta:
managed = False
db_table = 'program_t'
class SkillT(models.Model):
skill_name = models.CharField(primary_key=True, max_length=6)
person_id = models.IntegerField()
class Meta:
managed = False
db_table = 'skill_t'
class VolunteerRecordT(models.Model):
record_id = models.IntegerField(primary_key=True)
person = models.ForeignKey(PersonT, models.DO_NOTHING)
role = models.CharField(max_length=20)
number_of_hours = models.IntegerField()
date_effective = models.DateField()
class Meta:
managed = False
db_table = 'volunteer_record_t'
class VolunteerRoleT(models.Model):
volunteer_role_id = models.IntegerField(primary_key=True)
person = models.ForeignKey(PersonT, models.DO_NOTHING)
team_preference = models.CharField(max_length=50)
assistance_preference = models.CharField(max_length=50)
class Meta:
managed = False
db_table = 'volunteer_role_t'
from django.test import TestCase
# Create your tests here.
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
]
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse
def index(request):
html ="<html><body><button>Generate Pastoral Report</button><button>Generate Stewardship Report</button><body></html>"
return HttpResponse(html)
# Create your views here.
"""
Django settings for gtek project.
Generated by 'django-admin startproject' using Django 2.1.7.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
import mysql.connector
# 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.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'vo8(sc_hhxmi@q7ni=48=_2iv%7q8yw^xq91qpe75#9!@ps2##'
# 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',
'dellastrada',
]
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 = 'gtek.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'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 = 'gtek.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'drm',
'USER': 'GTEK-EmmanPC', #user of the pc you are currently using
'PASSWORD': 'PASSWORD', #password of the pc you are currently using
'HOST': '192.168.1.2', #IP of raspberry pi
'PORT': '3306', #port of raspberry pi
}
}
# Password validation
# https://docs.djangoproject.com/en/2.1/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.1/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.1/howto/static-files/
STATIC_URL = '/static/'
"""gtek URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('admin/', admin.site.urls),
path('',include('dellastrada.urls')),
]
"""
WSGI config for gtek 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.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'gtek.settings')
application = get_wsgi_application()
#!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'gtek.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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment