Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
9304a911
Commit
9304a911
authored
Jan 10, 2015
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加自定义tag
parent
fbde8d42
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
2 deletions
+22
-2
settings.py
jumpserver/settings.py
+1
-0
__init__.py
jumpserver/templatetags/__init__.py
+1
-0
mytags.py
jumpserver/templatetags/mytags.py
+17
-0
views.py
juser/views.py
+1
-1
user_add.html
templates/juser/user_add.html
+2
-1
No files found.
jumpserver/settings.py
View file @
9304a911
...
@@ -46,6 +46,7 @@ INSTALLED_APPS = (
...
@@ -46,6 +46,7 @@ INSTALLED_APPS = (
'django.contrib.sessions'
,
'django.contrib.sessions'
,
'django.contrib.messages'
,
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'django.contrib.staticfiles'
,
'jumpserver'
,
'juser'
,
'juser'
,
'jasset'
,
'jasset'
,
'jpermission'
,
'jpermission'
,
...
...
jumpserver/templatetags/__init__.py
0 → 100644
View file @
9304a911
__author__
=
'Hudie'
jumpserver/templatetags/mytags.py
0 → 100644
View file @
9304a911
import
time
from
django
import
template
register
=
template
.
Library
()
@register.filter
(
name
=
'stamp2str'
)
def
stamp2str
(
value
):
try
:
return
time
.
strftime
(
'
%
Y/
%
m/
%
d
%
H:
%
M:
%
S'
,
time
.
localtime
(
value
))
except
AttributeError
:
return
'0000/00/00 00:00:00'
@register.filter
(
name
=
'int2str'
)
def
int2str
(
value
):
return
str
(
value
)
juser/views.py
View file @
9304a911
...
@@ -126,7 +126,7 @@ def user_add(request):
...
@@ -126,7 +126,7 @@ def user_add(request):
else
:
else
:
time_now
=
time
.
time
()
time_now
=
time
.
time
()
db_add_user
(
username
=
username
,
password
=
password
,
name
=
name
,
email
=
email
,
db_add_user
(
username
=
username
,
password
=
password
,
name
=
name
,
email
=
email
,
groups
=
groups
,
role
=
role
,
ssh_pwd
=
ssh_pwd
,
ssh_key_pwd1
=
ssh_key_pwd1
,
groups
=
groups
,
role
=
role
_post
,
ssh_pwd
=
ssh_pwd
,
ssh_key_pwd1
=
ssh_key_pwd1
,
is_active
=
is_active
,
date_joined
=
time_now
)
is_active
=
is_active
,
date_joined
=
time_now
)
msg
=
u'添加用户成功'
msg
=
u'添加用户成功'
return
render_to_response
(
'juser/user_add.html'
,
return
render_to_response
(
'juser/user_add.html'
,
...
...
templates/juser/user_add.html
View file @
9304a911
{% extends 'base.html' %}
{% extends 'base.html' %}
{% load mytags %}
{% block content %}
{% block content %}
{% include 'nav_cat_bar.html' %}
{% include 'nav_cat_bar.html' %}
...
@@ -73,7 +74,7 @@
...
@@ -73,7 +74,7 @@
<div
class=
"col-sm-8"
>
<div
class=
"col-sm-8"
>
<select
id=
"groups"
name=
"groups"
class=
"form-control m-b"
multiple
>
<select
id=
"groups"
name=
"groups"
class=
"form-control m-b"
multiple
>
{% for group in all_group %}
{% for group in all_group %}
{% if group.id in groups_str %}
{% if group.id
|int2str
in groups_str %}
<option
value=
"{{ group.id }}"
selected
>
{{ group.name }}
</option>
<option
value=
"{{ group.id }}"
selected
>
{{ group.name }}
</option>
{% else %}
{% else %}
{% if forloop.first %}
{% if forloop.first %}
...
...
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