Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@
* Use an IDE linter, like **SonarLint**, to fix common bugs/code quality issues.
* Update your task's status in the provided spreadsheet.
* Send a pull request anytime :)


3 changes: 2 additions & 1 deletion applications/blog/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.contrib import admin


from applications.blog.models import Blog, Campaign, Replies

# Register your models here.
Expand All @@ -26,4 +27,4 @@ class RepliesAdmin(admin.ModelAdmin):

admin.site.register(Blog, BlogAdmin)
admin.site.register(Campaign, CampaignAdmin)
admin.site.register(Replies, RepliesAdmin)
admin.site.register(Replies, RepliesAdmin)
Empty file.
3 changes: 2 additions & 1 deletion applications/blog/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from django.db import models

from multiselectfield import MultiSelectField
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
Expand Down Expand Up @@ -58,4 +59,4 @@ class Replies(models.Model):
time_stamp = models.DateTimeField(auto_now=True)
sender = models.ForeignKey(User, on_delete=models.CASCADE,related_name='sender')
receiver = models.ForeignKey(User,on_delete=models.CASCADE,related_name='receiver',default='', blank=True,null=True)

2 changes: 2 additions & 0 deletions applications/blog/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

from django.urls import path

from . import views

app_name = 'blog'
Expand Down
5 changes: 4 additions & 1 deletion applications/blog/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

from django.shortcuts import render , redirect
from .models import Blog, Campaign, Replies
from django.utils.timezone import now
Expand All @@ -7,7 +8,9 @@


# Create your views here.

def index(request):

q= request.GET.get('q') if request.GET.get('q')!=None else ''
blogs=Blog.objects.filter(Q(author__username__icontains=q)|
Q(title__icontains=q)|
Expand Down Expand Up @@ -146,4 +149,4 @@ def reply_delete(request, reply_id):
if request.method == "POST":
reply.delete()
return redirect('blog:blog_detail', blog_id=blog_id)
return render(request, 'blog/delete.html', {'reply': reply})
return render(request, 'blog/delete.html', {'reply': reply})
71 changes: 71 additions & 0 deletions templates/blog/blog_detail.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{% extends 'globals/base.html' %}
{% load static %}

{% block title %}
Blog
{% endblock %}

{% block body %}
{% include 'globals/navbar.html' %}
<div class="p-0 m-0 masthead-bg w-100 parallax shadow-sm" style="min-height:250px !important; height:270px !important; background-position-y: 270px"></div>
<div style="height:150px; min-height:150px;"></div>

<div class="events-container container text-left p-2 mx-auto">
<div class="card shadow-lg bg-light m-4">
<div class="row no-gutters p-3">
<div class="col-auto mx-auto text-center">
<div class="p-1 pb-3 pb-lg-1">
{% if blog.thumbnail %}
<img src="{{ blog.thumbnail.url }}" alt="" height= 200px width= 200px>
{% else %}
<img src="{% static 'AlumniConnect/img/blog.jpg' %}" alt="" height= 200px width= 200px>
{% endif %}
</div>
<!-- Social Sharing -->
<div class="dropdown d-inline-block mx-auto">
<button class="btn btn-primary btn-sm px-4 py-2 mt-2 dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Share
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<!-- Dropdown menu links -->
<a href="https://www.facebook.com/sharer.php?u={{ request.build_absolute_uri }}" target="_blank" title="Facebook Share" class="dropdown-item" >Facebook</a>

<a href="https://twitter.com/share?text={{ blog.title|striptags|urlencode }}&url={{ request.build_absolute_uri }}" target="_blank" title="Twitter Share" class="dropdown-item" >Twitter</a>

<a href="https://www.linkedin.com/shareArticle?mini=true&url={{ request.build_absolute_uri }}" target="_blank" title="LinkedIn Share" class="dropdown-item" >LinkedIn</a>

<a href="https://api.whatsapp.com/send?text={{ request.build_absolute_uri }}" target="_blank" title="Whatsapp Share" class="dropdown-item" >Whatsapp</a>

</div>
</div>
</div>
<div class="col-lg-9">
<div class="card-block px-2">
<h2 class="card-title">{{ blog.title|safe }}</h2>
<!-- <p class="m-2 font-weight-normal mb-3"> -->
<p class="m-2 font-weight-normal mb-3">
<span class="d-inline-block pb-2 pb-md-0">
<i class="fas fa-table"></i>
{{ blog.time_stamp|date:"d F, o" }}
&nbsp;
</span>
<span class="d-inline-block">
<i class="fas fa-user"></i>&nbsp;
{{ blog.author }}
</span>
</p>
<p>{{ blog.content|safe }}</p>
<br>
</div>
<div class="w-100"></div>
</div>
</div>
<!-- Footer
<div class="card-footer w-100 text-muted">
Footer stating cats are CUTE little animals
</div>
-->
</div>
</div>
{% include 'globals/footer.html' %}
{% endblock %}