Django Sales Charts
Open-source Django sample provided by AppSeed on top of Argon Dashboard.
Open-source Sample provided on top of Argon Dashboard Django (free product). Django Argon Charts sample provides functional code that shows different metrics regarding a 12mo timeframe: total sales, total orders, best sale, and best month (in sales value). Information is provided using charts, widgets and a paginated data table that allows editing/adding new sales - App Features:
    Manage orders and display the information visually using charts and widgets
    Table Orders store the information - properties:
      ID, Product Name (mandatory), Price, Created Times, Updated Times.
    Charts: Line and Bar Charts:
      Line Chart shows the sales for a 12mo timeframe
      Bar Chart shows the sales for a 12mo timeframe
    Widget 1: Total Sales (in value)
    Widget 2: Peek Sale - transaction with Biggest Value
    Widget 3: Total Orders (sum up of all transactions)
    Widget 4: Best Month - selected by the number of orders
Links
Django Charts Argon - Free Sample.
​

How to use the app

To compile and execute the project in a local environment the workstation must have a few software tools already installed:
    ​GIT - command line versioning tool used to clone the sources
    ​Python3 - the language used to code the project
Step #1 - Clone the sources
1
$ # Get the code
2
$ git clone https://github.com/app-generator/django-argon-charts.git
3
$ cd django-argon-charts
Copied!
Step #2 - Prepare the environment and install modules
1
$ virtualenv env
2
$ source env/bin/activate
3
$
4
$ # Install modules
5
$ pip3 install -r requirements.txt
Copied!
Step #3 - Create SQLite database and tables
1
$ python manage.py makemigrations
2
$ python manage.py migrate
Copied!
Step #4 - Create the superuser
1
$ python manage.py createsuperuser
Copied!
​
Start the app, access the admin section and import the Sample File into the orders table.
Note: make sure your are connected with an admin account.
​

Codebase Structure

1
< PROJECT ROOT >
2
|
3
|-- core/ # Implements app logic
4
| |-- settings.py # Django app bootstrapper
5
| |-- static/
6
| |-- templates/ # Templates used to render pages
7
|
8
|-- authentication/ # Handles auth routes (login and register)
9
| |-- urls.py # Define authentication routes
10
| |-- forms.py # Define auth forms
11
|
12
|-- app/ # A simple app that serve HTML files
13
| |-- views.py # Serve HTML pages for authenticated users
14
| |-- templates
15
| |-- dashboard.html # The dashboard <-------- NEW
16
|
17
|-- orders/ # Handles and display ORDERS <-------- NEW
18
| |-- migrations/ # Handles and display ORDERS <-------- NEW
19
| | |-- __init__.py
20
| |-- static/ # order CSS files, JS, and static images
21
| | |-- orders_assets/
22
| | | -- jquery/
23
| | |-- js/
24
| | |-- order_script.js
25
| | |-- notify.js
26
| |-- templates/
27
| | |-- orders/
28
| |-- __init__.py # Defines App init <-------- NEW
29
| |-- admin.py # Defines App admin <-------- NEW
30
| |-- apps.py # Defines App apps <-------- NEW
31
| |-- forms.py # Defines App forms <-------- NEW
32
| |-- models.py # Defines App models <-------- NEW
33
| |-- signals.py # Defines App signals <-------- NEW
34
| |-- tests.py # Defines App tests <-------- NEW
35
| |-- urls.py # Defines App routes <-------- NEW
36
| |-- views.py # Defines App views <-------- NEW
37
|
38
|-- requirements.txt # Development modules - SQLite storage
39
|-- .env # Inject Configuration via Environment
40
|-- manage.py # Start the app - Django default start script
41
|
42
|-- **************************************
Copied!
​

Charts Feature

This section describes the coding process for this feature that allows authenticated users to update their orders and sales.

Orders Table

This table will save the information shown in the charts on the main dashboard - Fields:
    ID: primary key
    Product Name: string
    Product Price: int
    Created Times: create transaction datetime
    Updated Times: update transaction datetime

Orders Application

The application that manages and implements all features:
    Allow users to save and edit a new order
      Via a popup window/separate window
    Populate the information on the main dashboard as presented below:
      Widget 1: Total Sales (in value)
      Widget 2: Peek Sale - transaction with Biggest Value
      Widget 3: Total Orders (sum up of all transactions)
      Widget 4: Best Month - selected by the number of orders
      Line Chart shows the sales for a 12mo timeframe
      Bar Chart shows the sales for a 12mo timeframe
​
Links & Resources:
Last modified 5mo ago