initial commit

with_posts
Surya-AI 2024-07-06 20:29:07 +05:30
commit b003f98cba
126 changed files with 1271 additions and 0 deletions

0
BH/__init__.py Normal file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

16
BH/asgi.py Normal file
View File

@ -0,0 +1,16 @@
"""
ASGI config for TechBlog project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'BH.settings')
application = get_asgi_application()

130
BH/settings.py Normal file
View File

@ -0,0 +1,130 @@
"""
Django settings for TechBlog project.
Generated by 'django-admin startproject' using Django 3.0.6.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TEMPLATES_DIR = os.path.join(BASE_DIR + '/templates')
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '!2g)+m+_h9fq9%il5+t5#qnj^9502or6$=2!$==v=i2*c#7q*m'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'crispy_forms',
'crispy_bootstrap4',
'blog.apps.BlogConfig',
'users.apps.UsersConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'BH.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [TEMPLATES_DIR],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'BH.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR + '/media')
MEDIA_URL = '/media/'
CRISPY_TEMPLATE_PACK = 'bootstrap4'
LOGIN_REDIRECT_URL = 'Home'
LOGIN_URL = 'Login'

28
BH/urls.py Normal file
View File

@ -0,0 +1,28 @@
"""TechBlog URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('', include('blog.urls')),
path('users/', include('users.urls')),
path('admin/', admin.site.urls),
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

16
BH/wsgi.py Normal file
View File

@ -0,0 +1,16 @@
"""
WSGI config for TechBlog project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'BH.settings')
application = get_wsgi_application()

0
blog/__init__.py Normal file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

10
blog/admin.py Normal file
View File

@ -0,0 +1,10 @@
from django.contrib import admin
from .models import *
# Register your models here.
class BlogAdmin(admin.ModelAdmin):
list_display = ('title', 'author', 'date_posted')
admin.site.register(Blog, BlogAdmin)

5
blog/apps.py Normal file
View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class BlogConfig(AppConfig):
name = 'blog'

View File

@ -0,0 +1,28 @@
# Generated by Django 3.1.7 on 2021-04-29 07:06
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Blog',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('content', models.TextField()),
('title', models.CharField(max_length=100)),
('date_posted', models.DateTimeField(default=django.utils.timezone.now)),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]

View File

