diff --git a/crm1_v9_dynamic_urls_templates/accounts/__pycache__/__init__.cpython-37.pyc b/crm1_v9_dynamic_urls_templates/accounts/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..db7a15a Binary files /dev/null and b/crm1_v9_dynamic_urls_templates/accounts/__pycache__/__init__.cpython-37.pyc differ diff --git a/crm1_v9_dynamic_urls_templates/accounts/__pycache__/admin.cpython-37.pyc b/crm1_v9_dynamic_urls_templates/accounts/__pycache__/admin.cpython-37.pyc new file mode 100644 index 0000000..5180e50 Binary files /dev/null and b/crm1_v9_dynamic_urls_templates/accounts/__pycache__/admin.cpython-37.pyc differ diff --git a/crm1_v9_dynamic_urls_templates/accounts/__pycache__/models.cpython-37.pyc b/crm1_v9_dynamic_urls_templates/accounts/__pycache__/models.cpython-37.pyc new file mode 100644 index 0000000..bae1532 Binary files /dev/null and b/crm1_v9_dynamic_urls_templates/accounts/__pycache__/models.cpython-37.pyc differ diff --git a/crm1_v9_dynamic_urls_templates/accounts/__pycache__/urls.cpython-37.pyc b/crm1_v9_dynamic_urls_templates/accounts/__pycache__/urls.cpython-37.pyc new file mode 100644 index 0000000..e1d3a0e Binary files /dev/null and b/crm1_v9_dynamic_urls_templates/accounts/__pycache__/urls.cpython-37.pyc differ diff --git a/crm1_v9_dynamic_urls_templates/accounts/__pycache__/views.cpython-37.pyc b/crm1_v9_dynamic_urls_templates/accounts/__pycache__/views.cpython-37.pyc new file mode 100644 index 0000000..9d4845a Binary files /dev/null and b/crm1_v9_dynamic_urls_templates/accounts/__pycache__/views.cpython-37.pyc differ diff --git a/crm1_v9_dynamic_urls_templates/accounts/admin.py b/crm1_v9_dynamic_urls_templates/accounts/admin.py new file mode 100644 index 0000000..4b4f5a4 --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/accounts/admin.py @@ -0,0 +1,10 @@ +from django.contrib import admin + +# Register your models here. + +from .models import * + +admin.site.register(Customer) +admin.site.register(Product) +admin.site.register(Tag) +admin.site.register(Order) \ No newline at end of file diff --git a/crm1_v9_dynamic_urls_templates/accounts/apps.py b/crm1_v9_dynamic_urls_templates/accounts/apps.py new file mode 100644 index 0000000..3cab1e0 --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/accounts/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class AccountsConfig(AppConfig): + name = 'accounts' diff --git a/crm1_v9_dynamic_urls_templates/accounts/migrations/0001_initial.py b/crm1_v9_dynamic_urls_templates/accounts/migrations/0001_initial.py new file mode 100644 index 0000000..4fb1876 --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/accounts/migrations/0001_initial.py @@ -0,0 +1,24 @@ +# Generated by Django 3.0 on 2019-12-02 22:15 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Customer', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=200, null=True)), + ('phone', models.CharField(max_length=200, null=True)), + ('email', models.CharField(max_length=200, null=True)), + ('date_created', models.DateTimeField(auto_now_add=True, null=True)), + ], + ), + ] diff --git a/crm1_v9_dynamic_urls_templates/accounts/migrations/0002_order_product.py b/crm1_v9_dynamic_urls_templates/accounts/migrations/0002_order_product.py new file mode 100644 index 0000000..8b5269f --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/accounts/migrations/0002_order_product.py @@ -0,0 +1,32 @@ +# Generated by Django 3.0 on 2019-12-02 22:35 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Order', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('date_created', models.DateTimeField(auto_now_add=True, null=True)), + ('status', models.CharField(choices=[('Pending', 'Pending'), ('Out for delivery', 'Out for delivery'), ('Delivered', 'Delivered')], max_length=200, null=True)), + ], + ), + migrations.CreateModel( + name='Product', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=200, null=True)), + ('price', models.FloatField(null=True)), + ('category', models.CharField(choices=[('Indoor', 'Indoor'), ('Out Door', 'Out Door')], max_length=200, null=True)), + ('description', models.CharField(max_length=200, null=True)), + ('date_created', models.DateTimeField(auto_now_add=True, null=True)), + ], + ), + ] diff --git a/crm1_v9_dynamic_urls_templates/accounts/migrations/0003_auto_20191203_1454.py b/crm1_v9_dynamic_urls_templates/accounts/migrations/0003_auto_20191203_1454.py new file mode 100644 index 0000000..0d2a53b --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/accounts/migrations/0003_auto_20191203_1454.py @@ -0,0 +1,24 @@ +# Generated by Django 3.0 on 2019-12-03 22:54 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0002_order_product'), + ] + + operations = [ + migrations.AddField( + model_name='order', + name='customer', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='accounts.Customer'), + ), + migrations.AddField( + model_name='order', + name='product', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='accounts.Product'), + ), + ] diff --git a/crm1_v9_dynamic_urls_templates/accounts/migrations/0004_auto_20191203_1502.py b/crm1_v9_dynamic_urls_templates/accounts/migrations/0004_auto_20191203_1502.py new file mode 100644 index 0000000..71ada74 --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/accounts/migrations/0004_auto_20191203_1502.py @@ -0,0 +1,25 @@ +# Generated by Django 3.0 on 2019-12-03 23:02 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0003_auto_20191203_1454'), + ] + + operations = [ + migrations.CreateModel( + name='Tag', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=200, null=True)), + ], + ), + migrations.AddField( + model_name='order', + name='tags', + field=models.ManyToManyField(to='accounts.Tag'), + ), + ] diff --git a/crm1_v9_dynamic_urls_templates/accounts/migrations/0005_auto_20191203_1515.py b/crm1_v9_dynamic_urls_templates/accounts/migrations/0005_auto_20191203_1515.py new file mode 100644 index 0000000..7e175c2 --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/accounts/migrations/0005_auto_20191203_1515.py @@ -0,0 +1,22 @@ +# Generated by Django 3.0 on 2019-12-03 23:15 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0004_auto_20191203_1502'), + ] + + operations = [ + migrations.RemoveField( + model_name='order', + name='tags', + ), + migrations.AddField( + model_name='product', + name='tags', + field=models.ManyToManyField(to='accounts.Tag'), + ), + ] diff --git a/crm1_v9_dynamic_urls_templates/accounts/migrations/__pycache__/0001_initial.cpython-37.pyc b/crm1_v9_dynamic_urls_templates/accounts/migrations/__pycache__/0001_initial.cpython-37.pyc new file mode 100644 index 0000000..22267cd Binary files /dev/null and b/crm1_v9_dynamic_urls_templates/accounts/migrations/__pycache__/0001_initial.cpython-37.pyc differ diff --git a/crm1_v9_dynamic_urls_templates/accounts/migrations/__pycache__/0002_order_product.cpython-37.pyc b/crm1_v9_dynamic_urls_templates/accounts/migrations/__pycache__/0002_order_product.cpython-37.pyc new file mode 100644 index 0000000..c07451c Binary files /dev/null and b/crm1_v9_dynamic_urls_templates/accounts/migrations/__pycache__/0002_order_product.cpython-37.pyc differ diff --git a/crm1_v9_dynamic_urls_templates/accounts/migrations/__pycache__/0003_auto_20191203_1454.cpython-37.pyc b/crm1_v9_dynamic_urls_templates/accounts/migrations/__pycache__/0003_auto_20191203_1454.cpython-37.pyc new file mode 100644 index 0000000..890d0fa Binary files /dev/null and b/crm1_v9_dynamic_urls_templates/accounts/migrations/__pycache__/0003_auto_20191203_1454.cpython-37.pyc differ diff --git a/crm1_v9_dynamic_urls_templates/accounts/migrations/__pycache__/0004_auto_20191203_1502.cpython-37.pyc b/crm1_v9_dynamic_urls_templates/accounts/migrations/__pycache__/0004_auto_20191203_1502.cpython-37.pyc new file mode 100644 index 0000000..152a790 Binary files /dev/null and b/crm1_v9_dynamic_urls_templates/accounts/migrations/__pycache__/0004_auto_20191203_1502.cpython-37.pyc differ diff --git a/crm1_v9_dynamic_urls_templates/accounts/migrations/__pycache__/0005_auto_20191203_1515.cpython-37.pyc b/crm1_v9_dynamic_urls_templates/accounts/migrations/__pycache__/0005_auto_20191203_1515.cpython-37.pyc new file mode 100644 index 0000000..c9ce136 Binary files /dev/null and b/crm1_v9_dynamic_urls_templates/accounts/migrations/__pycache__/0005_auto_20191203_1515.cpython-37.pyc differ diff --git a/crm1_v9_dynamic_urls_templates/accounts/migrations/__pycache__/__init__.cpython-37.pyc b/crm1_v9_dynamic_urls_templates/accounts/migrations/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..a3ca9e1 Binary files /dev/null and b/crm1_v9_dynamic_urls_templates/accounts/migrations/__pycache__/__init__.cpython-37.pyc differ diff --git a/crm1_v9_dynamic_urls_templates/accounts/models.py b/crm1_v9_dynamic_urls_templates/accounts/models.py new file mode 100644 index 0000000..3fe09bf --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/accounts/models.py @@ -0,0 +1,52 @@ +from django.db import models + +# Create your models here. + +class Customer(models.Model): + name = models.CharField(max_length=200, null=True) + phone = models.CharField(max_length=200, null=True) + email = models.CharField(max_length=200, null=True) + date_created = models.DateTimeField(auto_now_add=True, null=True) + + def __str__(self): + return self.name + + +class Tag(models.Model): + name = models.CharField(max_length=200, null=True) + + def __str__(self): + return self.name + +class Product(models.Model): + CATEGORY = ( + ('Indoor', 'Indoor'), + ('Out Door', 'Out Door'), + ) + + name = models.CharField(max_length=200, null=True) + price = models.FloatField(null=True) + category = models.CharField(max_length=200, null=True, choices=CATEGORY) + description = models.CharField(max_length=200, null=True, blank=True) + date_created = models.DateTimeField(auto_now_add=True, null=True) + tags = models.ManyToManyField(Tag) + + def __str__(self): + return self.name + +class Order(models.Model): + STATUS = ( + ('Pending', 'Pending'), + ('Out for delivery', 'Out for delivery'), + ('Delivered', 'Delivered'), + ) + + customer = models.ForeignKey(Customer, null=True, on_delete= models.SET_NULL) + product = models.ForeignKey(Product, null=True, on_delete= models.SET_NULL) + date_created = models.DateTimeField(auto_now_add=True, null=True) + status = models.CharField(max_length=200, null=True, choices=STATUS) + + + + + diff --git a/crm1_v9_dynamic_urls_templates/accounts/queryDemos.py b/crm1_v9_dynamic_urls_templates/accounts/queryDemos.py new file mode 100644 index 0000000..8f96d7f --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/accounts/queryDemos.py @@ -0,0 +1,69 @@ +#***(1)Returns all customers from customer table +customers = Customer.objects.all() + +#(2)Returns first customer in table +firstCustomer = Customer.objects.first() + +#(3)Returns last customer in table +lastCustomer = Customer.objects.last() + +#(4)Returns single customer by name +customerByName = Customer.objects.get(name='Peter Piper') + +#***(5)Returns single customer by name +customerById = Customer.objects.get(id=4) + +#***(6)Returns all orders related to customer (firstCustomer variable set above) +firstCustomer.order_set.all() + +#(7)***Returns orders customer name: (Query parent model values) +order = Order.objects.first() +parentName = order.customer.name + +#(8)***Returns products from products table with value of "Out Door" in category attribute +products = Product.objects.filter(category="Out Door") + +#(9)***Order/Sort Objects by id +leastToGreatest = Product.objects.all().order_by('id') +greatestToLeast = Product.objects.all().order_by('-id') + + +#(10) Returns all products with tag of "Sports": (Query Many to Many Fields) +productsFiltered = Product.objects.filter(tags__name="Sports") + +''' +(11)Bonus +Q: If the customer has more than 1 ball, how would you reflect it in the database? + +A: Because there are many different products and this value changes constantly you would most +likly not want to store the value in the database but rather just make this a function we can run +each time we load the customers profile +''' + +#Returns the total count for number of time a "Ball" was ordered by the first customer +ballOrders = firstCustomer.order_set.filter(product__name="Ball").count() + +#Returns total count for each product orderd +allOrders = {} + +for order in firstCustomer.order_set.all(): + if order.product.name in allOrders: + allOrders[order.product.name] += 1 + else: + allOrders[order.product.name] = 1 + +#Returns: allOrders: {'Ball': 2, 'BBQ Grill': 1} + + +#RELATED SET EXAMPLE +class ParentModel(models.Model): + name = models.CharField(max_length=200, null=True) + +class ChildModel(models.Model): + parent = models.ForeignKey(ParentModel) + name = models.CharField(max_length=200, null=True) + +parent = ParentModel.objects.first() +#Returns all child models related to parent +parent.childmodel_set.all() + diff --git a/crm1_v9_dynamic_urls_templates/accounts/templates/accounts/customer.html b/crm1_v9_dynamic_urls_templates/accounts/templates/accounts/customer.html new file mode 100644 index 0000000..f2128d2 --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/accounts/templates/accounts/customer.html @@ -0,0 +1,81 @@ +{% extends 'accounts/main.html' %} + +{% block content %} + +
+ +
+
+
+
Customer:
+
+ Update Customer + Delete Customer + +
+
+ +
+
+
Contact Information
+
+

Email: {{customer.email}}

+

Phone: {{customer.phone}}

+
+
+ +
+
+
Total Orders
+
+

{{order_count}}

+
+
+
+ + +
+
+
+
+
+ + +
+
+
+ +
+
+ +
+
+
+ + + + + + + + + + + {% for order in orders %} + + + + + + + + + + {% endfor %} + +
ProductCategoryDate OrderdStatusUpdateRemove
{{order.product}}{{order.product.category}}{{order.date_created}}{{order.status}}UpdateRemove
+
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/crm1_v9_dynamic_urls_templates/accounts/templates/accounts/dashboard.html b/crm1_v9_dynamic_urls_templates/accounts/templates/accounts/dashboard.html new file mode 100644 index 0000000..7a6a6a8 --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/accounts/templates/accounts/dashboard.html @@ -0,0 +1,66 @@ +{% extends 'accounts/main.html' %} + +{% block content %} + +{% include 'accounts/status.html' %} + +
+ +
+
+
CUSTOMERS:
+
+
+ Create Customer + + + + + + + {% for customer in customers %} + + + + + + {% endfor %} + +
CustomerPhone
{{customer.name}}{{customer.phone}}
+
+
+ +
+
LAST 5 ORDERS
+
+
+ Create Order + + + + + + + + + + {% for order in orders %} + + + + + + + + + {% endfor %} + + +
ProductDate OrderdStatusUpdateRemove
{{order.product}}{{order.date_created}}{{order.status}}UpdateDelete
+
+
+ +
+ +{% endblock %} + diff --git a/crm1_v9_dynamic_urls_templates/accounts/templates/accounts/main.html b/crm1_v9_dynamic_urls_templates/accounts/templates/accounts/main.html new file mode 100644 index 0000000..bed4320 --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/accounts/templates/accounts/main.html @@ -0,0 +1,29 @@ +{% load static %} + + + + + CRM + + + + + + + {% include 'accounts/navbar.html' %} +
+ {% block content %} + + + + {% endblock %} +
+
+
Our footer
+ + + + + + + \ No newline at end of file diff --git a/crm1_v9_dynamic_urls_templates/accounts/templates/accounts/navbar.html b/crm1_v9_dynamic_urls_templates/accounts/templates/accounts/navbar.html new file mode 100644 index 0000000..a7198c2 --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/accounts/templates/accounts/navbar.html @@ -0,0 +1,18 @@ +{% load static %} + + \ No newline at end of file diff --git a/crm1_v9_dynamic_urls_templates/accounts/templates/accounts/products.html b/crm1_v9_dynamic_urls_templates/accounts/templates/accounts/products.html new file mode 100644 index 0000000..bb2f308 --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/accounts/templates/accounts/products.html @@ -0,0 +1,34 @@ +{% extends 'accounts/main.html' %} + +{% block content %} + +
+ +
+
+
+
Products
+
+
+ + + + + + + + {% for i in products %} + + + + + + {% endfor %} + +
ProductCategoryPrice
{{i.name}}{{i.category}}{{i.price}}
+
+
+ +
+ +{% endblock content %} \ No newline at end of file diff --git a/crm1_v9_dynamic_urls_templates/accounts/templates/accounts/status.html b/crm1_v9_dynamic_urls_templates/accounts/templates/accounts/status.html new file mode 100644 index 0000000..64ecdc1 --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/accounts/templates/accounts/status.html @@ -0,0 +1,42 @@ +
+ +
+
+
+
+
+
Total Orders
+
+
+

