Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
django-url-follower
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikolaos S. Papaspyrou
django-url-follower
Commits
79a72d99
Commit
79a72d99
authored
Jun 15, 2015
by
Nikolaos S. Papaspyrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for deleting URLs
parent
fb2e8c4d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
0 deletions
+12
-0
details.html
urlforward/templates/details.html
+5
-0
urls.py
urlforward/urls.py
+1
-0
views.py
urlforward/views.py
+6
-0
No files found.
urlforward/templates/details.html
View file @
79a72d99
...
@@ -11,4 +11,9 @@
...
@@ -11,4 +11,9 @@
<li>
Followed: {{ url.used }} time(s).
</li>
<li>
Followed: {{ url.used }} time(s).
</li>
</ul>
</ul>
<p>
<a
href=
"{% url 'delete' url.id %}"
role=
"button"
class=
"btn btn-danger"
>
Delete
</a>
</p>
{% endblock %}
{% endblock %}
urlforward/urls.py
View file @
79a72d99
...
@@ -8,4 +8,5 @@ urlpatterns = [
...
@@ -8,4 +8,5 @@ urlpatterns = [
url
(
r'^url=(?P<url_id>[0-9]+)$'
,
views
.
details
,
name
=
'details'
),
url
(
r'^url=(?P<url_id>[0-9]+)$'
,
views
.
details
,
name
=
'details'
),
url
(
r'^new$'
,
views
.
new
,
name
=
'new'
),
url
(
r'^new$'
,
views
.
new
,
name
=
'new'
),
url
(
r'^generate$'
,
views
.
generate
,
name
=
'generate'
),
url
(
r'^generate$'
,
views
.
generate
,
name
=
'generate'
),
url
(
r'^delete=(?P<url_id>[0-9]+)$'
,
views
.
delete
,
name
=
'delete'
),
]
]
urlforward/views.py
View file @
79a72d99
...
@@ -39,3 +39,9 @@ def generate(request):
...
@@ -39,3 +39,9 @@ def generate(request):
u
=
Url
(
target
=
request
.
POST
[
'target'
],
user
=
request
.
user
)
u
=
Url
(
target
=
request
.
POST
[
'target'
],
user
=
request
.
user
)
u
.
save
()
u
.
save
()
return
HttpResponseRedirect
(
reverse
(
'index'
))
return
HttpResponseRedirect
(
reverse
(
'index'
))
@
login_required
def
delete
(
request
,
url_id
):
u
=
get_object_or_404
(
Url
,
id
=
url_id
,
user__exact
=
request
.
user
)
u
.
delete
()
return
HttpResponseRedirect
(
reverse
(
'index'
))
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