cleaned up useless code
pull/3/head
surya 2024-07-16 14:57:51 +05:30
parent 9cae5bc994
commit e232fec118
9 changed files with 18 additions and 179 deletions

View File

@ -40,6 +40,7 @@ def news(request):
class BlogDetailView(DetailView): class BlogDetailView(DetailView):
model = Blog model = Blog
template_name = 'blog/blogDetail.html' template_name = 'blog/blogDetail.html'
context_object_name = 'objects'
class BlogCreateView(LoginRequiredMixin, CreateView): class BlogCreateView(LoginRequiredMixin, CreateView):

View File

@ -5,47 +5,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Beyond Heroes</title> <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"> <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> </head>
<body> <body>
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: #000;"> <nav class="navbar navbar-expand-lg navbar-dark" style="background-color: #000;">
<a class="navbar-brand" href="/"> <a class="navbar-brand" href="/">
<img src="/media/logo.jpg" alt="BH Logo" height="40"> Beyond Heroes <img src="/media/logo.jpg" alt="BH Logo" height="40"> Beyond Heroes
</a> </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="ml-auto"></div>
<div class="justify-content-center" id="navbarNav"> <div class="justify-content-center" id="navbarNav">
<ul class="navbar-nav"> <ul class="navbar-nav">

View File

@ -1,85 +0,0 @@
<!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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

View File

@ -13,11 +13,6 @@
<br> <br>
<button class="btn btn-light" type="submit"> Post </button> <button class="btn btn-light" type="submit"> Post </button>
</div> </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> </div>
</form> </form>
</div> </div>

View File

@ -1,12 +1,21 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block content %} {% block content %}
{% load markdown_extras %} {% load markdown_extras %}
<br> <div class="container mt-5">
<blockquote class="blockquote">
<h2 class="h2" style="font-family: rockwell;">{{ object.title | markdown | safe }}</h2> {% for object in objects %}
<p class="mb-0">{{ object.content | markdown | safe }}</p> <div class="card mb-3">
<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> <div class="card-body">
</blockquote> <h5 class="card-title">{{ object.title | markdown | safe }}</h5>
<hr style="margin-bottom: 20px"> <p class="card-text">{{ object.content | markdown | safe }}</p>
</div>
<div class="card-footer">
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>
</div>
</div>
{% endfor %}
</div>
{% endblock %} {% endblock %}

View File

@ -1,32 +0,0 @@
{% extends 'base.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 %}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

View File

@ -55,25 +55,11 @@ def profile(request, *args, **kwargs):
return render(request, 'users/profile.html', {'title': 'Profile', 'profileUser': user, context_object_name: queryset}) return render(request, 'users/profile.html', {'title': 'Profile', 'profileUser': user, context_object_name: queryset})
def people(request):
return render(request, 'users/people.html', {'title': 'People', 'users': User._default_manager.all()})
users = { users = {
'user': User.objects.all() 'user': User.objects.all()
} }
class UserListView(ListView):
model = User
template_name = 'users/people.html'
context_object_name = 'users'
def explore(request):
return render(request, 'users/explore.html', {'title': 'Explore'})
def login(request): def login(request):
return render(request, 'users/login.html', {'title': 'Login'}) return render(request, 'users/login.html', {'title': 'Login'})