{{total_orders}}

+
+
+
+
+ +
+
+
+
+
Orders Delivered
+
+
+

{{delivered}}

+
+
+
+
+ +
+
+
+
+
Orders Pending
+
+
+

{{pending}}

+
+
+
+
+
\ No newline at end of file diff --git a/crm1_v9_dynamic_urls_templates/accounts/tests.py b/crm1_v9_dynamic_urls_templates/accounts/tests.py new file mode 100644 index 0000000..de8bdc0 --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/accounts/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/crm1_v9_dynamic_urls_templates/accounts/urls.py b/crm1_v9_dynamic_urls_templates/accounts/urls.py new file mode 100644 index 0000000..5bb519f --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/accounts/urls.py @@ -0,0 +1,9 @@ +from django.urls import path +from . import views + + +urlpatterns = [ + path('', views.home), + path('products/', views.products), + path('customer//', views.customer), +] \ No newline at end of file diff --git a/crm1_v9_dynamic_urls_templates/accounts/views.py b/crm1_v9_dynamic_urls_templates/accounts/views.py new file mode 100644 index 0000000..d0a8a6a --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/accounts/views.py @@ -0,0 +1,40 @@ +from django.shortcuts import render +from django.http import HttpResponse +# Create your views here. +from .models import * + + +def home(request): + orders = Order.objects.all() + customers = Customer.objects.all() + + total_customers = customers.count() + + total_orders = orders.count() + delivered = orders.filter(status='Delivered').count() + pending = orders.filter(status='Pending').count() + + #code to count orders of customers + + for cust_ordr in customers: + cust_ordr = orders.filter(customer=cust_ordr).count() + + context = {'orders':orders, 'customers':customers, + 'total_orders':total_orders,'delivered':delivered, + 'pending':pending, 'c_ordr':cust_ordr} + + return render(request, 'accounts/dashboard.html', context) + +def products(request): + products = Product.objects.all() + + return render(request, 'accounts/products.html', {'products':products}) + +def customer(request, pk_test): + customer = Customer.objects.get(id=pk_test) + + orders = customer.order_set.all() + order_count = orders.count() + + context = {'customer':customer, 'orders':orders, 'order_count':order_count} + return render(request, 'accounts/customer.html',context) diff --git a/crm1_v9_dynamic_urls_templates/crm1/__pycache__/__init__.cpython-37.pyc b/crm1_v9_dynamic_urls_templates/crm1/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..c0daa8b Binary files /dev/null and b/crm1_v9_dynamic_urls_templates/crm1/__pycache__/__init__.cpython-37.pyc differ diff --git a/crm1_v9_dynamic_urls_templates/crm1/__pycache__/settings.cpython-37.pyc b/crm1_v9_dynamic_urls_templates/crm1/__pycache__/settings.cpython-37.pyc new file mode 100644 index 0000000..1a2a4d3 Binary files /dev/null and b/crm1_v9_dynamic_urls_templates/crm1/__pycache__/settings.cpython-37.pyc differ diff --git a/crm1_v9_dynamic_urls_templates/crm1/__pycache__/urls.cpython-37.pyc b/crm1_v9_dynamic_urls_templates/crm1/__pycache__/urls.cpython-37.pyc new file mode 100644 index 0000000..bf87179 Binary files /dev/null and b/crm1_v9_dynamic_urls_templates/crm1/__pycache__/urls.cpython-37.pyc differ diff --git a/crm1_v9_dynamic_urls_templates/crm1/__pycache__/wsgi.cpython-37.pyc b/crm1_v9_dynamic_urls_templates/crm1/__pycache__/wsgi.cpython-37.pyc new file mode 100644 index 0000000..21c65ef Binary files /dev/null and b/crm1_v9_dynamic_urls_templates/crm1/__pycache__/wsgi.cpython-37.pyc differ diff --git a/crm1_v9_dynamic_urls_templates/crm1/settings.py b/crm1_v9_dynamic_urls_templates/crm1/settings.py new file mode 100644 index 0000000..6ec8030 --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/crm1/settings.py @@ -0,0 +1,128 @@ +""" +Django settings for crm1 project. + +Generated by 'django-admin startproject' using Django 3.0 + +For more information on this file, see +https://docs.djangoproject.com/en/3.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/3.0/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/3.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'cz=&%f*9(d*zo$_55p=(p)(eki#p$pb^0159-)8k^6$9c3l&_b' + +# 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', + + 'accounts', +] + +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 = 'crm1.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 = 'crm1.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/3.0/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/3.0/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/3.0/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/3.0/howto/static-files/ + +STATIC_URL = '/static/' + +MEDIA_URL = '/images/' + +STATICFILES_DIRS = [ + os.path.join(BASE_DIR, 'static') +] diff --git a/crm1_v9_dynamic_urls_templates/crm1/urls.py b/crm1_v9_dynamic_urls_templates/crm1/urls.py new file mode 100644 index 0000000..fe12911 --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/crm1/urls.py @@ -0,0 +1,24 @@ +"""crm1 URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/3.0/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 path, include + +urlpatterns = [ + path('admin/', admin.site.urls), + path('', include('accounts.urls')) + +] diff --git a/crm1_v9_dynamic_urls_templates/crm1/wsgi.py b/crm1_v9_dynamic_urls_templates/crm1/wsgi.py new file mode 100644 index 0000000..cc81ed7 --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/crm1/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for crm1 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/3.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'crm1.settings') + +application = get_wsgi_application() diff --git a/crm1_v9_dynamic_urls_templates/db.sqlite3 b/crm1_v9_dynamic_urls_templates/db.sqlite3 new file mode 100644 index 0000000..7318c2a Binary files /dev/null and b/crm1_v9_dynamic_urls_templates/db.sqlite3 differ diff --git a/crm1_v9_dynamic_urls_templates/manage.py b/crm1_v9_dynamic_urls_templates/manage.py new file mode 100644 index 0000000..c3bccf9 --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/manage.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == '__main__': + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'crm1.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) diff --git a/crm1_v9_dynamic_urls_templates/static/css/main.css b/crm1_v9_dynamic_urls_templates/static/css/main.css new file mode 100644 index 0000000..5d9b540 --- /dev/null +++ b/crm1_v9_dynamic_urls_templates/static/css/main.css @@ -0,0 +1,20 @@ +#logo{ + } + + body{ + background-color: #ebeff5; + } + + + #total-orders{ + background-color: #4cb4c7; + } + + + #orders-delivered{ + background-color: #7abecc; + } + + #orders-pending{ + background-color: #7CD1C0; + } \ No newline at end of file diff --git a/crm1_v9_dynamic_urls_templates/static/images/logo.png b/crm1_v9_dynamic_urls_templates/static/images/logo.png new file mode 100644 index 0000000..715c446 Binary files /dev/null and b/crm1_v9_dynamic_urls_templates/static/images/logo.png differ