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 6128995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:41:27+00:00 2026-05-23T16:41:27+00:00

I want to implement something like facebook’s unread items/notifications. I have the following model

  • 0

I want to implement something like facebook’s unread items/notifications. I have the following model currently:

class UnreadItems(models.Model):
    unread = models.BooleanField()
    content_type = models.ForeignKey(ContentType)
    object_id = models.PositiveIntegerField()
    user = models.ForeignKey(User,null=True)
    content_object = generic.GenericForeignKey('content_type','object_id')

    class Meta:
        db_table = 'unread_items'

Whenever someone creates a conversation/message or whatever to someone else, I created a new entry with the recipient as the target. However, creating unread is easy, but how should I do it in a managable fashion such that items will be marked as read whenever that resource is requested/viewed??

  • 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-23T16:41:28+00:00Added an answer on May 23, 2026 at 4:41 pm

    One option is to use Signals for this.

    Create a custom signal [set the providing argurments to be the Item accessed]

    Create a signal handler that registers to that signal. In that signal hander to access the UnreadItem corresponding to that item.

    When you access the Item that is linked with the UnreadItem (in the appropriate view method), you trigger the signal.

    This scheme would let you isolate your logic for handling the unread aspect of it, in a central signal handler.

    I presume that the reason you chose this design, is because you have multiple Item types that can be considered Unread. With this scheme, you won’t have to spread the logic of handling the Unread everywhere. All the view needs to know is to trigger the Signal.

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

Sidebar

Related Questions

I am re-designing some GUI items and want to implement something like the following:
I wrote small service class and I want implement something like that : service
I have implement something like the following on J2me. Is it possible to implement
Suppose I have a table view, and I want to implement something like this:
I want to implement something like Col3 = Col2 + Col1 in SQL. This
I am learning OOP with python. I want to implement something like to display:
I want to implement something simple like /System/Workflows/Sample Workflow with the small addition of
i want to implement a dynamic relation mechanism with python something like: a:=10 b:=30
I want to do something like this: I tried to implement it by myself
I want to implement something like voip communication that client doesn't need to install

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.