mirror of
https://github.com/ferdzo/serviceCRM.git
synced 2026-04-05 13:16:24 +00:00
Initial commit
This commit is contained in:
0
serviceCRM/__init__.py
Normal file
0
serviceCRM/__init__.py
Normal file
5
serviceCRM/admin.py
Normal file
5
serviceCRM/admin.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import Insert
|
||||
|
||||
admin.site.register(Insert)
|
||||
6
serviceCRM/apps.py
Normal file
6
serviceCRM/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class serviceCRMconfig(AppConfig):
|
||||
name = "serviceCRM"
|
||||
verbose_name = "Service CRM"
|
||||
16
serviceCRM/asgi.py
Normal file
16
serviceCRM/asgi.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
ASGI config for serviceCRM project.
|
||||
|
||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'serviceCRM.settings')
|
||||
|
||||
application = get_asgi_application()
|
||||
25
serviceCRM/migrations/0001_initial.py
Normal file
25
serviceCRM/migrations/0001_initial.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 4.2 on 2023-04-17 22:05
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Insert',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=50)),
|
||||
('phone', models.CharField(max_length=20)),
|
||||
('description', models.CharField(max_length=300)),
|
||||
('date', models.DateField(verbose_name='date submitted')),
|
||||
('done', models.BooleanField()),
|
||||
],
|
||||
),
|
||||
]
|
||||
0
serviceCRM/migrations/__init__.py
Normal file
0
serviceCRM/migrations/__init__.py
Normal file
14
serviceCRM/models.py
Normal file
14
serviceCRM/models.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import UserManager
|
||||
|
||||
class Insert(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
phone = models.CharField(max_length=20)
|
||||
description = models.CharField(max_length=300)
|
||||
date = models.DateField("date submitted")
|
||||
done = models.BooleanField()
|
||||
|
||||
def __str__(self):
|
||||
return "Ime: "+self.name + " Telefonski broj: "+self.phone+ "\nDefekt: "+self.description + "\nDatum: \n"
|
||||
|
||||
|
||||
130
serviceCRM/settings.py
Normal file
130
serviceCRM/settings.py
Normal file
@@ -0,0 +1,130 @@
|
||||
"""
|
||||
Django settings for serviceCRM project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 4.2.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/4.2/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/4.2/ref/settings/
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
import environ
|
||||
env = environ.Env()
|
||||
environ.Env.read_env('.env')
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = env('SECRET_KEY')
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'serviceCRM.apps.serviceCRMconfig',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
]
|
||||
|
||||
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 = 'serviceCRM.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 = 'serviceCRM.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': env('DATABASE_NAME'),
|
||||
'USER': env('DATABASE_USER'),
|
||||
'PASSWORD': env('DATABASE_PASS'),
|
||||
'HOST': env('DATABASE_HOST'),
|
||||
'PORT': env('DATABASE_PORT'),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/4.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/4.2/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/4.2/howto/static-files/
|
||||
|
||||
STATIC_URL = 'static/'
|
||||
|
||||
# Default primary key field type
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
65
serviceCRM/templates/serviceCRM/id.html
Normal file
65
serviceCRM/templates/serviceCRM/id.html
Normal file
@@ -0,0 +1,65 @@
|
||||
<index>
|
||||
<title>
|
||||
Nalog
|
||||
</title>
|
||||
<body>
|
||||
{# <h1>Name:{{ name}}</h1>#}
|
||||
{# <h1>Phone:{{ phone }}</h1>#}
|
||||
{# <h1>Description:{{ desc }}</h1>#}
|
||||
{# <h1>Date:{{ date }}</h1>#}
|
||||
<!-- CSS Code: Place this code in the document's head (between the 'head' tags) -->
|
||||
<style>
|
||||
table.GeneratedTable {
|
||||
width: 100%;
|
||||
background-color: #ffffff;
|
||||
border-collapse: collapse;
|
||||
border-width: 2px;
|
||||
border-color: #ffcc00;
|
||||
border-style: solid;
|
||||
color: #000000;
|
||||
}
|
||||
thead{
|
||||
color:#f3f2f5
|
||||
}
|
||||
|
||||
table.GeneratedTable td, table.GeneratedTable th {
|
||||
border-width: 2px;
|
||||
border-color: #ffcc00;
|
||||
border-style: solid;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
table.GeneratedTable thead {
|
||||
background-color: #ffcc00;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- HTML Code: Place this code in the document's body (between the 'body' tags) where the table should appear -->
|
||||
<table class="GeneratedTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Phone</th>
|
||||
<th>Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{ name}} </td>
|
||||
<td>{{ phone }}</td>
|
||||
<td>{{ date }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" style="font-size: 20px;background-color:#ffcc00;color:#f3f2f5">Опис на проблем:</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">{{ desc }}</td>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- Codes by Quackit.com -->
|
||||
|
||||
|
||||
</body>
|
||||
</index>
|
||||
25
serviceCRM/urls.py
Normal file
25
serviceCRM/urls.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""
|
||||
URL configuration for serviceCRM project.
|
||||
|
||||
The `urlpatterns` list routes URLs to views.py. For more information please see:
|
||||
https://docs.djangoproject.com/en/4.2/topics/http/urls/
|
||||
Examples:
|
||||
Function views.py
|
||||
1. Add an import: from my_app import views.py
|
||||
2. Add a URL to urlpatterns: path('', views.py.home, name='home')
|
||||
Class-based views.py
|
||||
1. Add an import: from other_app.views.py 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
|
||||
|
||||
from . import views
|
||||
urlpatterns = [
|
||||
path("", views.index, name="index"),
|
||||
path('admin/', admin.site.urls),
|
||||
path("<int:question_id>/", views.detail, name="detail"),
|
||||
]
|
||||
14
serviceCRM/views.py
Normal file
14
serviceCRM/views.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from django.http import HttpResponse
|
||||
from .models import Insert
|
||||
from django.template import loader
|
||||
|
||||
def index(request):
|
||||
proba = Insert.objects.order_by("name")
|
||||
return HttpResponse(proba)
|
||||
|
||||
def detail(request,question_id):
|
||||
proba = Insert.objects.get(id=question_id)
|
||||
template = loader.get_template("serviceCRM/id.html")
|
||||
context = {"name":proba.name, "phone":proba.phone,"desc":proba.description,"date":proba.date}
|
||||
return HttpResponse(template.render(context, request))
|
||||
|
||||
16
serviceCRM/wsgi.py
Normal file
16
serviceCRM/wsgi.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
WSGI config for serviceCRM 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/4.2/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'serviceCRM.settings')
|
||||
|
||||
application = get_wsgi_application()
|
||||
Reference in New Issue
Block a user