Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
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
Show 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
datetime
import
datetime
from
itertools
import
chain
from
django.core.exceptions
import
PermissionDenied
,
ValidationError
from
django.core.exceptions
import
PermissionDenied
,
ValidationError
from
django.conf
import
settings
from
django.conf
import
settings
from
django.contrib.auth.decorators
import
login_required
from
django.contrib.auth.decorators
import
login_required
...
@@ -153,27 +154,24 @@ def language(request, lang):
...
@@ -153,27 +154,24 @@ def language(request, lang):
def
group_show
(
request
,
gid
):
def
group_show
(
request
,
gid
):
user
=
request
.
user
user
=
request
.
user
group
=
get_object_or_404
(
Group
,
id
=
gid
)
group
=
get_object_or_404
(
Group
,
id
=
gid
)
mytemplates
=
[
t
for
t
in
Template
.
objects
.
filter
(
owner
=
request
.
user
)
.
all
()]
mytemplates
=
Template
.
objects
.
filter
(
owner
=
request
.
user
,
state
=
'READY'
)
noshare
=
True
for
t
in
mytemplates
:
for
i
,
t
in
enumerate
(
mytemplates
):
t
.
myshares
=
t
.
share_set
.
filter
(
group
=
group
)
t
.
myshares
=
t
.
share_set
.
filter
(
group
=
group
)
if
t
.
myshares
.
exists
():
noshare
=
False
publictemplates
=
Template
.
objects
.
filter
(
public
=
True
,
state
=
'READY'
)
mytemplates
[
i
]
=
t
for
t
in
publictemplates
:
publictemplates
=
[
t
for
t
in
Template
.
objects
.
filter
(
public
=
True
,
state
=
'READY'
)
.
all
()]
for
i
,
t
in
enumerate
(
publictemplates
):
t
.
myshares
=
t
.
share_set
.
filter
(
group
=
group
)
t
.
myshares
=
t
.
share_set
.
filter
(
group
=
group
)
if
t
.
myshares
.
exists
():
noshare
=
False
all_templates
=
chain
(
mytemplates
,
publictemplates
)
publictemplates
[
i
]
=
t
has_share
=
any
([
t
.
myshares
.
exists
()
for
t
in
all_templates
])
return
render_to_response
(
"show-group.html"
,
RequestContext
(
request
,
{
return
render_to_response
(
"show-group.html"
,
RequestContext
(
request
,
{
'group'
:
group
,
'group'
:
group
,
'members'
:
group
.
members
.
all
(),
'members'
:
group
.
members
.
all
(),
'mytemplates'
:
mytemplates
,
'mytemplates'
:
mytemplates
,
'publictemplates'
:
publictemplates
,
'publictemplates'
:
publictemplates
,
'noshare'
:
noshare
,
'noshare'
:
no
t
has_
share
,
'userdetails'
:
UserCloudDetails
.
objects
.
get
(
user
=
request
.
user
),
'userdetails'
:
UserCloudDetails
.
objects
.
get
(
user
=
request
.
user
),
'owners'
:
group
.
owners
.
all
(),
'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