Removed Posts

removed the `posts` class and allied functionality
pull/3/head
surya 2024-07-16 14:47:16 +05:30
parent 62e1a1dd3a
commit 9cae5bc994
6 changed files with 0 additions and 109 deletions

View File

@ -12,10 +12,3 @@ class Blog(models.Model):
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

@ -6,8 +6,6 @@ urlpatterns = [
path('news/', views.news, name='News'),
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('dev/', views.dev, name='Dev'),
path('dev/support/', views.support, name='Support'),
]

View File

@ -52,22 +52,6 @@ class BlogCreateView(LoginRequiredMixin, CreateView):
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 dev(request):
return render(request, 'dev.html', {'title': 'Development'})

View File

@ -1,42 +0,0 @@
{% 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

@ -1,24 +0,0 @@
{% 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

@ -1,18 +0,0 @@
{% 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 %}