Professional Documents
Culture Documents
2. Expand your project “djangoproject“, open “settings.py” and add the app name
“stockmgmt” you created in step 1 above to “INSTALLED_APPS“. This will allow us to
manage the database of the app with Django commands such as makemigrations, migrate
etc.
Your installed app section should look like this:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'stockmgmt',
]
3. We need to create a table where the stock data will be saved. Below is the table
structure. This will be modified as we progress into the tutorial. Add this code to
models.py
class Stock(models.Model):
category = models.CharField(max_length=50, blank=True, null=True)
item_name = models.CharField(max_length=50, blank=True, null=True)
quantity = models.IntegerField(default='0', blank=True, null=True)
receive_quantity = models.IntegerField(default='0', blank=True, null=True)
receive_by = models.CharField(max_length=50, blank=True, null=True)
issue_quantity = models.IntegerField(default='0', blank=True, null=True)
issue_by = models.CharField(max_length=50, blank=True, null=True)
issue_to = models.CharField(max_length=50, blank=True, null=True)
phone_number = models.CharField(max_length=50, blank=True, null=True)
created_by = models.CharField(max_length=50, blank=True, null=True)
reorder_level = models.IntegerField(default='0', blank=True, null=True)
last_updated = models.DateTimeField(auto_now_add=False, auto_now=True)
export_to_CSV = models.BooleanField(default=False)
def __str__(self):
return self.item_name
4. Run the following commands for the tables to be created in the database
5. Register the model in admin so that we can insert data into the database table
from .models import Stock
admin.site.register(Stock)
3. Create a model form in forms.py. Name the form StockCreateform as shown below
class StockCreateForm(forms.ModelForm):
class Meta:
model = Stock
fields = ['category', 'item_name', 'quantity']
class StockCreateAdmin(admin.ModelAdmin):
list_display = ['category', 'item_name', 'quantity']
form = StockCreateForm
list_filter = ['category']
search_fields = ['category', 'item_name']
admin.site.register(Stock, StockCreateAdmin)
1. Create a templates folder in stockmgmgt app where all HTML pages will be saved.
2. Create a home.html in the templates folder and add some text you want to display
3. In views.py is where you define what will be displayed when a user navigates to
a URL.
def home(request):
title = 'Welcome: This is the Home Page'
context = {
"title": title,
}
return render(request, "home.html",context)
4. Add a path / url for home page
urlpatterns = [
---
path('', views.home, name='home'),
---
5. Now go to localhost:8000 to view your beautify work
<!DOCTYPE html>
<html>
<head>
<title>Item List</title>
</head>
<body>
{{title}}<br>
{% for instance in queryset %}
{{instance.item_name}}, {{instance.quantity}}<br>
{% endfor %}
</body>
</html>
def list_item(request):
title = 'List of Items'
queryset = Stock.objects.all()
context = {
"title": title,
"queryset": queryset,
}
return render(request, "list_item.html", context)
3. Add the URL
def add_items(request):
form = StockCreateForm(request.POST or None)
if form.is_valid():
form.save()
context = {
"form": form,
"title": "Add Item",
}
return render(request, "add_items.html", context)
2. Add the URL
<!DOCTYPE html>
<html>
<head>
<title>{{title}}</title>
</head>
<body>
<form method='POST' action=''>{% csrf_token %}
{{form}}
<input type="submit" value='Save'/>
</form>
</body>
</html>
Import render redirect to allow you the page to be redirected to another after
saving the data.
if form.is_valid():
form.save()
return redirect('/list_items')
2. Create css, js and img folders inside static folder created in the point above
3. Create a file names stylesheet.css in CSS folder created above and paste in the
following:
body {
background-color: #34eb6b;
}
4. Load static in your HTML documents
{% load staticfiles %}
11-how-to-add-boostrap-to-django-without-cdn/
1. Download or copy the content of the bootstrap template you want to use from this
following URL: https://getbootstrap.com/docs/4.4/examples/
2. Right-click on the page and select view page source and save/copy the content in
your template folder and name it home.html.
4. Download all CSS, JS associated with the bootstrap framework you are using into
your CSS, JS folder.
Example:
bootstrap.min.css, navbar-fixed-top.css
12-how-to-add-bootstrap-to-django-using-cdn/
Got to https://getbootstrap.com/docs/4.4/getting-started/introduction/ and copy the
CDN for both the CSS and JS files to your HTML page
13-how-to-add-crispy-forms-to-django/
Crispy forms helps us style the input forms of our application with less code.
INSTALLED_APPS = (
…
'crispy_forms',
…
)
{{form|crispy}}
14-how-to-include-navbar-in-django/
1. Remove or just cut the navbar from all the pages. Usually from <nav> to </nav>
<nav ...>
</nav>
2. Create a new html page, name it navbar.html then paste in the content of navbar
content cut above
3. Above the body page, example home.html, add the following code to include the
navbar in the home page
{% include 'navbar.html' %}
15-how-to-list-items-in-a-table-in-django/
<table class='table'>
<thead>
<tr>
<th>COUNT</th>
<th>CATEGORY</th>
<th>ITEM NAME</th>
<th>QUANTITY IN STORE</th>
</tr>
</thead>
{% for instance in queryset %}
<tr>
<td>{{forloop.counter}}</td>
<td>{{instance.category}}</td>
<td>{{instance.item_name}}</td>
<td>{{instance.quantity}}</td>
</tr>
{% endfor %}
</table>
2. Open stylesheet.css
Update it with the following codes:
.table tr:nth-child(even){
background: #dae5f4
}
th {
background-color: #337ab7;
color: white;
}
<div class="display_table">
<table>
</table
</div><!--End of display table-->
4. Style the <div> element
.display_table{
border-bottom-right-radius: 20px;
/*border-bottom-left-radius: 20px;*/
padding-left: 5px;
padding-right: 5px;
padding-bottom: 20px;
box-shadow: 12px 12px 20px 6px #2e6da4;
}
5. Style the header text
<div class="header"{{header}}</div>
.header {
font-family: helvetica;
color: #337ab7;
font-size: 50px;
text-align: center;
width: 100%;
text-shadow: 6px 6px 6px #c9c6c6;
display: block;
font-weight: bolder;
}
6. Save and refresh the computer_list page
16-how-to-make-a-search-form-in-django/
1. Make a form in forms.py
class StockSearchForm(forms.ModelForm):
class Meta:
model = Stock
fields = ['category', 'item_name']
2. Import the form and add it to the view with a condition when to run the form
item_name__icontains=form['item_name'].value()
)
context = {
"form": form,
"header": header,
"queryset": queryset,
}
3. Add the form to the list_items.html tamplate
17-how-to-validate-and-prevent-duplicate-data-in-django-stock-management-system/
1. Open forms.py and validate the StockCreateForm
class StockCreateForm(forms.ModelForm):
class Meta:
model = Stock
fields = ['category', 'item_name', 'quantity']
def clean_category(self):
category = self.cleaned_data.get('category')
if not category:
raise forms.ValidationError('This field is required')
return category
def clean_item_name(self):
item_name = self.cleaned_data.get('item_name')
if not item_name:
raise forms.ValidationError('This field is required')
return item_name
2. Alerting and preventing the duplicate entry of computer name
18-how-to-update-data-in-django/
class StockUpdateForm(forms.ModelForm):
class Meta:
model = Stock
fields = ['category', 'item_name', 'quantity']
2. Import the form created in step 1 then create a view to handle and process
update request.
context = {
'form':form
}
return render(request, 'add_items.html', context)
19-how-to-delete-data-in-django-with-confirm-delete-prompt/
2. Create a new template and add a form with a “confirm delete” button
20-how-to-add-a-choice-field-in-django/
category_choice = (
('Furniture', 'Furniture'),
('IT Equipment', 'IT Equipment'),
('Phone', 'Phone'),
)
category = models.CharField(max_length=50, blank=True, null=True,
choices=category_choice)
21-how-to-add-a-foreign-field-in-django/
1. Create a category model
class Category(models.Model):
name = models.CharField(max_length=50, blank=True, null=True)
def __str__(self):
return self.name
2. Make migration and migrate
3. If you have any data in the existing Stock table, you will need to insert some
data in the category table before proceeding
class Stock(models.Model):
category = models.ForeignKey(Category, on_delete=models.CASCADE)
5. Chose a default ID for existing data in the Category table when prompted
(Usually when adding a new field to an existing table that has data)
22-how-to-export-data-to-csv-or-excel-in-django/
export_to_CSV = forms.BooleanField()
2. In views.py, import HttpResponse from django.http, and csv
if form['export_to_CSV'].value() == True:
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="List of
stock.csv"'
writer = csv.writer(response)
writer.writerow(['CATEGORY', 'ITEM NAME', 'QUANTITY'])
instance = queryset
for stock in instance:
writer.writerow([stock.category, stock.item_name,
stock.quantity])
return response
23-how-to-add-notification-in-django/
1. In views.py, import messages module
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif
%}>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
4. Style the message
.success{
list-style: none;
background-color: #2e6da4;
color: white;
box-shadow: 12px 12px 12px #e61c66;
text-align: center;
}
24-how-to-add-work-with-a-datefield-in-django-stock-management-system/
Adding Data: If you want to automatically add a date and time in a field only when
adding an object for the first time in a Django App, set the auto_now_add=True.
...
datefield = models.DateTimeField(auto_now_add=True, auto_now=False)
...
Updating Data: If you want to add date and time only when the object is being
edited, set auto_now=True
...
datefield = models.DateTimeField(auto_now_add=False, auto_now=True)
...
If you want to add date and time while adding or updating data, set both
auto_now_add=True and auto_now=True
...
datefield = models.DateTimeField(auto_now_add=True, auto_now=True)
...
If you want to only user’s of the application to choose the date and time, then set
both auto_not_add=False and auto_now=False
...
datefield = models.DateTimeField(auto_now_add=False, auto_now=False)
...
25-how-to-make-a-detail-page-in-django-stock-management-system/
26-updating-stock-level-issuing-and-receiving-stock/
1. Forms.py
class IssueForm(forms.ModelForm):
class Meta:
model = Stock
fields = ['issue_quantity', 'issue_to']
class ReceiveForm(forms.ModelForm):
class Meta:
model = Stock
fields = ['receive_quantity', 'receive_by']
2. VIEWS.PY
return redirect('/stock_detail/'+str(instance.id))
# return HttpResponseRedirect(instance.get_absolute_url())
context = {
"title": 'Issue ' + str(queryset.item_name),
"queryset": queryset,
"form": form,
"username": 'Issue By: ' + str(request.user),
}
return render(request, "add_items.html", context)
return redirect('/stock_detail/'+str(instance.id))
# return HttpResponseRedirect(instance.get_absolute_url())
context = {
"title": 'Reaceive ' + str(queryset.item_name),
"instance": queryset,
"form": form,
"username": 'Receive By: ' + str(request.user),
}
return render(request, "add_items.html", context)
27-how-to-configure-django-to-use-a-mysql-database/
MySQL server is one of the most stable relational database system. It has been
arround for long time and running behind a lot of website and applications. In this
tutorial, i will work you how to setup django to use MySQL server as the data store
for the application.
While we will be using MySQL on this tutorial, these steps should be similar to
other relational database systems like PostgreSQL.
We will be installing MySQL workbench but it is not required to run Django. MySQL
Workbench is only used to manage the database server by providing an easy Graphical
User Interface (GUI).
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'stockmgmt',
'USER': 'myusername',
'PASSWORD': 'myPassword',
}
}
STEP 5: CREATING TABLES IN THE NEWLY CREATED DATABASE
Django allows us to easily create tables in the database with a simple script
(python manage.py migrate)
Do migrate for Django to create the application tables to the newly configured
database.
You might want to delete all the files in the migration folder except __init__.py
if you want to are do a clean setup. Watch the video for more explanation.
./manage.py migrate
./manage.py runserver
28-how-to-setup-stock-reorder-level-alert/
class ReorderLevelForm(forms.ModelForm):
class Meta:
model = Stock
fields = ['reorder_level']
2. Make a view for reorder level
return redirect("/list_items")
context = {
"instance": queryset,
"form": form,
}
return render(request, "add_items.html", context)
3. Make a url for editing the reorder level
<td>
{% if instance.quantity <= instance.reorder_level %}
<div style="background-color: orange;">{{instance.quantity}}</div>
{% else %}{{instance.quantity}}
{% endif %}
</td>
5. Add a column for reorder level and make is clickable to update the reorder level
/29-how-to-authenticate-users-in-django-using-registration-redux/
1. Install django-registration-redux
INSTALLED_APPS = [
....
'registration', #should be immediately above 'django.contrib.auth'
....
]
3. Migrate for registration tables to be created in the database
./manage.py migrate
4. Add the following lines to your settings.py file
{% block title %}
{% endblock %}
{% block content %}
{% endblock %}
7. Login to the app through this url: localhost:8000/accounts/login
logout URL is: localhost:8000/accounts/logout
<ul class="navbar-nav">
{% if request.user.is_authenticated %}
<li><a href="/accounts/logout"><button class="btn btn-danger">{{ user }} |
Logout</button></a></li>
{% else %}
<li><a href="/accounts/login">Login</a></li>
{% endif %}
</ul>
9. Import login required decorator and place them above all views that needs login
before accessing
{% if request.user.is_authenticated %}
<li class="nav-item">
<a class="nav-link" href="/list_items">List Items</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/add_items">Add Items</a>
</li>
{% endif %}
30-how-to-keep-the-previous-version-of-data-or-the-model-object-in-django/
In this section of the tutorial, we are going to keep the previous version of our
data and use it as our stock update history.
We can archive this by copying the content of the updated data into another table
called StockHistory.
1. Create another table similar to the Stock table. We will use Django models to
create it as follows:
class StockHistory(models.Model):
category = models.ForeignKey(Category, on_delete=models.CASCADE, blank=True,
null=True)
item_name = models.CharField(max_length=50, blank=True, null=True)
quantity = models.IntegerField(default='0', blank=True, null=True)
receive_quantity = models.IntegerField(default='0', blank=True, null=True)
receive_by = models.CharField(max_length=50, blank=True, null=True)
issue_quantity = models.IntegerField(default='0', blank=True, null=True)
issue_by = models.CharField(max_length=50, blank=True, null=True)
issue_to = models.CharField(max_length=50, blank=True, null=True)
phone_number = models.CharField(max_length=50, blank=True, null=True)
created_by = models.CharField(max_length=50, blank=True, null=True)
reorder_level = models.IntegerField(default='0', blank=True, null=True)
last_updated = models.DateTimeField(auto_now_add=False, auto_now=False,
null=True)
timestamp = models.DateTimeField(auto_now_add=False, auto_now=False,
null=True)
Note that we are setting all the fields to accept blank data blank=True, null=True
and the date fields to auto_now_add=False, auto_now=False
This will give us the flexibility to pass data into it or leave it blank.
3. Open MySQL workbench or any other database client, update the properties of the
StockHistory table and remove all checkboxes on all fields.
4. Create a trigger in MySQL-Server that will copy the content of the Stock table
to the StockHistory table when adding the data for the first time and when updating
the data.
DELIMITER //
DROP TRIGGER IF EXISTS after_stockmgmt_stock_update//
CREATE TRIGGER after_stockmgmt_stock_update AFTER UPDATE ON stockmgmgt_stock FOR
EACH ROW
BEGIN
IF new.issue_quantity = 0
THEN INSERT INTO stockmgmgt_stockhistory(
id,
last_updated,
category_id,
item_name,
quantity,
receive_quantity,
receive_by)
VALUES(
new.id,
new.last_updated,
new.category_id,
new.item_name,
new.quantity,
new.receive_quantity,
new.receive_by);
ELSEIF new.receive_quantity = 0
THEN INSERT INTO stockmgmgt_stockhistory(
id,
last_updated,
category_id,
item_name,
issue_quantity,
issue_to,
issue_by,
quantity)
VALUES(
new.id,
new.last_updated,
new.category_id,
new.item_name,
new.issue_quantity,
new.issue_to,
new.issue_by,
new.quantity);
END IF;
END//
DELIMITER ;
Note that in the script above, we have a condition is True on when issue_quantity
and receive_quantity =0
For this to work, in issue_items view, you will need to insert this line
instance.receive_quantity = 0
right after:
instance = form.save(commit=False)
5: Make a view to list the content of the StockHistory table. Note that the
queryset is defined to pull data from the StockHistory model and not Stock model.
Don’t forget to import the StockHistory model.
@login_required
def list_history(request):
header = 'LIST OF ITEMS'
queryset = StockHistory.objects.all()
context = {
"header": header,
"queryset": queryset,
}
return render(request, "list_history.html",context)
<div class="display_table">
<table class='table'>
<thead>
<tr>
<th>COUNT</th>
<th>ID</th>
<th>CATEGORY</th>
<th>ITEM NAME</th>
<th>QUANTITY IN STORE</th>
<th>ISSUE QUANTITY</th>
<th>RECEIVE QUANTITY</th>
<th>LAST UPDATED</th>
</tr>
</thead>
{% for instance in queryset %}
<tr>
<td>{{forloop.counter}}</td>
<td>{{instance.id}}</td>
<td>{{instance.category}}</td>
<td><{{instance.item_name}}</td>
<td>{{instance.quantity}}</td>
<td>{{instance.issue_quantity}}</td>
<td>{{instance.receive_quantity}}</td>
<td>{{instance.last_updated}}</td>
</tr>
{% endfor %}
</table>
</div>
7: Make a URL for stockhistory list, and add the link in navbar.html
Add a URL in urls.py:
<li class="nav-item">
<a class="nav-link" href="/list_history">List History</a>
</li>
31-how-to-filter-stock-history-and-export-to-csv-stock-management-system/
1. Make a form in forms.py. Name the form StockSearchForm. This form will be used
for filtering the stockHistory objects. We are going to filter based on ctategory
and item_name. Therefore, we will make a form with two fields, category and
item_name as seen below.
NOTE: If you are following the tutorial from the beginning, you must have this form
already
class StockSearchForm(forms.ModelForm):
export_to_CSV = forms.BooleanField(required=False)
class Meta:
model = Stock
fields = ['category', 'item_name']
2. Make a condition in the list_history view to apply the filter when the search
button is selected.
item_name__icontains=form['item_name'].value()
)
if (category != ''):
queryset = queryset.filter(category_id=category)
context = {
"form": form,
"header": header,
"queryset": queryset,
}
3. Make a form inputs in list_history.html template
if form['export_to_CSV'].value() == True:
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="Stock
History.csv"'
writer = csv.writer(response)
writer.writerow(
['CATEGORY',
'ITEM NAME',
'QUANTITY',
'ISSUE QUANTITY',
'RECEIVE QUANTITY',
'RECEIVE BY',
'ISSUE BY',
'LAST UPDATED'])
instance = queryset
for stock in instance:
writer.writerow(
[stock.category,
stock.item_name,
stock.quantity,
stock.issue_quantity,
stock.receive_quantity,
stock.receive_by,
stock.issue_by,
stock.last_updated])
return response
32-rearranging-buttons-and-styling-pages/
In this blog, we want to rearrange the menus of our application. Removing them from
the nav-bar to the item-list page and then style the button.
We will use bootstrap rows and columns to archive this. Create a row with two
columns. The bootstrap row has a size of 12 columns. We will use 2 column size for
the form section of the page. The table section will take the remaining 10 columns.
</div><!--End of row-->
2. We have used a class named mybutton on the links to the add_items and
list_history
mybutton is styled with the following css to give it a full with of the row that it
is in
.mybutton{
width: 100%;
}
That will change the design of list_items page from this:
To this:
To This:
def home(request):
title = 'Welcome: This is the Home Page'
form = 'Welcome: This is the Home Page'
context = {
"title": title,
"test": form,
}
return redirect('/list_items')
5. Finally, remove the links from the nav-bar
33-how-to-do-a-date-range-filter-in-django-stock-management-system/
For example, we have an object that was issued out on different dates. Let’s say
one was
1 July 2020, 2nd July 2020, 5th July 2020, and 20th July 2020.
Now we want to filter all the issued items from 1st July 2020 up to today 28th July
2020.
This type of filter is what we want to archieve in this tutorial.
Feel free to leave a comment if you have any issue or needed some clarification
while implimenting this cool little feature.
class StockHistorySearchForm(forms.ModelForm):
export_to_CSV = forms.BooleanField(required=False)
start_date = forms.DateTimeField(required=False)
end_date = forms.DateTimeField(required=False)
class Meta:
model = StockHistory
fields = ['category', 'item_name', 'start_date', 'end_date']
STEP 2. CREATE THE FILTER IN VIEWS.PY
Now that we have a form with the a start and end date field, we can use this fields
to do a range filter in the StockHistory Model.
In views.py, import and use the form created above in list_history view and then
add a filter criterion that looks for the date within the start and end date in the
form above.
queryset = StockHistory.objects.filter(
item_name__icontains=form['item_name'].value(),
last_updated__range=[
form['start_date'].value(),
form['end_date'].value()
]
)
NOTE: With this example (using date range), when selecting the start and end date,
the end date should be one day beyond the last date you want to to display in the
output. For example, if you want to select a date from
Set your start date as 1st July 2020 and set the end date to 29th July 2020
34-how-to-add-jquery-and-jquery-ui-datepicker-to-django-stock-management-system/
3. Link all the js and css files in both jQuery and jQuery-ui to the templates
(html pages)
4. Create a custom.js file in static/js folder where you will specify all your js
codes. In this file, add the following codes:
$(document).ready(function(){
});
35-setting-up-modal-background-image-stock-management-system/
In this video, we will show you how to add backgroud image to the application, fade
in effect and fake loader in your application. In the dome video, you will notice
the application fades in when loading pages.
There is also a version button which when clicked, opens a modal with system
information as the content of the modal page.
i. Copy the background image is img folder inside located in static folder.
ii. Open stylesheet.css and paste in this code below then refresh your application
while holding the ctrl key on the keyboard
body {
background-image: url("../img/bg.jpg");
}
2. ADDING MODAL PAGE
We want the version to be shown on all pages of the application. Add the modal page
content to the navbar since it’s visible on all pages.
<div class="modal-header">
<!-- <button type="button" class="close" data-
dismiss="modal">×</button> -->
<h4 class="modal-title">System Information</h4>
</div>
<div class="modal-body">
<div class="dev-info">
<p class=""><b>STOCK MANAGEMENT INFORMATION SYSTEMS</b></p>
<p>VERSION: 1.O</p><br>
<p class="modal-header">DEVELOPER:</p>
<p>Arbcoms</p>
<p>4444444</p>
<p><img src="/static/img/logo.png" alt="Developer Logo"></p>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-
dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
MODAL CSS
Apply this css to style the Modal and appy the animation when the button is clicked
/* Version Button */
#version-display{
background-color: #e61c66;
color: white;
box-shadow: 5px 12px 12px #2e6da4;
text-align: center;
display: inline;
font-weight: bolder;
padding: 15px;
position: fixed;
top: 40px;
left: -5px;
z-index: 3000;
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
}
/* Modal Header */
.modal-header {
padding: 2px 16px;
background-color: #e61c66;
color: white;
}
/* Modal Body */
.modal-body {padding: 2px 16px;}
/* Modal Footer */
.modal-footer {
padding: 2px 16px;
background-color: #e61c66;
color: white;
}
/* Modal Content */
.modal-content {
position: relative;
background-color: #fefefe;
margin: auto;
padding: 0;
border: 1px solid #888;
width: 100%;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
.dev-info{
width: 50%;
text-align: center;
font-family: helvetica;
font-weight: bold;
display: inline;
}
.dev-info-logo{
width: 50px;
float: left;
}
36-how-to-add-pagination-plus-fancy-progress-bar-in-django/
As our data grow, our table contains more and more data to display. Keeping this on
one page can make the users to scroll and keep scrolling to find data. Will it not
be nice to add some cool little pages so that our data gets more organized.
To make the app even fancier, we will add some dummy page loader progress bar. We
will not check how much page content is loaded but this can still be used for that.
That will be for another tutorial.
Setting up pagination
1. Download pagination plugin from the following url then extract and move it to
your js folder.
https://www.jqueryscript.net/table/Client-side-HTML-Table-Pagination-Plugin-with-
jQuery-Paging.html
$('.table').paging({limit:15});
Style the page buttons:
.paging-nav a {
margin: auto 1px;
text-decoration: none;
display: inline-block;
padding: 1px 7px;
background: #3287a8;
color: white;
border-radius: 100px;
}
.paging-nav .selected-page {
font-weight: bold;
color: #dc3545;
}
/* End Table paination styling*/
Setting up Progress Bar
1. Download NProgress from the URL provided below, extract it and move it to js
folder in your project.
https://github.com/rstacruz/nprogress
CSS Files:
NProgress.start();
NProgress.done();
Make sure myjs.js is in all your templates or at least on all the pages where you
want to run pagination and NProgress
https://arbcoms.com/whats-next-apps-coming-up/
Hello everyone. In this video, we will discuss few apps that are coming up with a
short dome. We thing this will give you a good understanding of how to build apps
using django framework.