Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
11006465
authored
Jun 25, 2013
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
school: refactored group_show view
parent
93f6d382
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
14 deletions
+12
-14
school/views.py
+12
-14
No files found.
school/views.py
View file @
11006465
from
datetime
import
datetime
from
itertools
import
chain
from
django.core.exceptions
import
PermissionDenied
,
ValidationError
from
django.conf
import
settings
from
django.contrib.auth.decorators
import
login_required
...
...
@@ -153,27 +154,24 @@ def language(request, lang):
def
group_show
(
request
,
gid
):
user
=
request
.
user
group
=
get_object_or_404
(
Group
,
id
=
gid
)
mytemplates
=
[
t
for
t
in
Template
.
objects
.
filter
(
owner
=
request
.
user
)
.
all
()]
noshare
=
True
for
i
,
t
in
enumerate
(
mytemplates
):
mytemplates
=
Template
.
objects
.
filter
(
owner
=
request
.
user
,
state
=
'READY'
)
for
t
in
mytemplates
:
t
.
myshares
=
t
.
share_set
.
filter
(
group
=
group
)
if
t
.
myshares
.
exists
():
noshare
=
False
mytemplates
[
i
]
=
t
publictemplates
=
[
t
for
t
in
Template
.
objects
.
filter
(
public
=
True
,
state
=
'READY'
)
.
all
()]
for
i
,
t
in
enumerate
(
publictemplates
):
publictemplates
=
Template
.
objects
.
filter
(
public
=
True
,
state
=
'READY'
)
for
t
in
publictemplates
:
t
.
myshares
=
t
.
share_set
.
filter
(
group
=
group
)
if
t
.
myshares
.
exists
():
noshare
=
False
publictemplates
[
i
]
=
t
all_templates
=
chain
(
mytemplates
,
publictemplates
)
has_share
=
any
([
t
.
myshares
.
exists
()
for
t
in
all_templates
])
return
render_to_response
(
"show-group.html"
,
RequestContext
(
request
,
{
'group'
:
group
,
'members'
:
group
.
members
.
all
(),
'mytemplates'
:
mytemplates
,
'publictemplates'
:
publictemplates
,
'noshare'
:
noshare
,
'noshare'
:
no
t
has_
share
,
'userdetails'
:
UserCloudDetails
.
objects
.
get
(
user
=
request
.
user
),
'owners'
:
group
.
owners
.
all
(),
}))
...
...
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