mirror of
https://github.com/not-kennethreitz/morepython.org.git
synced 2026-06-05 23:10:18 +00:00
changes
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2b1 on 2019-03-11 11:49
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('core', '0003_auto_20190311_0641'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='post',
|
||||
name='uri',
|
||||
field=models.URLField(null=True),
|
||||
),
|
||||
]
|
||||
+2
-1
@@ -8,11 +8,12 @@ from taggit.managers import TaggableManager
|
||||
|
||||
class Post(models.Model):
|
||||
"""A Post, posted on the site."""
|
||||
|
||||
title = models.TextField()
|
||||
text = models.TextField()
|
||||
timestamp = models.DateTimeField(default=timezone.now)
|
||||
tags = TaggableManager()
|
||||
uri = models.URLField()
|
||||
uri = models.URLField(null=True)
|
||||
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||
published = models.BooleanField(editable=True, default=False)
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{% for article in object_list %}
|
||||
|
||||
{{ article }}
|
||||
|
||||
{% endfor %}
|
||||
@@ -1,3 +1,26 @@
|
||||
from django.views.generic import ListView, DetailView
|
||||
from django.shortcuts import render
|
||||
|
||||
from .models import Post
|
||||
|
||||
# Create your views here.
|
||||
class PostListView(ListView):
|
||||
model = Post
|
||||
paginate_by = 50
|
||||
|
||||
def get_queryset():
|
||||
Post.objects.filter(published=True)
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
return render(request, template_name="index.html")
|
||||
|
||||
|
||||
# Create your views here.
|
||||
class PostDetailView(DetailView):
|
||||
model = Post
|
||||
|
||||
def get_queryset():
|
||||
Post.objects.filter(published=True)
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
return render(request, template_name="index.html")
|
||||
|
||||
Reference in New Issue
Block a user