Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
concrexit
Commits
d7a8f23a
Unverified
Commit
d7a8f23a
authored
Jul 27, 2016
by
Thom Wiggers
📐
Browse files
Committee overview page
parent
8cd922e8
Changes
8
Hide whitespace changes
Inline
Side-by-side
website/committees/models.py
View file @
d7a8f23a
...
...
@@ -2,6 +2,7 @@ import datetime
import
logging
from
django.core.exceptions
import
ValidationError
,
NON_FIELD_ERRORS
from
django.core.urlresolvers
import
reverse
from
django.contrib.auth.models
import
Permission
from
django.db
import
models
from
django.utils
import
timezone
...
...
@@ -45,6 +46,7 @@ class Committee(models.Model):
photo
=
models
.
ImageField
(
verbose_name
=
_
(
'Image'
),
upload_to
=
'public/committeephotos/'
,
)
members
=
models
.
ManyToManyField
(
...
...
@@ -75,6 +77,9 @@ class Committee(models.Model):
def
__str__
(
self
):
return
self
.
name
def
get_absolute_url
(
self
):
return
reverse
(
'committees:details'
,
args
=
[
str
(
self
.
pk
)])
class
Meta
:
verbose_name
=
_
(
'committee'
)
verbose_name_plural
=
_
(
'committees'
)
...
...
website/committees/templates/committees/index.html
0 → 100644
View file @
d7a8f23a
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans 'Committees' %} — {{ block.super }}{% endblock %}
{% block page_title %}{% trans 'Committees' %}{% endblock %}
{% block body %}
<h1>
{% trans 'Committees' %}
</h1>
<div
class=
"clearfix portfolio"
>
<div
id=
"committees"
>
<ul
class=
"row committees"
>
{% for committee in committees %}
<li
class=
"post member-item span3 has-overlay first-child"
>
<a
href=
"{{ committee.get_absolute_url }}"
>
<div
class=
"post-inner"
>
<div
class=
"inner-img"
>
<img
src=
"{{ MEDIA_URL }}{{ committee.photo }}"
alt=
"{{ committee.name }}"
>
</div>
<div
class=
"post-overlay"
>
<div
class=
"post-overlay-meta"
>
<h2>
{{ committee.name }}
</h2>
</div>
</div>
<div
class=
"post-body avatar-subtitle"
>
{{ committee.name }}
</div>
</div>
</a>
</li>
{% empty %}
{% trans 'There are no committees!' %}
{% endfor %}
</ul>
</div>
</div>
{% endblock %}
website/committees/urls.py
0 → 100644
View file @
d7a8f23a
"""
Committees URL Configuration
"""
from
django.conf.urls
import
url
from
.
import
views
urlpatterns
=
[
url
(
r
'^$'
,
views
.
index
,
name
=
'index'
),
url
(
r
'^details/(?P<committee_id>\d)/$'
,
views
.
details
,
name
=
'details'
),
]
website/committees/views.py
View file @
d7a8f23a
#
from django.shortcuts import render
from
django.shortcuts
import
render
,
get_object_or_404
# Create your views here.
from
.models
import
Committee
def
index
(
request
):
"""Overview of committees"""
committees
=
Committee
.
objects
.
all
()
return
render
(
request
,
'committees/index.html'
,
{
'committees'
:
committees
})
def
details
(
request
,
committee_id
):
"""View the details of a committee"""
committee
=
get_object_or_404
(
Committee
,
pk
=
committee_id
)
return
render
(
request
,
'committee/details.html'
,
{
'committee'
:
committee
})
website/thaliawebsite/menus.py
View file @
d7a8f23a
...
...
@@ -4,7 +4,7 @@ main = [
{
'title'
:
_
(
'Home'
),
'name'
:
'index'
},
{
'title'
:
_
(
'Association'
),
'name'
:
'#'
,
'submenu'
:
[
{
'title'
:
_
(
'Board'
),
'name'
:
'#'
},
{
'title'
:
_
(
'Committees'
),
'name'
:
'
#
'
},
{
'title'
:
_
(
'Committees'
),
'name'
:
'
committees:index
'
},
{
'title'
:
_
(
'Members'
),
'name'
:
'#'
},
{
'title'
:
_
(
'Documents'
),
'name'
:
'documents:index'
},
{
'title'
:
_
(
'Members'
),
'name'
:
'#'
},
...
...
website/thaliawebsite/settings/settings.py
View file @
d7a8f23a
...
...
@@ -71,6 +71,7 @@ TEMPLATES = [
'context_processors'
:
[
'django.template.context_processors.debug'
,
'django.template.context_processors.request'
,
'django.template.context_processors.media'
,
'django.contrib.auth.context_processors.auth'
,
'django.contrib.messages.context_processors.messages'
,
],
...
...
@@ -146,6 +147,7 @@ LOCALE_PATHS = ('locale',)
# Where to store uploaded files
MEDIA_ROOT
=
os
.
path
.
join
(
BASE_DIR
,
'media'
)
MEDIA_URL
=
'/media/public/'
SENDFILE_BACKEND
=
'sendfile.backends.development'
...
...
website/thaliawebsite/templates/base.html
View file @
d7a8f23a
...
...
@@ -6,6 +6,8 @@
<head>
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><![endif]-->
<title>
{% block title %}{% trans "Study Association Thalia" %}{% endblock %}
</title>
<!-- mobile -->
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, maximum-scale=1"
>
...
...
website/thaliawebsite/urls.py
View file @
d7a8f23a
...
...
@@ -13,7 +13,11 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
import
os.path
from
django.conf
import
settings
from
django.conf.urls
import
url
,
include
from
django.conf.urls.static
import
static
from
django.contrib
import
admin
from
django.views.generic
import
TemplateView
...
...
@@ -23,8 +27,9 @@ urlpatterns = [
url
(
r
'^members/'
,
include
(
'members.urls'
)),
url
(
r
'^nyi$'
,
TemplateView
.
as_view
(
template_name
=
'status/nyi.html'
),
name
=
'#'
),
url
(
r
'^association/'
,
include
([
url
(
r
'^
sister-associations'
,
TemplateView
.
as_view
(
template_name
=
'singlepages/sister_associations.html'
),
name
=
'sister-association
s'
),
url
(
r
'^
committees/'
,
include
(
'committees.urls'
,
namespace
=
'committee
s'
)
)
,
url
(
r
'^documents/'
,
include
(
'documents.urls'
,
namespace
=
'documents'
)),
url
(
r
'^sister-associations'
,
TemplateView
.
as_view
(
template_name
=
'singlepages/sister_associations.html'
),
name
=
'sister-associations'
),
])),
url
(
r
'^for-members/'
,
include
([
url
(
r
'^become-active'
,
TemplateView
.
as_view
(
template_name
=
'singlepages/become_active.html'
),
name
=
'become-active'
),
...
...
@@ -33,4 +38,5 @@ urlpatterns = [
# Default login helpers
url
(
r
'^'
,
include
(
'django.contrib.auth.urls'
)),
url
(
r
'^i18n/'
,
include
(
'django.conf.urls.i18n'
)),
]
]
+
static
(
settings
.
MEDIA_URL
,
document_root
=
os
.
path
.
join
(
settings
.
MEDIA_ROOT
,
'public'
))
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment