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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:21:31+00:00 2026-06-12T23:21:31+00:00

One of the packages that my Django project uses has a simple admin class

  • 0

One of the packages that my Django project uses has a simple admin class that looks like:

class EventUpdateInline(admin.StackedInline):
    model = EventUpdate

class EventAdmin(admin.ModelAdmin):
    form = EventForm
    list_display = ('date_created', 'description', 'status', 'date_updated')
    search_fields = ('description', 'message')
    list_filter = ('services',)
    inlines = [EventUpdateInline]

I’ve written a custom EventUpdateInline class that I’d like to use. How can I replace the EventUpdateInline with my CustomEventUpdateInline class?

That’s the first issue. The second part of the problem is that I’d like to add a custom property to the EventUpdate model so that my CustomEventUpdateInline class can use it.

Where would I put my code to import my CustomEventUpdateInline and replace the old one and old add the custom property to the EventUpdate model?

I’m not sure if this is even possible. 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-06-12T23:21:32+00:00Added an answer on June 12, 2026 at 11:21 pm

    Edit:

    tl;dr: fork and use pip/virtualenv instead – it’s a much cleaner, maintainable and sane approach. monkey patching is generally a terrible idea – see linked to SO answer. But sometimes it’s the lesser evil.

    If you want a quick and dirty monkey patch – https://stackoverflow.com/a/6720998/473285

    However usually these days if the project is on github or bitbucket or whatever I just clone it, make my changes and then install my cloned version using pip -e (you are using virtualenv, right?). This is the best approach if you think your changes will be accepted upstream.

    The other thing to consider is forwards compatibility. Will your monkey-patching still work after you update the third party package to a later version? Will your changes in git merge cleanly?

    Generally I’d use monkey patching under some or all these rare circumstances:

    • you’re writing a package for distribution but you need to modify another third-party package to get things working (rare, valid only if the third-party maintainers won’t accept a patch)
    • you are doing a relatively straight forward drop-in replacement of classes, methods or functions that will mesh cleanly with the package’s internals.
    • the code isn’t available or isn’t in a form that is easy to work with using pip/virtualenv (rare)
    • you don’t think the code will be upgraded or you will ever need to upgrade (unlikely)
    • you’re not using pip/virtualenv (bad, but sometimes not possible for legacy, unconventional or badly configured installs).
    • you don’t think the upstream maintainers will ever accept your changes or that they will ever be useful to anyone else.

    If you’re doing more involved changes or something that would be more widely useful then often forking and then trying to get accepted upstream is best. Even if your changes are to facilitate purely internal stuff that will never be used anywhere outside your project virtualenv is by far a better way.

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

Sidebar

Related Questions

I'm building a small web project using Django that has one model ( Image
I currently have one project that currently contains multiple packages. These packages make up
I need to build one instance of django admin that can be used by
The gridExtra package adds a grob of class pattern that lets one fill rectangles
What fork, or combination of packages should one to use to make PyPy, Django
I have one java project in netBeans. There are some packages, and classes in
In an iOS Project with folders containing *.m files, similar to packages, one will
recently I started a small Django project that I developed on a local machine
Let's assume we have following models: from django.db import models class Foo(models.Model): name =
I have to work with few django projects that uses virtualenv (and that is

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.