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
975d3d4a
Unverified
Commit
975d3d4a
authored
Jul 24, 2016
by
Joost Rijneveld
Browse files
Rename generic documents to miscellaneous
parent
2fb85e3b
Changes
6
Hide whitespace changes
Inline
Side-by-side
website/documents/admin.py
View file @
975d3d4a
from
django.contrib
import
admin
from
documents.models
import
AssociationDocumentsYear
from
documents.models
import
Generic
Document
from
documents.models
import
Miscellaneous
Document
from
documents.models
import
GeneralMeeting
,
GeneralMeetingDocument
...
...
@@ -14,5 +14,5 @@ class GeneralMeetingAdmin(admin.ModelAdmin):
inlines
=
(
GeneralMeetingDocInline
,
)
admin
.
site
.
register
(
Generic
Document
)
admin
.
site
.
register
(
Miscellaneous
Document
)
admin
.
site
.
register
(
AssociationDocumentsYear
)
website/documents/migrations/0003_auto_20160724_1314.py
0 → 100644
View file @
975d3d4a
# -*- coding: utf-8 -*-
# Generated by Django 1.10b1 on 2016-07-24 11:14
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
import
utils.validators
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'documents'
,
'0002_auto_20160723_1247'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'MiscellaneousDocument'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'name'
,
models
.
CharField
(
max_length
=
200
)),
(
'file'
,
models
.
FileField
(
upload_to
=
'documents/miscellaneous/'
,
validators
=
[
utils
.
validators
.
validate_file_extension
])),
(
'members_only'
,
models
.
BooleanField
(
default
=
False
)),
],
),
migrations
.
DeleteModel
(
name
=
'GenericDocument'
,
),
]
website/documents/models.py
View file @
975d3d4a
...
...
@@ -29,10 +29,10 @@ class AssociationDocumentsYear(models.Model):
return
"{}-{}"
.
format
(
self
.
year
,
self
.
year
+
1
)
class
Generic
Document
(
models
.
Model
):
class
Miscellaneous
Document
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
200
)
file
=
models
.
FileField
(
upload_to
=
'documents/
generic
/'
,
upload_to
=
'documents/
miscellaneous
/'
,
validators
=
[
validate_file_extension
],
)
members_only
=
models
.
BooleanField
(
default
=
False
)
...
...
website/documents/templates/documents/index.html
View file @
975d3d4a
...
...
@@ -16,8 +16,8 @@
<div
class=
"portfolio"
>
<ul
class=
"portfolio-posts row generalcontainer"
>
{% for
generic_document in generic
_documents %}
{% include 'documents/
generic
.html' with document=
generic
_document %}
{% for
miscellaneous_document in miscellaneous
_documents %}
{% include 'documents/
miscellaneous
.html' with document=
miscellaneous
_document %}
{% endfor %}
</ul>
</div>
...
...
website/documents/templates/documents/
generic
.html
→
website/documents/templates/documents/
miscellaneous
.html
View file @
975d3d4a
File moved
website/documents/views.py
View file @
975d3d4a
from
django.shortcuts
import
render
from
django.utils
import
timezone
from
documents.models
import
AssociationDocumentsYear
,
Generic
Document
from
documents.models
import
AssociationDocumentsYear
,
Miscellaneous
Document
def
index
(
request
):
...
...
@@ -20,7 +20,7 @@ def index(request):
except
ValueError
:
docs
.
remove
(
doc
)
context
=
{
'
generic_documents'
:
Generic
Document
.
objects
.
all
(),
context
=
{
'
miscellaneous_documents'
:
Miscellaneous
Document
.
objects
.
all
(),
'association_documents_years'
:
sorted
(
years
.
items
(),
reverse
=
True
),
# TODO ideally we want to do this dynamically in CSS
...
...
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