@ -0,0 +1,58 @@
# Generated by Django 5.0.2 on 2024-03-15 10:14
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.AddField(
model_name='blog',
name='likes',
field=models.ManyToManyField(related_name='blog_like', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='blog',
name='title',
field=models.CharField(max_length=150),
),
migrations.CreateModel(
name='BlogComment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('content', models.CharField(max_length=250)),
('date_posted', models.DateTimeField(default=django.utils.timezone.now)),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('blog', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.blog')),
('likes', models.ManyToManyField(related_name='blog_comment_like', to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Post',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('content', models.TextField()),
('date_posted', models.DateTimeField(default=django.utils.timezone.now)),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('likes', models.ManyToManyField(related_name='post_like', to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='PostComment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('content', models.CharField(max_length=250)),
('date_posted', models.DateTimeField(default=django.utils.timezone.now)),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.post')),
],
),
]

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

21
blog/models.py Normal file
View File

@ -0,0 +1,21 @@
from django.contrib.auth.models import User
from django.db import models
from django.utils import timezone
# Create your models here.
class Blog(models.Model):
content = models.TextField()
title = models.CharField(max_length=150)
author = models.ForeignKey(User, on_delete=models.CASCADE)
date_posted = models.DateTimeField(default=timezone.now)
def get_absolute_url(self):
return '/'
class Post(models.Model):
content = models.TextField()
author = models.ForeignKey(User, on_delete=models.CASCADE)
date_posted = models.DateTimeField(default=timezone.now)

View File

@ -0,0 +1,12 @@
from django import template
from django.template.defaultfilters import stringfilter
import markdown as md
register = template.Library()
@register.filter()
@stringfilter
def markdown(value):
return md.markdown(value, extensions=['markdown.extensions.fenced_code'])

3
blog/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

11
blog/urls.py Normal file
View File

@ -0,0 +1,11 @@
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name='Home'),
path('blog/<int:pk>', views.BlogDetailView.as_view(), name='Blog'),
path('blog/create/', views.BlogCreateView.as_view(), name='Blog Create'),
path('post/<int:pk>', views.PostDetailView.as_view(), name='Post'),
path('post/create/', views.PostCreateView.as_view(), name='Post Create'),
path('about/', views.about, name='About')
]

77
blog/views.py Normal file
View File

@ -0,0 +1,77 @@
from django.shortcuts import render
from django.contrib.auth.mixins import *
from django.views.generic import *
from .models import *
# Create your views here.
def home(request):
blogs = {
'blog': Blog.objects.all()
}
allow_empty = True
queryset = None
model = Post
paginate_by = None
paginate_orphans = 0
context_object_name = 'posts'
# paginator_class = Paginator
# page_kwarg = "page"
ordering = ['-date_posted']
if queryset is not None:
queryset = queryset
if isinstance(queryset, QuerySet):
queryset = queryset.all()
elif model is not None:
queryset = model._default_manager.all()
else:
raise ImproperlyConfigured(
"%(cls)s is missing a QuerySet. Define "
"%(cls)s.model, %(cls)s.queryset, or override "
"%(cls)s.get_queryset()." % {"cls": self.__class__.__name__}
)
if ordering:
if isinstance(ordering, str):
ordering = (ordering,)
queryset = queryset.order_by(*ordering)
return render(request, 'blog/home.html', { context_object_name: queryset, 'topics': ['Django', 'UkraineConflict', 'TechBlog'] })
class BlogDetailView(DetailView):
model = Blog
template_name = 'blog/blogDetail.html'
class BlogCreateView(LoginRequiredMixin, CreateView):
model = Blog
template_name = 'blog/blogCreate.html'
fields = ['title', 'content']
def form_valid(self, form):
form.instance.author = self.request.user
return super().form_valid(form)
class PostDetailView(DetailView):
model = Post
template_name = 'blog/postDetail.html'
class PostCreateView(LoginRequiredMixin, CreateView):
model = Post
template_name = 'blog/postCreate.html'
fields = ['content']
def form_valid(self, form):
form.instance.author = self.request.user
return super().form_valid(form)
def about(request):
return render(request, 'blog/about.html', {'title': 'About'})

BIN
db.sqlite3 Normal file

Binary file not shown.

21
manage.py Normal file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'TechBlog.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()

BIN
media/default.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
media/logo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

5
server.bat Normal file
View File

@ -0,0 +1,5 @@
@ echo off
echo The devlopment server will start in a few seconds...
python manage.py makemigrations
python manage.py migrate
python manage.py runserver 3000

99
templates/base.html Normal file
View File

@ -0,0 +1,99 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Beyond Heroes</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<!-- Custom CSS -->
<style>
/* body {
background-color: #f8f9fa;
color: #eeeeee;
}
.card {
border: 1px;
border-radius: 15px;
border-color: #eeeeee;
box-shadow: 0 0 10px rgba(250, 250, 250, 0.1);
}
.list-group-item {
background-color: #1e1f10;
border-color: #eeeeee;
}
.card-header {
background-color: #111111;
border-bottom: 1px solid #eeeeee;
}
.card-body {
background-color: #1e1f10;
}
.profile-image {
max-width: 125px;
border-radius: 50%;
padding: 20px;
}*/
.link {
text-decoration: none;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: #000;">
<a class="navbar-brand" href="/">
<img src="/logo.jpg" alt="BH Logo" height="40"> Beyond Heroes
</a>
<!-- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button> -->
<div class="ml-auto"></div>
<div class="justify-content-center" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item" style="padding-right: 10px; padding-left: 10px;">
<a class="nav-link" href="/news">News</a>
</li>
<li class="nav-item" style="padding-right: 10px; padding-left: 10px;">
<a class="nav-link" href="/dev/">Development</a>
</li>
<li class="nav-item" style="padding-right: 10px; padding-left: 10px;">
<a class="nav-link" href="/dev/support/">Support Us</a>
</li>
</ul>
</div>
<div class="ml-auto"></div>
<div class="justify-content-center" id="navbarNav">
<ul class="navbar-nav">
{% if user.is_authenticated %}
<li class="nav-item">
<form action="{% url 'Logout' %}" method="post">
{% csrf_token %}
<button class="nav-link btn btn-link" type="submit">Logout</button>
</form>
</li>
{% else %}
<li class="nav-item">
<a class="nav-link" href="{% url 'Login' %}">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'Register' %}">Register</a>
</li>
{% endif %}
</ul>
</div>
</nav>
{% block content %}
{% endblock %}
<div style="padding: 30px;"></div>
<footer>
<div class="container">
<!-- <p style="text-align: center;">&copy; Beyond Heroes. All rights reserved.</p> -->
</div>
</footer>
<!-- Bootstrap JavaScript and dependencies -->
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.min.js"></script>
</body>
</html>

85
templates/base2.html Normal file
View File

@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
{% if title %}
<title>WeBlog - {{ title }}</title>
{% else %}
<title>WeBlog - We connect your brains!</title>
{% endif %}
<link rel="icon" type="image/x-icon" href="WeBlog.ico">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary rounded-bottom" style="background: #a4e5ff; margin-bottom:10px">
<div class="container">
<a class="navbar-brand" href="/">TechBlog</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="/">Home<span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'About' %}">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'People' %}">People</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'Explore' %}">Explore</a>
</li>
</ul>
<div style="margin-left: 60%;"></div>
<ul class="navbar-nav nav-rev" style="margin-right: 0px;">
{% if user.is_authenticated %}
<li class="nav-item">
<a class="nav-link" id='a' href="{% url 'Blog Create' %}">Post</a>
</li>
<li class="nav-item">
<a class="nav-link" id='a' href="{% url 'Profile' %}">Profile</a>
</li>
<li class="nav-item">
<a class="nav-link" id='a' href="{% url 'Logout' %}">Logout</a>
</li>
{% else %}
<li class="nav-item">
<a class="nav-link" href="{% url 'Login' %}">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" id=a href="{% url 'Register' %}">Register</a>
</li>
{% endif %}
</ul>
</div>
</div>
</nav>
<div id="container"
style="font-family: Rockwell; margin-bottom: 0; padding-bottom: 10px; padding-top: 20px; padding-right: 100px; padding-left: 100px;">
{% if messages %}
{% for message in messages %}
<div class="alert alert-{{ message.tags }}">
{{ message }}
</div>
{% endfor %}
{% endif %}
{% block content %}
{% endblock %}
</div>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"
integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
crossorigin="anonymous"></script>
</body>
</html>

