Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
280acb2c
Commit
280acb2c
authored
May 29, 2017
by
Mario Chirinos Colunga
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
92541ec5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
82 additions
and
1 deletion
+82
-1
urls.cpython-35.pyc
sidtSite/catalog/__pycache__/urls.cpython-35.pyc
+0
-0
views.cpython-35.pyc
sidtSite/catalog/__pycache__/views.cpython-35.pyc
+0
-0
styles.css
sidtSite/catalog/static/css/styles.css
+5
-0
base_generic.html
sidtSite/catalog/templates/base_generic.html
+38
-0
index.html
sidtSite/catalog/templates/index.html
+18
-0
urls.py
sidtSite/catalog/urls.py
+1
-1
views.py
sidtSite/catalog/views.py
+20
-0
No files found.
sidtSite/catalog/__pycache__/urls.cpython-35.pyc
View file @
280acb2c
No preview for this file type
sidtSite/catalog/__pycache__/views.cpython-35.pyc
View file @
280acb2c
No preview for this file type
sidtSite/catalog/static/css/styles.css
0 → 100644
View file @
280acb2c
.sidebar-nav
{
margin-top
:
20px
;
padding
:
0
;
list-style
:
none
;
}
sidtSite/catalog/templates/base_generic.html
0 → 100644
View file @
280acb2c
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
{% block title %}
<title>
Local Library
</title>
{% endblock %}
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<link
rel=
"stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"
></script>
<script
src=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
></script>
<!-- Add additional CSS in static file -->
{% load static %}
<link
rel=
"stylesheet"
href=
"{% static 'css/styles.css' %}"
>
</head>
<body>
<div
class=
"container-fluid"
>
<div
class=
"row"
>
<div
class=
"col-sm-2"
>
{% block sidebar %}
<ul
class=
"sidebar-nav"
>
<li><a
href=
"{% url 'index' %}"
>
Home
</a></li>
<li><a
href=
""
>
All books
</a></li>
<li><a
href=
""
>
All authors
</a></li>
</ul>
{% endblock %}
</div>
<div
class=
"col-sm-10 "
>
{% block content %}{% endblock %}
</div>
</div>
</div>
</body>
</html>
sidtSite/catalog/templates/index.html
0 → 100644
View file @
280acb2c
{% extends "base_generic.html" %}
{% block content %}
<h1>
Local Library Home
</h1>
<p>
Welcome to
<em>
LocalLibrary
</em>
, a very basic Django website developed as a tutorial example on the Mozilla Developer Network.
</p>
<h2>
Dynamic content
</h2>
<p>
The library has the following record counts:
</p>
<ul>
<li><strong>
Books:
</strong>
{{ num_books }}
</li>
<li><strong>
Copies:
</strong>
{{ num_instances }}
</li>
<li><strong>
Copies available:
</strong>
{{ num_instances_available }}
</li>
<li><strong>
Authors:
</strong>
{{ num_authors }}
</li>
</ul>
{% endblock %}
sidtSite/catalog/urls.py
View file @
280acb2c
...
...
@@ -5,5 +5,5 @@ from . import views
urlpatterns
=
[
url
(
r'^$'
,
views
.
index
,
name
=
'index'
),
url
(
r'^books/$'
,
views
.
BookListView
.
as_view
(),
name
=
'books'
),
]
sidtSite/catalog/views.py
View file @
280acb2c
from
django.shortcuts
import
render
# Create your views here.
from
.models
import
Book
,
Author
,
BookInstance
,
Genre
def
index
(
request
):
"""
View function for home page of site.
"""
# Generate counts of some of the main objects
num_books
=
Book
.
objects
.
all
()
.
count
()
num_instances
=
BookInstance
.
objects
.
all
()
.
count
()
# Available books (status = 'a')
num_instances_available
=
BookInstance
.
objects
.
filter
(
status__exact
=
'a'
)
.
count
()
num_authors
=
Author
.
objects
.
count
()
# The 'all()' is implied by default.
# Render the HTML template index.html with the data in the context variable
return
render
(
request
,
'index.html'
,
context
=
{
'num_books'
:
num_books
,
'num_instances'
:
num_instances
,
'num_instances_available'
:
num_instances_available
,
'num_authors'
:
num_authors
},
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment