2015-09-28 10:34:25 +03:00
|
|
|
from datetime import date
|
|
|
|
|
2015-10-31 23:46:43 +03:00
|
|
|
from .models import Article, Reporter
|
2015-09-28 10:34:25 +03:00
|
|
|
|
|
|
|
r = Reporter(first_name='John', last_name='Smith', email='john@example.com')
|
|
|
|
r.save()
|
|
|
|
|
|
|
|
r2 = Reporter(first_name='Paul', last_name='Jones', email='paul@example.com')
|
|
|
|
r2.save()
|
|
|
|
|
2015-10-03 08:17:51 +03:00
|
|
|
a = Article(id=None, headline="This is a test",
|
|
|
|
pub_date=date(2005, 7, 27), reporter=r)
|
2015-09-28 10:34:25 +03:00
|
|
|
a.save()
|
|
|
|
|
2015-10-03 08:17:51 +03:00
|
|
|
new_article = r.articles.create(
|
|
|
|
headline="John's second story", pub_date=date(2005, 7, 29))
|
2015-09-28 10:34:25 +03:00
|
|
|
|
|
|
|
new_article2 = Article(headline="Paul's story", pub_date=date(2006, 1, 17))
|
|
|
|
r.articles.add(new_article2)
|