Improved card styling from feeds
This commit is contained in:
parent
8a652fa20a
commit
67e53644ba
|
@ -46,5 +46,6 @@ docker-compose -f dev.yml run django python manage.py createsuperuser
|
||||||
If you want to export some data you entered into the admin area you can use =dumpdata= and =loaddata= to export and import.
|
If you want to export some data you entered into the admin area you can use =dumpdata= and =loaddata= to export and import.
|
||||||
|
|
||||||
#+BEGIN_SRC sh
|
#+BEGIN_SRC sh
|
||||||
docker-compose -fdev.yml run django python manage.py dumpdata feeds > mhackspace/feeds/fixtures/default.json
|
docker-compose -fdev.yml run django python manage.py dumpdata feeds > mhackspace/feeds/fixtures/defaults.json
|
||||||
|
docker-compose -fdev.yml run django python manage.py loaddata mhackspace/feeds/fixtures/defaults.json
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.contrib.admin import AdminSite, TabularInline, ModelAdmin
|
from django.contrib.admin import ModelAdmin
|
||||||
from mhackspace.feeds.models import Feed
|
from mhackspace.feeds.models import Feed
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Feed)
|
@admin.register(Feed)
|
||||||
class FeedAdmin(ModelAdmin):
|
class FeedAdmin(ModelAdmin):
|
||||||
list_display = ('url', 'author', 'tags', 'enabled')
|
list_display = ('url', 'author', 'tags', 'enabled')
|
||||||
|
list_filter = ('enabled', )
|
||||||
|
|
||||||
admin.site.site_title = 'Maidstone hackspace Admin Area'
|
admin.site.site_title = 'Maidstone Hackspace Admin Area'
|
||||||
admin.site.site_header = 'Maidstone hackspace Admin Area'
|
admin.site.site_header = 'Maidstone Hackspace Admin Area'
|
||||||
admin.site.index_title = 'Maidstone Admin Home'
|
admin.site.index_title = 'Maidstone Admin Home'
|
||||||
|
|
|
@ -1,4 +1,68 @@
|
||||||
Postgres is up - continuing...
|
[
|
||||||
/usr/local/lib/python3.5/site-packages/environ/environ.py:608: UserWarning: /app/config/settings/.env doesn't exist - if you're not configuring your environment separately, create one.
|
{
|
||||||
"environment separately, create one." % env_file)
|
"model": "feeds.feed",
|
||||||
[{"model": "feeds.feed", "pk": 1, "fields": {"url": "http://waistcoatforensicator.blogspot.com/feeds/posts/default?alt=rss", "author": "Simon Ridley", "tags": "", "image": "", "enabled": true}}, {"model": "feeds.feed", "pk": 2, "fields": {"url": "http://www.matthewbeddow.co.uk/?feed=rss2", "author": "Mathew Beddow", "tags": "tech", "image": "", "enabled": true}}, {"model": "feeds.feed", "pk": 3, "fields": {"url": "http://blog.digitaloctave.co.uk/rss.xml", "author": "Oliver Marks", "tags": "", "image": "", "enabled": true}}, {"model": "feeds.feed", "pk": 4, "fields": {"url": "http://webboggles.com/feed/", "author": "Ilya Titov", "tags": "", "image": "", "enabled": true}}, {"model": "feeds.feed", "pk": 5, "fields": {"url": "http://thearduinoguy.org/?feed=rss2", "author": "Mike McRoberts", "tags": "", "image": "", "enabled": true}}, {"model": "feeds.feed", "pk": 6, "fields": {"url": "https://feeds.feedburner.com/projects-jl", "author": "James", "tags": "", "image": "", "enabled": false}}]
|
"pk": 1,
|
||||||
|
"fields": {
|
||||||
|
"url": "http://waistcoatforensicator.blogspot.com/feeds/posts/default?alt=rss",
|
||||||
|
"author": "Simon Ridley",
|
||||||
|
"tags": "",
|
||||||
|
"image": "",
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"model": "feeds.feed",
|
||||||
|
"pk": 2,
|
||||||
|
"fields": {
|
||||||
|
"url": "http://www.matthewbeddow.co.uk/?feed=rss2",
|
||||||
|
"author": "Mathew Beddow",
|
||||||
|
"tags": "tech",
|
||||||
|
"image": "",
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"model": "feeds.feed",
|
||||||
|
"pk": 3,
|
||||||
|
"fields": {
|
||||||
|
"url": "http://blog.digitaloctave.co.uk/rss.xml",
|
||||||
|
"author": "Oliver Marks",
|
||||||
|
"tags": "",
|
||||||
|
"image": "",
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"model": "feeds.feed",
|
||||||
|
"pk": 4,
|
||||||
|
"fields": {
|
||||||
|
"url": "http://webboggles.com/feed/",
|
||||||
|
"author": "Ilya Titov",
|
||||||
|
"tags": "",
|
||||||
|
"image": "",
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"model": "feeds.feed",
|
||||||
|
"pk": 5,
|
||||||
|
"fields": {
|
||||||
|
"url": "http://thearduinoguy.org/?feed=rss2",
|
||||||
|
"author": "Mike McRoberts",
|
||||||
|
"tags": "",
|
||||||
|
"image": "",
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"model": "feeds.feed",
|
||||||
|
"pk": 6,
|
||||||
|
"fields": {
|
||||||
|
"url": "https://feeds.feedburner.com/projects-jl",
|
||||||
|
"author": "James",
|
||||||
|
"tags": "",
|
||||||
|
"image": "",
|
||||||
|
"enabled": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
|
@ -17,4 +17,4 @@ def show_feeds():
|
||||||
})
|
})
|
||||||
|
|
||||||
result = feed_reader(rss_feeds)
|
result = feed_reader(rss_feeds)
|
||||||
return {'feeds': [item for item in result]}
|
return {'articles': [item for item in result]}
|
||||||
|
|
|
@ -1,22 +1,13 @@
|
||||||
Maker feed
|
<div class="card-columns" id="feeds">
|
||||||
|
{% for article in articles %}
|
||||||
<div class="card-deck-wrapper">
|
<div class="card" style="width: 20rem;">
|
||||||
<div class="card-deck">
|
<img class="card-img-top img-fluid" src="{{ article.image }}" alt="{{ article.title }}">
|
||||||
{% for feed in feeds %}
|
|
||||||
<div class="card">
|
|
||||||
<img class="card-img-top img-responsive" src="{{ feed.image }}" alt="Card image cap" style="width:100%">
|
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<h4 class="card-title">{{ feed.title }}</h4>
|
<h4 class="card-title">{{ article.title }}</h4>
|
||||||
<p class="card-text">{{ feed.author }}</p>
|
<p class="card-text">{{ article.author }}</p>
|
||||||
</div>
|
<p class="card-text">{{ article.description|striptags }}</p>
|
||||||
<div class="card-block">
|
<a href="{{ article.url }}" class="card-link">View Original</a>
|
||||||
<p class="card-text">{{ feed.description }}</p>
|
|
||||||
</div>
|
|
||||||
<div class="card-block">
|
|
||||||
<a href="{{ feed.url }}" class="card-link">View Original</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if forloop.counter|divisibleby:3 %}</div><div class="card-deck">{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue