Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
+ load_some_random_tweets command to get some fixtures in
  • Loading branch information
FrancoisConstant committed Jul 8, 2018
1 parent 6ba208b commit 8daa662
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
34 changes: 34 additions & 0 deletions ede/fixtures.py
@@ -0,0 +1,34 @@
from ede.models import TweetAuthor, Tweet


def load_some_random_tweets():
jesus = TweetAuthor.objects.create(
name="Jesus",
username="jesus"
)

for tweet in (
"""I will be out of the office until Monday with no phone or email access. If you need immediate attention please contact my dad directly""",
"""They say abstinence is 100% effective for birth control. Tell that to my mom""",
"""YOLO!\n\nUnless you're me.""",
"""Thanks guys, but I think I'm just going to spend my birthday alone this year.""",
"""Don't listen to the shit my Dad says""",
"""Let the healing begin"""
):
Tweet.objects.create(author=jesus, content=tweet)

jim = TweetAuthor.objects.create(
name="Jim Jefferies",
username="jimjefferies"
)

for tweet in (
"""It feels like there is a World Cup camera man who's only job is to find hot girls in the crowd""",
"""If Russia wins the world cup it's fake news""",
"""If you are going to say the word cunt, you better say it with the right accent.""",
"""We would like to make it clear that Kanye West only ever worked for the Jim Jefferies Show in a freelance
capacity and his views do not represent the views of us, Jim Jefferies, or Comedy Central. As of today, he is
no longer an employee of this production.""",
"""With all this time spent protesting, when are the teachers going to learn how to shoot their guns?"""
):
Tweet.objects.create(author=jim, content=tweet)
Empty file added ede/management/__init__.py
Empty file.
Empty file.
9 changes: 9 additions & 0 deletions ede/management/commands/load_some_random_tweets.py
@@ -0,0 +1,9 @@
from django.core.management.base import BaseCommand

from ede.fixtures import load_some_random_tweets


class Command(BaseCommand):

def handle(self, *args, **options):
load_some_random_tweets()

0 comments on commit 8daa662

Please sign in to comment.