forked from yahyaaly151989/Mastering_Django
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Django forms to share posts via email
- Loading branch information
1 parent
c2689f9
commit eb6a0fe
Showing
12 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django import forms | ||
|
||
class EmailPostForm(forms.Form): | ||
name = forms.CharField(max_length=25) | ||
email = forms.EmailField() | ||
to = forms.EmailField() | ||
comments = forms.CharField(required=False, widget=forms.Textarea) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,6 @@ def get_absolute_url(self): | |
self.publish.day, | ||
self.slug, | ||
]) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{% extends "blog/base.html" %} | ||
{% block title %}Share a Post{% endblock %} | ||
{% block content %} | ||
{% if sent %} | ||
<h1>E-mail successfully sent</h1> | ||
<p> | ||
"{{ post.title }}" was successfully sent to {{ form.cleaned_data.to }}. | ||
</p> | ||
{% else %} | ||
<h1>Share "{{ post.title }}" by e-mail</h1> | ||
<form method="post"> | ||
{{ form.as_p }} | ||
{% csrf_token %} | ||
<input type="submit" value="Send e-mail"> | ||
</form> | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+285 Bytes
(110%)
Module02/mysite/mysite/__pycache__/settings.cpython-311.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters