Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Techbloooog #2

Merged
merged 6 commits into from
Dec 7, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions blossom/engineeringblog/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.urls import path

from blossom.engineeringblog import views

urlpatterns = [
path('', views.index, name="blog_index"),
]
15 changes: 15 additions & 0 deletions blossom/engineeringblog/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from django.shortcuts import render
from django.db.models import Q

from blossom.website.models import Post

def index(request):

p = Post.objects.filter(
Q(published=True) &
Q(engineeringblogpost=True) &
Q(standalone_section=False) &
Q(show_in_news_view=True)
)

return render(request, 'website/index.html', {'posts': p})
1 change: 1 addition & 0 deletions blossom/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
'',
host(r'api', 'blossom.api.urls', name='api'),
host(r'payments', 'blossom.payments.urls', name='payments'),
host(r'engineering', 'blossom.engineeringblog.urls', name='engineeringblog'),
host(r'', settings.ROOT_URLCONF, name='www')
)
7 changes: 7 additions & 0 deletions blossom/templates/website/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{% extends "website/partials/base.partial" %}
{% load static %}
{% load hosts %}

{% block content %}
{% if not posts %}
<p>
<h1 class="text-center">There's nothing here! Why not <a href="{% host_url "post_create" host 'www' %}"><u>add
something?</u></a></h1>
itsthejoker marked this conversation as resolved.
Show resolved Hide resolved
</p>
{% endif %}
{% for p in posts %}
<p>
<h1><a href="{{ p.get_absolute_url }}">{{ p.title }}</a></h1>
Expand Down
3 changes: 2 additions & 1 deletion blossom/templates/website/partials/navbar.partial
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{% load static %}
{% load hosts %}

<nav class="navbar navbar-expand-lg navbar-light" style="background-color: #eae4da;">
<div class="container">
<a class="navbar-brand" href="/">
<a class="navbar-brand" href="{% host_url 'homepage' host 'www' %}">
<img src="{% static "images/logo.svg" %}" width="30px" id="navbar-logo" alt="Logo">Grafeas Group
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
Expand Down
8 changes: 7 additions & 1 deletion blossom/website/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ class Post(models.Model):
author = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)
date = models.DateTimeField(default=timezone.now)

# something that will go on engineering.grafeas.org
engineeringblogpost = models.BooleanField(
default=False,
help_text="Mark this post as an engineering blog post."
)

# about page, for example
standalone_section = models.BooleanField()
standalone_section = models.BooleanField(default=False)
slug = models.SlugField(
default='',
editable=False,
Expand Down
3 changes: 2 additions & 1 deletion blossom/website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def index(request):
'posts': Post.objects.filter(
Q(published=True) &
Q(standalone_section=False) &
Q(show_in_news_view=True)
Q(show_in_news_view=True) &
Q(engineeringblogpost=False)
).order_by('-date')
}
c = get_additional_context(c)
Expand Down