Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
scripta
eScriptorium
Commits
cd6d0570
Commit
cd6d0570
authored
Aug 28, 2020
by
EL HASSANE GARGEM
Browse files
add captcha to contact
parent
d1d83a07
Changes
5
Hide whitespace changes
Inline
Side-by-side
app/apps/users/forms.py
View file @
cd6d0570
from
django
import
forms
from
django
import
forms
from
django.contrib.auth.forms
import
UserChangeForm
,
UserCreationForm
from
django.contrib.auth.forms
import
UserChangeForm
,
UserCreationForm
from
django.utils.translation
import
gettext
as
_
from
django.utils.translation
import
gettext
as
_
from
captcha.fields
import
CaptchaField
from
bootstrap.forms
import
BootstrapFormMixin
from
bootstrap.forms
import
BootstrapFormMixin
from
users.models
import
Invitation
,
User
,
ContactUs
from
users.models
import
Invitation
,
User
,
ContactUs
...
@@ -56,7 +57,10 @@ class ProfileForm(BootstrapFormMixin, forms.ModelForm):
...
@@ -56,7 +57,10 @@ class ProfileForm(BootstrapFormMixin, forms.ModelForm):
class
ContactUsForm
(
BootstrapFormMixin
,
forms
.
ModelForm
):
class
ContactUsForm
(
BootstrapFormMixin
,
forms
.
ModelForm
):
message
=
forms
.
CharField
(
label
=
"Message : Please precise your institution or research center if applicable"
,
widget
=
forms
.
Textarea
(
attrs
=
{
'placeholder'
:
'Message : Please precise your institution or research center if applicable'
}))
captcha
=
CaptchaField
()
class
Meta
:
class
Meta
:
model
=
ContactUs
model
=
ContactUs
fields
=
(
'name'
,
'email'
,
'message'
)
fields
=
(
'name'
,
'email'
,
'message'
,
'captcha'
)
app/escriptorium/settings.py
View file @
cd6d0570
...
@@ -62,6 +62,7 @@ INSTALLED_APPS = [
...
@@ -62,6 +62,7 @@ INSTALLED_APPS = [
'rest_framework'
,
'rest_framework'
,
'rest_framework.authtoken'
,
'rest_framework.authtoken'
,
'compressor'
,
'compressor'
,
'captcha'
,
'bootstrap'
,
'bootstrap'
,
'versioning'
,
'versioning'
,
...
...
app/escriptorium/templates/users/contactus.html
View file @
cd6d0570
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
{% render_field form.name %}
{% render_field form.name %}
{% render_field form.email %}
{% render_field form.email %}
{% render_field form.message %}
{% render_field form.message %}
{{ form.captcha }}
<input
type=
"submit"
value=
"{% trans 'Send' %}"
class=
"btn btn-success btn-block my-3"
{%
if
object
%}
autofocus
{%
endif
%}
>
<input
type=
"submit"
value=
"{% trans 'Send' %}"
class=
"btn btn-success btn-block my-3"
{%
if
object
%}
autofocus
{%
endif
%}
>
</fieldset>
</fieldset>
</form>
</form>
...
...
app/escriptorium/urls.py
View file @
cd6d0570
...
@@ -26,7 +26,8 @@ urlpatterns = [
...
@@ -26,7 +26,8 @@ urlpatterns = [
path
(
'api/'
,
include
(
'api.urls'
,
namespace
=
'api'
)),
path
(
'api/'
,
include
(
'api.urls'
,
namespace
=
'api'
)),
# sandbox
# sandbox
path
(
'baseline-editor/'
,
TemplateView
.
as_view
(
template_name
=
'baseline_editor.html'
))
path
(
'baseline-editor/'
,
TemplateView
.
as_view
(
template_name
=
'baseline_editor.html'
)),
path
(
r
'captcha/'
,
include
(
'captcha.urls'
)),
]
]
if
settings
.
DEBUG
:
if
settings
.
DEBUG
:
...
...
app/requirements.txt
View file @
cd6d0570
...
@@ -22,3 +22,4 @@ requests==2.21.0
...
@@ -22,3 +22,4 @@ requests==2.21.0
numpy>=1.17
numpy>=1.17
django-compressor==2.4
django-compressor==2.4
albumentations
albumentations
django-simple-captcha==0.5.12
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