Can some one help explain the following page to me http://nullege.com/codes/search/zinnia.models.Entry.objects.create
How do I create a entry in zinnia with a form.html file and a view function in django
I know it's basic python playing around with classes
the hellow world can be found here http://django-blog-zinnia.com/blog/
For your first question:
Here
Entry.objects.create(**params)is equivalent to `Entry.objects.create(title='My entry 1', content='My conten 1', tags='zinnia, test', slug='my-entry-1', status='PUBLISHED'), which creates a new Entry with title "My entry 1" and content "My content 1" and saves to the database. The base entry class looks something like this:so lines like
self.entry_1.authors.add(self.authors[0]will relateself.athors[0]toself.entry_1throughManyToManyField.As for your second question, yes you can create a
form.htmland a view function to add a new entry, but zinnia is designed to be used with Django Admin interface to manage contents. It would also make your life much easier. To use it you will need to enable'django.contrib.admin',inINSTALLED_APPSin yoursettings.pyand also theurls.pyfiles.After Django admin is enabled, you can simply go to
example.com/admin/to create new entries.Now, if for some reason you do not or cannot use the Django admin, here is what the
views.pywould look like to add new entries:Note that you would also need to create a
forms.pyto validate the submitted form.As for your
forms.htmlyou would need to write a form that contains all the inputs you need such as "title" and "contents" and have it POST to thisadd_entryview.