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:
@@ -1,3 +1,7 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
|
||||
from .models import Post
|
||||
|
||||
admin.site.register(Post)
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from core.models import Post
|
||||
|
||||
from requests_html import HTMLSession
|
||||
|
||||
|
||||
requests_html = HTMLSession()
|
||||
|
||||
|
||||
def get_hn(filter="py"):
|
||||
r = requests_html.get('https://news.ycombinator.com/')
|
||||
pass
|
||||
|
||||
|
||||
def get_reddit():
|
||||
pass
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Import content from known sites.'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('--hn', action='store_true')
|
||||
parser.add_argument('--reddit', action='store_true')
|
||||
# parser.add_argument('--pycoders', action='store_true')
|
||||
|
||||
def handle(self, *args, **options):
|
||||
if options['hn']:
|
||||
get_hn()
|
||||
|
||||
if options['reddit']:
|
||||
get_reddit()
|
||||
+1
-2
@@ -7,8 +7,7 @@ from taggit.managers import TaggableManager
|
||||
class Post(models.Model):
|
||||
title = models.TextField()
|
||||
text = models.TextField()
|
||||
created_date = models.DateTimeField(default=timezone.now)
|
||||
published_date = models.DateTimeField(blank=True, null=True)
|
||||
timestamp = models.DateTimeField(default=timezone.now)
|
||||
tags = TaggableManager()
|
||||
|
||||
def __unicode__(self):
|
||||
|
||||
Reference in New Issue
Block a user