Commits

Luke Plant  committed 6efc0a6

Made use of 'published' attribute

  • Participants
  • Parent commits 2e57ee5

Comments (0)

Files changed (2)

File sermons/management/commands/import_sermons.py

                 s.load_attrs_from_filename()
                 try:
                     s.full_clean()
+                    s.published = True
                     sermons.append(s)
                 except ValidationError as e:
                     errors.append("%s could not be imported due to missing/bad data for fields: %s" % (f, ','.join(e.message_dict.keys())))

File sermons/views.py

 from sermons.models import Sermon
 
 def index(request):
-    sermons = Sermon.objects.all()
+    sermons = Sermon.objects.filter(published=True)
     return render(request, "sermons/index.html", {'sermons': sermons})