17
templates/blog/about.html Normal file
View File

@ -0,0 +1,17 @@
{% extends 'base.html' %}
{% block content %}
<h1 class="display-1">About TechBlog</h1>
<hr>
<br>
<blockquote>
<h1 class="display-4">Why this community is built</h1>
<p class="h5" style="line-height: 1.5em;">The TechBlog™ community is buit for people who love to share and help other people whenever they get stuck. We have built this platform for people to help each other and make project making fun. We encourage people to get together and work in harmony for the wellbeing of all. People can make groups to work on a project or send blogs or videos that explain a topic or problem very significantly and make work much easier for other co-workers or users. Our main goal is to help everyone and enhance the art of <strong>Problem Solving</strong> through this platform.</p>
</blockquote>
<hr>
<blockquote>
<h1 class="display-4">What do we offer</h1>
<p class="h5" style="line-height: 1.5em;">The TechBlog™ community offers a platform for group work and online chat to all and allow our members to share <em>text, images, videos, codes, projects and even more...</em> with any other member.</p>
</blockquote>
<hr>
<br>
{% endblock %}

42
templates/blog/blog.html Normal file
View File

@ -0,0 +1,42 @@
{% extends 'base.html' %}
{% block content %}
<h1 class="display-3" style="font-family: rockwell;"><strong>TechBlog</strong></h1>
<h4 class="lead"><strong>We provide a platform for people who want to help others.</strong></h4>
<hr>
<br>
<ul style="margin-bottom: 100px">
{% for blog in blog %}
<!-- <li>-->
<!-- <h2>{{ blog.title }}</h2>-->
<!-- <p>{{ blog.content }}</p>-->
<!-- <hr>-->
<!-- </li>-->
<blockquote class="blockquote">
<a href="{% url 'Blog' blog.id %}" class="h2" style="font-family: rockwell; color:rgb(0, 92, 167);">{{ blog.title }}</a>
<p class="mb-0">{{ blog.content }}</p>
<footer class="blockquote-footer">posted by <cite title="{{ blog.author }}"><a href="{% url 'NamedProfile' blog.author.id %}">{{ blog.author }}</a></cite> on <cite title="{{ blog.date_posted }}">{{ blog.date_posted|date:"M j, o" }}</cite></footer>
</blockquote>
<hr>
<!-- <li class="media">-->
<!-- <img src="..." class="mr-3" alt="...">-->
<!-- <div class="media-body">-->
<!-- <h5 class="mt-0 mb-1">{{ blog.title }}</h5>-->
<!-- {{ blog.content }}-->
<!-- </div>-->
<!-- </li>-->
<!-- <hr>-->
<!-- <br>-->
<!-- <div class="card">-->
<!-- <div class="card-header">-->
<!-- {{ blog.author }}-->
<!-- </div>-->
<!-- <div class="card-body">-->
<!-- <h5 class="card-title">{{ blog.title }}</h5>-->
<!-- <p class="card-text">{{ blog.content }}</p>-->
<!-- <a href="#" class="btn btn-primary">Read More</a>-->
<!-- </div>-->
<!-- </div>-->
<!-- <br>-->
{% endfor %}
</ul>
{% endblock %}

