Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
b93f38bc
Commit
b93f38bc
authored
Mar 02, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial profile editing
parent
a9773283
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
2 deletions
+48
-2
accounts/forms.py
accounts/forms.py
+7
-0
accounts/models.py
accounts/models.py
+1
-1
accounts/views.py
accounts/views.py
+13
-1
html/profile.html
html/profile.html
+26
-0
urls.py
urls.py
+1
-0
No files found.
accounts/forms.py
0 → 100644
View file @
b93f38bc
from
django
import
forms
from
accounts.models
import
Profile
class
ProfileForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Profile
accounts/models.py
View file @
b93f38bc
...
...
@@ -9,7 +9,7 @@ from django.utils.translation import ugettext_lazy as _
from
lang.models
import
Language
class
Profile
(
models
.
Model
):
user
=
models
.
ForeignKey
(
User
,
unique
=
True
)
user
=
models
.
ForeignKey
(
User
,
unique
=
True
,
editable
=
False
)
language
=
models
.
CharField
(
verbose_name
=
_
(
u"Interface Language"
),
max_length
=
10
,
choices
=
settings
.
LANGUAGES
)
languages
=
models
.
ManyToManyField
(
Language
)
...
...
accounts/views.py
View file @
b93f38bc
# Create your views here.
from
django.shortcuts
import
render_to_response
from
django.template
import
RequestContext
from
accounts.forms
import
ProfileForm
def
profile
(
request
):
if
request
.
method
==
'POST'
:
form
=
ProfileForm
(
request
.
POST
)
else
:
form
=
ProfileForm
(
instance
=
request
.
user
.
get_profile
())
return
render_to_response
(
'profile.html'
,
RequestContext
(
request
,
{
'form'
:
form
}))
html/profile.html
0 → 100644
View file @
b93f38bc
{% extends "base.html" %}
{% load url from future %}
{% load i18n %}
{% block content %}
{% if form.errors %}
<div
class=
"ui-widget"
>
<div
style=
"padding: 0pt 0.7em;"
class=
"ui-state-error ui-corner-all"
>
<p><span
style=
"float: left; margin-right: 0.3em;"
class=
"ui-icon ui-icon-alert"
></span>
{% trans "Please fix errors in the form." %}
</p>
</div>
</div>
{% endif %}
<form
method=
"post"
action=
"{% url 'accounts.views.profile' %}"
>
{% csrf_token %}
<table>
{{ form.as_table }}
</table>
<input
type=
"submit"
value=
"{% trans "
Save
"%}"
class=
"button"
/>
</form>
{% endblock %}
urls.py
View file @
b93f38bc
...
...
@@ -18,6 +18,7 @@ urlpatterns = patterns('',
# Auth
url
(
r'^accounts/'
,
include
(
'registration.urls'
)),
url
(
r'^accounts/profile/'
,
'accounts.views.profile'
),
# Media files
url
(
r'^media/(?P<path>.*)$'
,
'django.views.static.serve'
,
...
...
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