-
Notifications
You must be signed in to change notification settings - Fork 10
Varghese robin newspost detail fixes #10
base: master
Are you sure you want to change the base?
Changes from 6 commits
06b1fc9
ce08187
0283ea2
5d4aff2
9df64fa
38cb61c
88d1e41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,9 +32,16 @@ def teaser(self): | |
|
|
||
| @property | ||
| def source_divesite_name(self): | ||
| return 'Industry Dive' | ||
| # Implementation based on naive assumption that URL is in a | ||
| # <protocol>://www.<hostname>.xyz/asdf-asdf-asdf format | ||
| hostname = self.source.split('/')[2].split('.')[1] | ||
| return DIVESITE_SOURCE_NAMES[hostname] | ||
|
|
||
| def tags(self): | ||
| return [ | ||
| 'HR', 'Diversity & Inclusion', 'Culture' | ||
| ] | ||
|
|
||
| @property | ||
| def edit_url(self): | ||
| return reverse('admin:wavepool_newspost_change', args=[self.pk]) | ||
|
Comment on lines
+44
to
+47
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here i Introduced a |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| <head> | ||
| <link href="{% static 'bootstrap/css/bootstrap.min.css' %}" rel="stylesheet"> | ||
| <link href="{% static 'app.css' %}" rel="stylesheet"> | ||
| <title>Wavepool | Industry Dive</title> | ||
| <title>{{ newspost.title }} | Wavepool | Industry Dive</title> | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fixes was made to include the |
||
| <link rel="shortcut icon" type="/image/png" href="{% static 'favicon.ico' %}"/> | ||
| </head> | ||
| <body> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,12 +19,19 @@ | |
| <div class="col-2"></div> | ||
| </div> | ||
| <div class="newspost-detail"> | ||
| <div class="row"><a href=""><button>edit</button></a></div> | ||
| {% if is_staff %} | ||
| <div class="row"> | ||
| <a id="edit-link" href="{{ newspost.edit_url }}"><button>edit</button></a> | ||
| </div> | ||
| {% endif %} | ||
|
Comment on lines
+22
to
+26
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This conditional template shows |
||
| <div class="row"> | ||
| <h1>{{ newspost.title }}<span class="pubdate">{{newspost.publish_date}}</span></h1> | ||
| <h1 id="newspost-title">{{ newspost.title }}</h1> | ||
| </div> | ||
| <div class="row"> | ||
| <span class="pubdate">{{newspost.publish_date}}</span> | ||
| </div> | ||
| <div class="row"><a href="{{newspost.source}}" target="_blank">See the live story at {{newspost.source_divesite_name}}</a></div> | ||
| <div class="row newspost-body"> | ||
| <div id="newspost-body" class="row newspost-body"> | ||
| {{ newspost.body|safe }} | ||
| </div> | ||
| </div> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,8 +30,10 @@ def front_page(request): | |
| def newspost_detail(request, newspost_id): | ||
| template = loader.get_template('wavepool/newspost.html') | ||
| newspost = NewsPost.objects.get(pk=newspost_id) | ||
| # import pdb; pdb.set_trace() | ||
| context = { | ||
| 'newspost': newspost | ||
| 'newspost': newspost, | ||
| 'is_staff': request.user.is_staff | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we set the |
||
| } | ||
|
|
||
| return HttpResponse(template.render(context, request)) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
source_divesite_namewas hardcoded before. I have modified this to resolve the hostname from the URL and then return the lookup fromDIVESITE_SOURCE_NAMESUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i really like and prefer an implementation similar to ref in branch set_coverstory_for_front_page
However i didn't want to just copy it