View File

@ -0,0 +1,24 @@
{% extends 'base.html' %}
{% block content %}
{% load crispy_forms_tags %}
<div class="container mt-5">
<form method="POST">
{% csrf_token %}
<div class="card mb-4">
<div class="card-header">
Create a Blog
</div>
<div class="card-body">
{{ form | crispy }}
<br>
<button class="btn btn-light" type="submit"> Post </button>
</div>
<!-- <div class="card-footer">
<small class="text-muted">
Don't Have An Account? <a class="link" href="{% url 'Register' %}">Register</a>
</small>
</div> -->
</div>
</form>
</div>
{% endblock %}

View File

@ -0,0 +1,12 @@
{% extends 'base2.html' %}
{% block content %}
{% load markdown_extras %}
<br>
<blockquote class="blockquote">
<h2 class="h2" style="font-family: rockwell;">{{ object.title | markdown | safe }}</h2>
<p class="mb-0">{{ object.content | markdown | safe }}</p>
<footer class="blockquote-footer">posted by <cite title="{{ object.author }}"><a href="{% url 'NamedProfile' blog.author.id %}">{{ object.author }}</a></cite> on <cite title="{{ object.date_posted }}">{{ object.date_posted|date:"M j, o" }}</cite></footer>
</blockquote>
<hr style="margin-bottom: 20px">
{% endblock %}

View File

@ -0,0 +1,32 @@
{% extends 'base2.html' %}
{% block content %}
{% load markdown_extras %}
<div style="">
<h1 class="h1">We Blog</h1>
<p class="lead">We connect your brains!</p>
<hr class="my-4" />
</div>
<ul class="list-unstyled">
{% for post in blogs %}
<div class="jumbotron" id="jumbotron" style="background-color: #ffffff60;">
<li class="media">
<article class="media content-section">
<div class="media-body">
<div class="article-metadata">
<a class="mr-2" href="{% url 'NamedProfile' post.author.id %}">{{ post.author }}</a>
<small class="text-muted">{{ post.data_posted|date:"M j, Y" }}</small>
<br>
</div>
<a class="article-title" style="font-size: 40px;" href="{% url 'Blog' post.id %}">{{ post.title | markdown | safe }}</a>
<hr class="my-4" />
<p class="article-content">{{ post.content | markdown | safe }}</p>
</div>
</article>
</li>
</div>
{% endfor %}
</ul>
</div>
{% endblock %}

56
templates/blog/home.html Normal file
View File

