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
c80945cc
Commit
c80945cc
authored
Mar 05, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial implementation of contact form
parent
2271df36
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
1 deletion
+26
-1
accounts/forms.py
accounts/forms.py
+10
-0
accounts/views.py
accounts/views.py
+14
-1
urls.py
urls.py
+2
-0
No files found.
accounts/forms.py
View file @
c80945cc
from
django
import
forms
from
django.utils.translation
import
ugettext_lazy
as
_
from
accounts.models
import
Profile
from
django.contrib.auth.models
import
User
...
...
@@ -19,3 +20,12 @@ class UserForm(forms.ModelForm):
'last_name'
,
'email'
,
]
class
ContactForm
(
models
.
Form
):
subject
=
models
.
CharField
(
label
=
_
(
'Subject'
),
required
=
True
)
message
=
models
.
CharField
(
label
=
_
(
'Message'
),
required
=
True
,
widget
=
forms
.
Textarea
)
accounts/views.py
View file @
c80945cc
from
django.shortcuts
import
render_to_response
from
django.template
import
RequestContext
from
django.conf
import
settings
from
django.utils.translation
import
ugettext
as
_
from
accounts.forms
import
ProfileForm
,
UserForm
from
accounts.forms
import
ProfileForm
,
UserForm
,
ContactForm
def
profile
(
request
):
...
...
@@ -19,3 +21,14 @@ def profile(request):
'form'
:
form
,
'userform'
:
userform
,
}))
def
contact
(
request
):
if
request
.
method
==
'POST'
:
form
=
ContactForm
(
request
.
POST
)
else
:
form
=
ContectForm
()
return
render_to_response
(
'contact.html'
,
RequestContext
(
request
,
{
'form'
:
form
,
'title'
:
'%s @ %s'
%
(
_
(
'Contact'
),
settings
.
SITE_TITLE
),
}))
urls.py
View file @
c80945cc
...
...
@@ -21,6 +21,8 @@ urlpatterns = patterns('',
url
(
r'^accounts/'
,
include
(
'registration.urls'
)),
url
(
r'^accounts/profile/'
,
'accounts.views.profile'
),
url
(
r'^contact/'
,
'accounts.views.contact'
),
# Media files
url
(
r'^media/(?P<path>.*)$'
,
'django.views.static.serve'
,
{
'document_root'
:
'./media'
}),
...
...
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