Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8600757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:41:13+00:00 2026-06-12T01:41:13+00:00

Can some one help explain the following page to me http://nullege.com/codes/search/zinnia.models.Entry.objects.create How do I

  • 0

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/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T01:41:15+00:00Added an answer on June 12, 2026 at 1:41 am

    For your first question:

    params = {'title': 'My entry 1', 'content': 'My content 1',
              'tags': 'zinnia, test', 'slug': 'my-entry-1',
              'status': PUBLISHED}
    self.entry_1 = Entry.objects.create(**params)
    self.entry_1.authors.add(self.authors[0])
    self.entry_1.categories.add(*self.categories)
    self.entry_1.sites.add(*self.sites)
    

    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:

    class EntryAbstractClass(models.Model):
        """Base Model design for publishing entries"""
        STATUS_CHOICES = ((DRAFT, _('draft')),
                          (HIDDEN, _('hidden')),
                          (PUBLISHED, _('published')))
    
        title = models.CharField(_('title'), max_length=255)
    
        image = models.ImageField(_('image'), upload_to=UPLOAD_TO,
                                  blank=True, help_text=_('used for illustration'))
        content = models.TextField(_('content'))
        excerpt = models.TextField(_('excerpt'), blank=True,
                                    help_text=_('optional element'))
    
        tags = TagField(_('tags'))
        categories = models.ManyToManyField(Category, verbose_name=_('categories'),
                                            related_name='entries',
                                            blank=True, null=True)
        related = models.ManyToManyField('self', verbose_name=_('related entries'),
                                         blank=True, null=True)
    
        slug = models.SlugField(help_text=_('used for publication'),
                                unique_for_date='creation_date',
                                max_length=255)
    
        authors = models.ManyToManyField(User, verbose_name=_('authors'),
                                         related_name='entries',
                                         blank=True, null=False)
    

    so lines like self.entry_1.authors.add(self.authors[0] will relate
    self.athors[0] to self.entry_1 through ManyToManyField.

    As for your second question, yes you can create a form.html and 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', in INSTALLED_APPS in
    your settings.py and also the urls.py files.

    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.py would look like to add new entries:

    #views.py
    from . import forms as entryform
    from zinnia.models.entry import Entry
    
    def add_entry(request):
        form = entryform.EntryForm(request.POST or None)
        if not (request.method == 'POST' and form.is_valid()):
            return render_to_response("forms.html", {'form': form})
        title = request.POST['title']
        content = request.POST['content']
        #...many more..
        Entry.objects.create(title=title, content=content)
        return render_to_response('success.html', {'form': form,})
    

    Note that you would also need to create a forms.py to validate the submitted form.

    As for your forms.html you would need to write a form that contains all the
    inputs you need such as “title” and “contents” and have it POST to this
    add_entry view.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can some one please help explain why when I block and continue observer's onNext
I have a query with regards to pointers, can someone help explain the following
Possible Duplicate: JavaScript: formatting number with exactly two decimals Can some one please help
Can any one please help me solve this. I am resizing some flash object/embed
Can anyone help me explain how TimeProvider.Current can become null in the following class?
Can someone help explain the following: If I type: a=`ls -l` Then the output
hi every body can some one help me with thi problem i have a
Could someone please help explain why I can't get this to work? I properly
Can someone help me with creating functions for the following processes? I want to
Can someone help explain what configuration I'm missing to get the Sencha Ext JS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.