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

  • Home
  • SEARCH
  • 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 6099151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:14:24+00:00 2026-05-23T13:14:24+00:00

I really hope someone can shed some light on this problem, I have built

  • 0

I really hope someone can shed some light on this problem,

I have built a new and blog app that I’m using in a django cms site. The client requested that blog and news posts go through an editor before they are published to the website

To accomplish this I did the following

def publish(self, request, queryset):
    rows_updated = queryset.update(status='p')
    if rows_updated == 1:
        message_bit = "1 story was"
    else:
        message_bit = "%s stories were" % rows_updated
    self.message_user(request, "%s successfully marked as published." % message_bit)

def un_publish(self, request, queryset):
    rows_updated = queryset.update(status='w')
    if rows_updated == 1:
        message_bit = "1 entry was"
    else:
        message_bit = "%s entries were" % rows_updated
    self.message_user(request, "%s successfully marked as un-published." % message_bit)

in the model admin for each model (blog and news) this allows the client to update the status of the blog or new post to published etc. However, client has also requested that they be able to preview the posts before they are published. As my blog and new query sets only return posts that have a status of ‘p’ for published the new/blog matching queries fail when trying to view the posts using the Preview on site feature built into django’s admin interface

Has anyone got a work around for this of perhaps recommend something i could try to get this working

Thanks

  • 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-05-23T13:14:24+00:00Added an answer on May 23, 2026 at 1:14 pm

    To keep code clean you can create separate view that renders page the same way as standard one but does not filter over status.

    Than to have admin link working edit/add get_absolute_url so in case of state=”w” it returns address for the new view. I.e:

    def get_absolute_url(self):
        if self.status == 'p'
            return "/post/%i/" % self.id
        else:
            return "/preview/post/%i/" % self.id
    

    PS: If you are a purist you may prefer using permalink decorator 🙂

    @models.permalink
    def get_absolute_url(self):
        if self.status == 'p'
            return ('post.views.details', [str(self.id)])
        else:
            return ('post.views.preview', [str(self.id)])
    

    See: http://docs.djangoproject.com/en/dev/ref/models/instances/

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

Sidebar

Related Questions

I really hope someone can help with this problem. I have an ajax pagination
This really, really urks me, so I hope that someone can give me a
I really hope someone can help on this because I'm learning cocoa and have
I'm driving myself nuts with this particular problem, i really hope someone can help!
Really hope this can be done but I have come across a problem I
I hope that someone can shed a light on the (to me) unexpected behavioral
Really hope someone can help me as I'm a bit stuck :S I have
I really hope someone can help me with this. I'm struggling with it for
Really hope someone can point me in the right direction as I have no
I really hope someone who is a CC.NET expert can help with this, because

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.