Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Sith
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
42
Issues
42
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AE
Sith
Commits
9e0c4e70
Commit
9e0c4e70
authored
Aug 16, 2019
by
Théo Labetowiez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[COM] Make the news visible for non-authenticated user and birthday visible for subriber only
parent
38ef13d9
Pipeline
#1988
passed with stage
in 27 minutes and 13 seconds
Changes
9
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
112 additions
and
94 deletions
+112
-94
com/migrations/0006_remove_sith_index_page.py
com/migrations/0006_remove_sith_index_page.py
+12
-0
com/models.py
com/models.py
+0
-1
com/templates/com/news_list.jinja
com/templates/com/news_list.jinja
+17
-13
com/tests.py
com/tests.py
+23
-0
com/urls.py
com/urls.py
+0
-1
com/views.py
com/views.py
+0
-8
core/templates/core/index.jinja
core/templates/core/index.jinja
+0
-9
core/views/site.py
core/views/site.py
+2
-4
locale/fr/LC_MESSAGES/django.po
locale/fr/LC_MESSAGES/django.po
+58
-58
No files found.
com/migrations/0006_remove_sith_index_page.py
0 → 100644
View file @
9e0c4e70
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2019-08-18 17:00
from
__future__
import
unicode_literals
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[(
"com"
,
"0005_auto_20180318_2227"
)]
operations
=
[
migrations
.
RemoveField
(
model_name
=
"sith"
,
name
=
"index_page"
)]
com/models.py
View file @
9e0c4e70
...
...
@@ -45,7 +45,6 @@ class Sith(models.Model):
alert_msg
=
models
.
TextField
(
_
(
"alert message"
),
default
=
""
,
blank
=
True
)
info_msg
=
models
.
TextField
(
_
(
"info message"
),
default
=
""
,
blank
=
True
)
index_page
=
models
.
TextField
(
_
(
"index page"
),
default
=
""
,
blank
=
True
)
weekmail_destinations
=
models
.
TextField
(
_
(
"weekmail destinations"
),
default
=
""
)
def
is_owned_by
(
self
,
user
):
...
...
com/templates/com/news_list.jinja
View file @
9e0c4e70
...
...
@@ -40,22 +40,26 @@
<div
id=
"birthdays"
>
<div
id=
"birthdays_title"
>
{%
trans
%}
Birthdays
{%
endtrans
%}
</div>
<div
id=
"birthdays_content"
>
<ul
class=
"birthdays_year"
>
{%
for
d
in
birthdays.dates
(
'date_of_birth'
,
'year'
,
'DESC'
)
%}
<li>
{%
trans
age
=
timezone.now
()
.
year
-
d.year
%}{{
age
}}
year old
{%
endtrans
%}
<ul>
{%
for
u
in
birthdays.
filter
(
date_of_birth__year
=
d.year
)
%}
<li><a
href=
"
{{
u.get_absolute_url
()
}}
"
>
{{
u.get_short_name
()
}}
</a></li>
{%
endfor
%}
<div
id=
"birthdays_content"
>
{%
if
user.is_subscribed
%}
<ul
class=
"birthdays_year"
>
{%
for
d
in
birthdays.dates
(
'date_of_birth'
,
'year'
,
'DESC'
)
%}
<li>
{%
trans
age
=
timezone.now
()
.
year
-
d.year
%}{{
age
}}
year old
{%
endtrans
%}
<ul>
{%
for
u
in
birthdays.
filter
(
date_of_birth__year
=
d.year
)
%}
<li><a
href=
"
{{
u.get_absolute_url
()
}}
"
>
{{
u.get_short_name
()
}}
</a></li>
{%
endfor
%}
</ul>
</li>
{%
endfor
%}
</ul>
</li>
{%
endfor
%}
</ul>
{%
else
%}
<p>
{%
trans
%}
You need an up to date subscription to access this content
{%
endtrans
%}
</p>
{%
endif
%}
</div>
</div>
</div>
</div>
<div
id=
"left_column"
class=
"news_column"
>
...
...
com/tests.py
View file @
9e0c4e70
...
...
@@ -26,6 +26,9 @@ from django.test import TestCase
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
django.core.management
import
call_command
from
django.utils
import
html
from
django.utils.translation
import
ugettext
as
_
from
core.models
import
User
,
RealGroup
...
...
@@ -74,3 +77,23 @@ class ComTest(TestCase):
"""<div id="info_box">
\\
n <div class="markdown"><h3>INFO: <strong>Caaaataaaapuuuulte!!!!</strong></h3>"""
in
str
(
r
.
content
)
)
def
test_birthday_non_subscribed_user
(
self
):
self
.
client
.
login
(
username
=
"guy"
,
password
=
"plop"
)
response
=
self
.
client
.
get
(
reverse
(
"core:index"
))
self
.
assertContains
(
response
,
text
=
html
.
escape
(
_
(
"You need an up to date subscription to access this content"
)
),
)
def
test_birthday_subscibed_user
(
self
):
response
=
self
.
client
.
get
(
reverse
(
"core:index"
))
self
.
assertNotContains
(
response
,
text
=
html
.
escape
(
_
(
"You need an up to date subscription to access this content"
)
),
)
com/urls.py
View file @
9e0c4e70
...
...
@@ -30,7 +30,6 @@ from club.views import MailingDeleteView
urlpatterns
=
[
url
(
r"^sith/edit/alert$"
,
AlertMsgEditView
.
as_view
(),
name
=
"alert_edit"
),
url
(
r"^sith/edit/info$"
,
InfoMsgEditView
.
as_view
(),
name
=
"info_edit"
),
url
(
r"^sith/edit/index$"
,
IndexEditView
.
as_view
(),
name
=
"index_edit"
),
url
(
r"^sith/edit/weekmail_destinations$"
,
WeekmailDestinationEditView
.
as_view
(),
...
...
com/views.py
View file @
9e0c4e70
...
...
@@ -182,14 +182,6 @@ class InfoMsgEditView(ComEditView):
success_url
=
reverse_lazy
(
"com:info_edit"
)
class
IndexEditView
(
ComEditView
):
form_class
=
modelform_factory
(
Sith
,
fields
=
[
"index_page"
],
widgets
=
{
"index_page"
:
MarkdownInput
}
)
current_tab
=
"index"
success_url
=
reverse_lazy
(
"com:index_edit"
)
class
WeekmailDestinationEditView
(
ComEditView
):
fields
=
[
"weekmail_destinations"
]
current_tab
=
"weekmail_destinations"
...
...
core/templates/core/index.jinja
deleted
100644 → 0
View file @
38ef13d9
{%
extends
"core/base.jinja"
%}
{%
block
title
%}
{%
trans
%}
Welcome!
{%
endtrans
%}
{%
endblock
%}
{%
block
content
%}
{{
get_sith
()
.
index_page
|
markdown
}}
{%
endblock
%}
core/views/site.py
View file @
9e0c4e70
...
...
@@ -40,11 +40,9 @@ from club.models import Club
def
index
(
request
,
context
=
None
):
if
request
.
user
.
is_authenticated
():
from
com.views
import
NewsListView
from
com.views
import
NewsListView
return
NewsListView
.
as_view
()(
request
)
return
render
(
request
,
"core/index.jinja"
)
return
NewsListView
.
as_view
()(
request
)
class
NotificationList
(
ListView
):
...
...
locale/fr/LC_MESSAGES/django.po
View file @
9e0c4e70
This diff is collapsed.
Click to expand it.
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