Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Sith
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
59
Issues
59
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AE
Sith
Commits
39b32d45
Commit
39b32d45
authored
Mar 24, 2017
by
Skia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some com templates improvments and reordering some models
parent
d2da5716
Pipeline
#812
failed with stage
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
94 additions
and
6 deletions
+94
-6
accounting/migrations/0005_auto_20170324_0917.py
accounting/migrations/0005_auto_20170324_0917.py
+19
-0
club/migrations/0007_auto_20170324_0917.py
club/migrations/0007_auto_20170324_0917.py
+18
-0
club/models.py
club/models.py
+3
-0
com/models.py
com/models.py
+2
-0
com/templates/com/weekmail.jinja
com/templates/com/weekmail.jinja
+9
-1
com/urls.py
com/urls.py
+1
-1
com/views.py
com/views.py
+12
-4
core/migrations/0020_auto_20170324_0917.py
core/migrations/0020_auto_20170324_0917.py
+24
-0
core/models.py
core/models.py
+4
-0
core/templates/core/user_tools.jinja
core/templates/core/user_tools.jinja
+2
-0
No files found.
accounting/migrations/0005_auto_20170324_0917.py
0 → 100644
View file @
39b32d45
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'accounting'
,
'0004_auto_20161005_1505'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'operation'
,
name
=
'remark'
,
field
=
models
.
CharField
(
null
=
True
,
max_length
=
128
,
blank
=
True
,
verbose_name
=
'comment'
),
),
]
club/migrations/0007_auto_20170324_0917.py
0 → 100644
View file @
39b32d45
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'club'
,
'0006_auto_20161229_0040'
),
]
operations
=
[
migrations
.
AlterModelOptions
(
name
=
'club'
,
options
=
{
'ordering'
:
[
'name'
,
'unix_name'
]},
),
]
club/models.py
View file @
39b32d45
...
...
@@ -38,6 +38,9 @@ class Club(models.Model):
home
=
models
.
OneToOneField
(
SithFile
,
related_name
=
'home_of_club'
,
verbose_name
=
_
(
"home"
),
null
=
True
,
blank
=
True
,
on_delete
=
models
.
SET_NULL
)
class
Meta
:
ordering
=
[
'name'
,
'unix_name'
]
def
check_loop
(
self
):
"""Raise a validation error when a loop is found within the parent list"""
objs
=
[]
...
...
com/models.py
View file @
39b32d45
...
...
@@ -125,3 +125,5 @@ class WeekmailArticle(models.Model):
def
is_owned_by
(
self
,
user
):
return
user
.
is_in_group
(
settings
.
SITH_GROUP_COM_ADMIN_ID
)
def
__str__
(
self
):
return
"%s - %s (%s)"
%
(
self
.
title
,
self
.
author
,
self
.
club
)
com/templates/com/weekmail.jinja
View file @
39b32d45
...
...
@@ -9,6 +9,7 @@
<h3>
{%
trans
%}
Weekmail
{%
endtrans
%}
{{
object.id
}}
</h3>
<p><a
href=
"
{{
url
(
'com:weekmail_preview'
)
}}
"
>
{%
trans
%}
Preview
{%
endtrans
%}
</a></p>
<p><a
href=
"
{{
url
(
'com:weekmail_preview'
)
}}
?send=true"
>
{%
trans
%}
Send
{%
endtrans
%}
</a></p>
<p><a
href=
"
{{
url
(
'com:weekmail_article'
)
}}
"
>
{%
trans
%}
New article
{%
endtrans
%}
</a></p>
<h4>
{%
trans
%}
Articles in no weekmail yet
{%
endtrans
%}
</h4>
<table>
<thead>
...
...
@@ -27,7 +28,13 @@
<td><a
href=
"
{{
a.club.get_absolute_url
()
}}
"
>
{{
a.club
}}
</a></td>
<td>
{{
a.title
}}
</td>
<td>
{{
a.content
|
markdown
}}
</td>
<td><a
href=
"?add_article=
{{
a.id
}}
"
>
{%
trans
%}
Add to weekmail
{%
endtrans
%}
</a></td>
<td>
<a
href=
"
{{
url
(
'com:weekmail_article_edit'
,
article_id
=
a.id
)
}}
"
>
{%
trans
%}
Edit
{%
endtrans
%}
</a>
|
<a
href=
"
{{
url
(
'com:weekmail_article_delete'
,
article_id
=
a.id
)
}}
"
>
{%
trans
%}
Delete
{%
endtrans
%}
</a>
|
<a
href=
"?add_article=
{{
a.id
}}
"
>
{%
trans
%}
Add to weekmail
{%
endtrans
%}
</a>
|
<a
href=
"?up_article=
{{
a.id
}}
"
>
{%
trans
%}
Up
{%
endtrans
%}
</a>
|
<a
href=
"?down_article=
{{
a.id
}}
"
>
{%
trans
%}
Down
{%
endtrans
%}
</a>
</td>
</tr>
{%
endfor
%}
</tbody>
...
...
@@ -52,6 +59,7 @@
<td>
{{
a.content
|
markdown
}}
</td>
<td>
<a
href=
"
{{
url
(
'com:weekmail_article_edit'
,
article_id
=
a.id
)
}}
"
>
{%
trans
%}
Edit
{%
endtrans
%}
</a>
|
<a
href=
"
{{
url
(
'com:weekmail_article_delete'
,
article_id
=
a.id
)
}}
"
>
{%
trans
%}
Delete
{%
endtrans
%}
</a>
|
<a
href=
"?del_article=
{{
a.id
}}
"
>
{%
trans
%}
Delete from weekmail
{%
endtrans
%}
</a>
|
<a
href=
"?up_article=
{{
a.id
}}
"
>
{%
trans
%}
Up
{%
endtrans
%}
</a>
|
<a
href=
"?down_article=
{{
a.id
}}
"
>
{%
trans
%}
Down
{%
endtrans
%}
</a>
...
...
com/urls.py
View file @
39b32d45
...
...
@@ -9,7 +9,7 @@ urlpatterns = [
url
(
r
'^sith/edit/weekmail_destinations$'
,
WeekmailDestinationEditView
.
as_view
(),
name
=
'weekmail_destinations'
),
url
(
r
'^weekmail$'
,
WeekmailEditView
.
as_view
(),
name
=
'weekmail'
),
url
(
r
'^weekmail/preview$'
,
WeekmailPreviewView
.
as_view
(),
name
=
'weekmail_preview'
),
url
(
r
'^weekmail/club/(
?P<club_id>[0-9]+)/
new_article$'
,
WeekmailArticleCreateView
.
as_view
(),
name
=
'weekmail_article'
),
url
(
r
'^weekmail/club/(
(?P<club_id>[0-9]+)/)?
new_article$'
,
WeekmailArticleCreateView
.
as_view
(),
name
=
'weekmail_article'
),
url
(
r
'^weekmail/article/(?P<article_id>[0-9]+)/delete$'
,
WeekmailArticleDeleteView
.
as_view
(),
name
=
'weekmail_article_delete'
),
url
(
r
'^weekmail/article/(?P<article_id>[0-9]+)/edit$'
,
WeekmailArticleEditView
.
as_view
(),
name
=
'weekmail_article_edit'
),
url
(
r
'^news$'
,
NewsListView
.
as_view
(),
name
=
'news_list'
),
...
...
com/views.py
View file @
39b32d45
...
...
@@ -315,7 +315,7 @@ class WeekmailEditView(ComTabsMixin, QuickNotifMixin, CanEditPropMixin, UpdateVi
class
WeekmailArticleEditView
(
ComTabsMixin
,
QuickNotifMixin
,
CanEditPropMixin
,
UpdateView
):
"""Edit an article"""
model
=
WeekmailArticle
fields
=
[
'title'
,
'content'
]
fields
=
[
'title'
,
'c
lub'
,
'c
ontent'
]
pk_url_kwarg
=
"article_id"
template_name
=
'core/edit.jinja'
success_url
=
reverse_lazy
(
'com:weekmail'
)
...
...
@@ -325,14 +325,21 @@ class WeekmailArticleEditView(ComTabsMixin, QuickNotifMixin, CanEditPropMixin, U
class
WeekmailArticleCreateView
(
QuickNotifMixin
,
CreateView
):
#XXX need to protect this view
"""Post an article"""
model
=
WeekmailArticle
fields
=
[
'title'
,
'content'
]
fields
=
[
'title'
,
'c
lub'
,
'c
ontent'
]
template_name
=
'core/create.jinja'
success_url
=
reverse_lazy
(
'core:user_tools'
)
quick_notif_url_arg
=
"qn_weekmail_new_article"
def
get_initial
(
self
):
init
=
{}
try
:
init
[
'club'
]
=
Club
.
objects
.
filter
(
id
=
self
.
kwargs
[
'club_id'
]).
first
()
except
:
pass
return
init
def
form_valid
(
self
,
form
):
club
=
get_object_or_404
(
Club
,
id
=
self
.
kwargs
[
'club_id'
])
form
.
instance
.
club
=
club
#
club = get_object_or_404(Club, id=self.kwargs['club_id'])
#
form.instance.club = club
form
.
instance
.
author
=
self
.
request
.
user
return
super
(
WeekmailArticleCreateView
,
self
).
form_valid
(
form
)
...
...
@@ -340,6 +347,7 @@ class WeekmailArticleDeleteView(CanEditPropMixin, DeleteView):
"""Delete an article"""
model
=
WeekmailArticle
template_name
=
'core/delete_confirm.jinja'
pk_url_kwarg
=
"article_id"
...
...
core/migrations/0020_auto_20170324_0917.py
0 → 100644
View file @
39b32d45
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
import
django.core.validators
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'core'
,
'0019_preferences_receive_weekmail'
),
]
operations
=
[
migrations
.
AlterModelOptions
(
name
=
'group'
,
options
=
{
'ordering'
:
[
'name'
]},
),
migrations
.
AlterField
(
model_name
=
'page'
,
name
=
'name'
,
field
=
models
.
CharField
(
validators
=
[
django
.
core
.
validators
.
RegexValidator
(
'^[A-z.+-]+$'
,
'Enter a valid page name. This value may contain only unaccented letters, numbers and ./+/-/_ characters.'
)],
max_length
=
30
,
verbose_name
=
'page unix name'
),
),
]
core/models.py
View file @
39b32d45
...
...
@@ -33,6 +33,10 @@ class Group(AuthGroup):
help_text
=
_
(
'Whether a group is a meta group or not'
),
)
description
=
models
.
CharField
(
_
(
'description'
),
max_length
=
60
)
class
Meta
:
ordering
=
[
'name'
]
def
get_absolute_url
(
self
):
"""
This is needed for black magic powered UpdateView's children
...
...
core/templates/core/user_tools.jinja
View file @
39b32d45
...
...
@@ -66,8 +66,10 @@
<h4>
{%
trans
%}
Communication
{%
endtrans
%}
</h4>
<ul>
{%
if
user.is_in_group
(
settings.SITH_GROUP_COM_ADMIN_ID
)
or
user.is_root
%}
<li><a
href=
"
{{
url
(
'com:weekmail_article'
)
}}
"
>
{%
trans
%}
Create weekmail article
{%
endtrans
%}
</a></li>
<li><a
href=
"
{{
url
(
'com:weekmail'
)
}}
"
>
{%
trans
%}
Weekmail
{%
endtrans
%}
</a></li>
<li><a
href=
"
{{
url
(
'com:weekmail_destinations'
)
}}
"
>
{%
trans
%}
Weekmail destinations
{%
endtrans
%}
</a></li>
<li><a
href=
"
{{
url
(
'com:news_new'
)
}}
"
>
{%
trans
%}
Create news
{%
endtrans
%}
</a></li>
<li><a
href=
"
{{
url
(
'com:news_admin_list'
)
}}
"
>
{%
trans
%}
Moderate news
{%
endtrans
%}
</a></li>
<li><a
href=
"
{{
url
(
'com:index_edit'
)
}}
"
>
{%
trans
%}
Edit index page
{%
endtrans
%}
</a></li>
<li><a
href=
"
{{
url
(
'com:alert_edit'
)
}}
"
>
{%
trans
%}
Edit alert message
{%
endtrans
%}
</a></li>
...
...
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