@ -0,0 +1,56 @@
{% extends 'base.html' %}
{% block content %}
{% load markdown_extras %}
<!-- Main Content -->
<div class="container mt-5">
<div class="row">
<div class="col-lg-8">
<!-- Feed -->
<div class="card">
<div class="card-header">
Latest Posts
</div>
<div class="card-body">
{% for post in posts %}
<!-- Posts will be dynamically added here -->
<div class="card mb-3">
<div class="card-body">
<h5 class="card-title">{{ post.author.username }} <a href="{% url 'NamedProfile' post.author.id %}" class="link text-secondary lead">@{{ post.author.id }}</a></h5>
<p class="card-text">{{ post.content | markdown | safe }}</p>
</div>
</div>
<!-- End of Posts -->
{% endfor %}
</div>
</div>
</div>
<!-- Sidebar -->
<div class="col-lg-4">
<div class="card mb-4">
<div class="card-header">
Trending Topics
</div>
<div class="card-body">
<ul class="list-group list-group-flush">
{% for topic in topics %}
<li class="list-group-item">{{ topic }}</li>
{% endfor %}
</ul>
</div>
</div>
</div>
{% if user.is_authenticated %}
<form action="{% url 'Post Create' %}" method="get">
{% csrf_token %}
<button href="#" class="btn btn-outline-dark btn-floating" type="submit" style="position: fixed; bottom: 20px; right: 20px; width: 60px; height: 40px;">Post</button>
</form>
{% endif %}
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,24 @@
{% extends 'base.html' %}
{% block content %}
{% load crispy_forms_tags %}
<div class="container mt-5">
<form method="POST">
{% csrf_token %}
<div class="card mb-4">
<div class="card-header">
Create a Post
</div>
<div class="card-body">
{{ form | crispy }}
<br>
<button class="btn btn-light" type="submit"> Post </button>
</div>
<div class="card-footer">
<small class="text-muted">
Don't Have An Account? <a class="link" href="{% url 'Register' %}">Register</a>
</small>
</div>
</div>
</form>
</div>
{% endblock %}

View File

@ -0,0 +1,18 @@
{% extends 'base2.html' %}
{% block content %}
{% load markdown_extras %}
<br>
<blockquote class="blockquote">
<p class="mb-0">{{ object.content | markdown | safe }}</p>
<footer class="blockquote-footer">posted by <cite title="{{ object.author }}"><a href="{% url 'NamedProfile' blog.author.id %}">{{ object.author }}</a></cite> on <cite title="{{ object.date_posted }}">{{ object.date_posted|date:"M j, o" }}</cite></footer>
</blockquote>
<hr style="margin-bottom: 20px">
{% for comment in object.comments %}
<blockquote class="blockquote" style="margin-left: 10px;">
<p class="mb-1">{{ comment.content | markdown | safe }}</p>
<footer class="blockquote-footer">posted by <cite title="{{ comment.author }}"><a href="{% url 'NamedProfile' comment.author.id %}">{{ comment.author }}</a></cite> on <cite title="{{ comment.date_posted }}">{{ comment.date_posted|date:"M j, o" }}</cite></footer>
</blockquote>
<hr style="margin-bottom: 10px; margin-left: 10px;">
{% endfor %}
{% endblock %}

BIN
templates/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 KiB

BIN
templates/logo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -0,0 +1,18 @@
{% extends 'base.html' %}
{% block content %}
<h1 class="display-1">Explore</h1>
<p class="lead">Know your potential</p>
<hr>
<br>
<blockquote>
<h1 class="display-4">Why this community is built</h1>
<p class="h5" style="line-height: 1.5em;">The TechBlog™ community is buit for people who love to share and help other people whenever they get stuck. We have built this platform for people to help each other and make project making fun. We encourage people to get together and work in harmony for the wellbeing of all. People can make groups to work on a project or send blogs or videos that explain a topic or problem very significantly and make work much easier for other co-workers or users. Our main goal is to help everyone and enhance the art of <strong>Problem Solving</strong> through this platform.</p>
</blockquote>
<hr>
<blockquote>
<h1 class="display-4">What do we offer</h1>
<p class="h5" style="line-height: 1.5em;">The TechBlog™ community offers a platform for group work and online chat to all and allow our members to share <em>text, images, videos, codes, projects and even more...</em> with any other member.</p>
</blockquote>
<hr>
<br>
{% endblock %}

View File

@ -0,0 +1,24 @@
{% extends 'base.html' %}
{% block content %}
{% load crispy_forms_tags %}
<div class="container mt-5">
<form method="POST">
{% csrf_token %}
<div class="card mb-4">
<div class="card-header">
Login
</div>
<div class="card-body">
{{ form | crispy }}
<br>
<button class="btn btn-light" type="submit"> Login </button>
</div>
<div class="card-footer">
<small class="text-muted">
Don't Have An Account? <a class="link" href="{% url 'Register' %}">Register</a>
</small>
</div>
</div>
</form>
</div>
{% endblock %}

View File

