Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
dec530e1
Unverified
Commit
dec530e1
authored
5 years ago
by
Martin Gummi
Browse files
Options
Downloads
Patches
Plain Diff
Add person card
parent
64f6b548
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!7
Add person card
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
biscuit/core/templates/core/person_card.html
+19
-0
19 additions, 0 deletions
biscuit/core/templates/core/person_card.html
biscuit/core/urls.py
+1
-0
1 addition, 0 deletions
biscuit/core/urls.py
biscuit/core/views.py
+20
-0
20 additions, 0 deletions
biscuit/core/views.py
with
40 additions
and
0 deletions
biscuit/core/templates/core/person_card.html
0 → 100644
+
19
−
0
View file @
dec530e1
{% load bootstrap4 staticfiles i18n %}
<div
class=
"card mb-3"
>
<div
class=
"row no-gutters"
>
<div
class=
"col-md-4"
>
{% if person.jpeg_photo_url %}
<img
class=
"person-img"
src=
"{{ person.jpeg_photo_url }}"
alt=
"{{ person.first_name }} {{ person.last_name }}"
/>
{% else %}
<img
class=
"person-img"
src=
"{% static 'img/fallback.png' %}"
alt=
"{{ person.first_name }} {{ person.last_name }}"
/>
{% endif %}
</div>
<div
class=
"col-md-8"
>
<h3
class=
"card-header"
>
{{ person.first_name }} {{ person.last_name }}
</h3>
<div
class=
"card-body"
>
<h5
class=
"card-text"
>
!Group
</h5>
<p
class=
"card-text"
>
{{ person.date_of_birth|date }}
</p>
</div>
</div>
</div>
</div>
This diff is collapsed.
Click to expand it.
biscuit/core/urls.py
+
1
−
0
View file @
dec530e1
...
...
@@ -10,6 +10,7 @@ urlpatterns = [
path
(
'
admin/
'
,
admin
.
site
.
urls
),
path
(
'
accounts/
'
,
include
(
'
django.contrib.auth.urls
'
)),
path
(
'
persons
'
,
views
.
persons
,
name
=
'
persons
'
),
path
(
'
person_card/<int:id>
'
,
views
.
person_card
,
name
=
'
person_card_by_id
'
),
path
(
''
,
views
.
index
,
name
=
'
index
'
),
]
...
...
This diff is collapsed.
Click to expand it.
biscuit/core/views.py
+
20
−
0
View file @
dec530e1
from
django.contrib.auth.decorators
import
login_required
from
django.shortcuts
import
render
from
django_tables2
import
RequestConfig
from
django.http
import
Http404
from
.models
import
Person
from
.tables
import
PersonsTable
...
...
@@ -21,3 +22,22 @@ def persons(request):
context
[
'
persons_table
'
]
=
persons_table
return
render
(
request
,
'
core/persons.html
'
,
context
)
@login_required
def
person_card
(
request
,
id
=
None
):
context
=
{}
# Raise Http404 if now id is given
if
id
is
None
:
raise
Http404
# Get person and check access
try
:
person
=
Person
.
objects
.
get
(
id
=
id
)
except
ObjectDoesNotExist
as
e
:
# Turn not-found object into a 404 error
raise
Http404
from
e
context
[
'
person
'
]
=
person
return
render
(
request
,
'
core/person_card.html
'
,
context
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment