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

The Archive Base Latest Questions

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

We are implementing the gamification component of a project in Django. We would like

  • 0

We are implementing the gamification component of a project in Django. We would like the superuser to be able to define new badges and redefine existing ones inside the Django admin interface.

The problem as we see it is that defining the sometimes complicated conditions for badges needs to be done in code. The superuser will be technically knowledgeable, but will not be a programmer.

How would you go about letting the superuser do this in the Django admin interface, rather than alter the application?

Here are some examples of badges:

  • Created 10 tags that have been used on 10 questions by 10 different
    members.
  • Answered 10 unanswered questions.
  • Wrote 20 comments to a question (comments got at least 5 points each).
  • 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-27T16:02:27+00:00Added an answer on May 27, 2026 at 4:02 pm

    You don’t say if you expect the superuser to be a programmer or not.

    If you can assume this then you could include Python code in a database field and use eval or exec to run it.

    For example:

    badge.function = """
    def award_badge(user):
        return False
    """
    
    vars = {}
    exec(badge.function, vars)
    
    if vars["award_badge"](user):
        ...
    

    Clearly this has a lot of scope for abuse or mistakes, and certainly wouldn’t be suitable if you expect non-technical users to be creating badges.

    Depending on the complexity of the rules you need to create you might be able to create rules engine for executing them. In this case you create a sort of mini-language where each step in the process of deciding whether to award a badge or not is specified by a row in the database. Rules engines are a complicated topic so I won’t go into detail here.

    You’re probably better off hard coding the rules for badges in your code than using either of these suggestions.

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

Sidebar

Related Questions

implementing service something similar with tinyurl or bit.ly, I'm would like to expose service
When implementing a MessageFactory class to instatiate Message objects I used something like: class
When implementing IObserver yourself, you know how well you would cope with a situation
When implementing HTTP services in node.js, there is a lot of sample code like
When implementing a Matrix construct using arrays, which would be more efficient? Using a
In implementing M-V-VM in a project and following advice of Karl Shifflett about implementing
Implementing a Thread by providing a new class that extends Thread and overriding its
While implementing the code from this question on my project I realized there's 3
When implementing a factory or simple factory, what would go against using a Type
Im implementing a project in java using webservices and I need to figure out

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.