@ -0,0 +1,25 @@
{% extends 'base.html' %}
{% block content %}
{% load crispy_forms_tags %}
{% if messages %}
{% for message in messages %}
<div class="alert alert-{{message.tags}}">{{ message }}</div>
{% endfor %}
{% endif %}
<div class="container mt-5">
<div class="card mb-4">
<div class="card-header h5">
You have been Logged Out
</div>
<div class="card-body">
Hope you enjoyed Today!
</div>
<div class="card-footer">
<small class="text-muted">
Go to <a href="{% url 'Home' %}" class="link">Home</a> or <a href="{% url 'Login' %}" class="link" type="submit"> Log in </a> Again?
</small>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,25 @@
{% extends 'base.html' %}
{% block content %}
<h1 class="display-1">People</h1>
<p class="lead">Know the people around you better!</p>
<hr>
<ul style="list-style-type:none; padding-left:10px; padding-right:10px">
{% for object in users %}
<li>
<blockquote class="blockquote">
<a class="h2" style="font-family: rockwell;" href="{% url 'NamedProfile' object.id %}">{{ object.username }}</a>
<!-- <p class="mb-0">{{ object.bio }}</p> -->
<p class="lead">Email: {{ object.email }}</p>
<!-- <footer class="blockquote-footer">posted by <cite title="{{ object.author }}"><a href="#">{{ object.author }}</a></cite> on <cite title="{{ object.date_posted }}">{{ object.date_posted|date:"M j, o" }}</cite></footer>-->
</blockquote>
<hr>
</li>
{% endfor %}
</ul>
<!--<blockquote>-->
<!-- <h1 class="display-4">What do we offer</h1>-->
<!-- <p class="h5" style="line-height: 1.5em;">The TechBlog™ community offers a platform for group work and online chat to all and allow our members to share <em>text, images, videos, codes, projects and even more...</em> with any other member.</p>-->
<!--</blockquote>-->
<!--<hr>-->
<br>
{% endblock %}

View File

@ -0,0 +1,65 @@
{% extends 'base.html' %}
{% block content %}
{% load markdown_extras %}
<!-- Main Content -->
<div class="container mt-5">
<div class="row">
<!-- Mainbar -->
<div class="col-lg-8">
<div class="card-body">
<div class="card">
<div class="card-header">
Latest Posts
</div>
<div class="card-body">
{% for post in posts %}
{% if post.author == profileUser %}
<!-- Posts will be dynamically added here -->
<div class="card mb-3 userPost">
<div class="card-body">
<h5 class="card-title">{{ post.author.username }} <a href="#" class="link text-secondary lead" style="text-decoration: none;">@{{ post.author.id }}</a></h5>
<p class="card-text">{{ post.content | markdown | safe }}</p>
</div>
</div>
<!-- End of Posts -->
{% endif %}
{% endfor %}
</div>
</div>
</div>
</div>
<!-- Sidebar -->
<div class="col-lg-4">
<div class="card mb-4">
<div class="row" style="padding-bottom: 20px;">
<div class="col-md-4 text-center">
<img src="https://cdn.pixabay.com/photo/2017/06/13/12/54/profile-2398783_1280.png" alt="Profile Image" class="profile-image">
</div>
<div class="col-md-8">
<h2 class="mt-3" style="margin-bottom: 0px;">{{ profileUser.username }}</h2>
<p class="text-secondary lead" style="margin-bottom: 0px;">@{{ profileUser.id }}</p>
<p>Date Joined: Jan 1, 2022</p>
{% if profileUser == user %}
<a href="#" class="link">Edit Profile</a>
{% endif %}
</div>
</div>
</div>
</div>
{% if user.is_authenticated %}
<form action="{% url 'Post Create' %}" method="get">
{% csrf_token %}
<button href="#" class="btn btn-outline-dark btn-floating" type="submit" style="position: fixed; bottom: 20px; right: 20px; width: 60px; height: 40px;">Post</button>
</form>
{% endif %}
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,24 @@
{% extends 'base.html' %}
{% block content %}
{% load crispy_forms_tags %}
<div class="container mt-5">
<form method="POST">
{% csrf_token %}
<div class="card mb-4">
<div class="card-header">
Create an Account
</div>
<div class="card-body">
{{ form | crispy }}
<br>
<button class="btn btn-light sm" type="submit"> Register </button>
</div>
<div class="card-footer">
<small class="text-muted">
Already Have An Account? <a class="link" href="{% url 'Login' %}">Sign In</a>
</small>
</div>
</div>
</form>
</div>
{% endblock %}

0
users/__init__.py Normal file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More