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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:57:19+00:00 2026-05-28T06:57:19+00:00

I have written a simple feedback application in django. It’s not particulairly complex, basically

  • 0

I have written a simple feedback application in django. It’s not particulairly complex, basically it allows authenticated users to write a shot message with a subject line and submit that message via a form. I then allows who are in a selected group to view user submitted feedback. In the future I may add more functionality but for now it does what I want.

Here comes my question, the site I’m building has multiple places where I would like to use the feedback app, for example I have a “what do you think of the site?” kind of page at /dev/feedback/ I also have one for customer support feedback at “/support/feedback/” Currently I have just copied the code from my mysite.apps.dev.feedback over to mysite.apps.support.feedback.

The problem is that this has now created two separate copies of the same code. Despite having just written the app the two versions are already starting to diverge which is annoying. My question is simply how do I create multiple instances of the same app in a django site with distinct database models?

Some resources I’ve found related but not helpful are https://docs.djangoproject.com/en/dev/topics/http/urls/ and Reversing namespaced URLs in Django: multiple instances of the same app The first page does not offer much on the issue and the second page provides somewhat cludgey and impractical solutions that seem to be both unrelated and more work than their worth. Is there a proper way to implement multiple instances of the same django app?

  • 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-28T06:57:20+00:00Added an answer on May 28, 2026 at 6:57 am

    Single model approach

    I’d personally try to keep this as one app and have a view that can handle being posted from multiple locations / tag them appropriately.

    As S.Lott says, this is the way to go. I am providing alternatives if you’re curious about methods to keep your code in one place in other situations.

    For example, you could add a category field to your model, set up a single url conf which accepts an argument in the URL such as /(?P<category>\w+/feedback/$ and have the view simply tag the feedback with the appropriate category.

    class MyForm(forms.ModelForm):
        class Meta:
            model = Feedback
    
    def my_view(request, category):
        form = MyForm(request.POST or None)
        if request.method == 'POST':
            if form.is_valid():
                feedback = form.save(commit=False)
                feedback.category = category
                feedback.save()
                return http.HttpResponse("Thanks for posting!")
        return render(request, "mytemplate.html", {'form': form})
    
    # urls.py
    (r'^(?P<category>\w+)/feedback/$', 'my_view')
    
    # user can visit dev/feedback or support/feedback and the feedback will be tagged appropriately
    

    Abstract base class

    Another solution is to build an abstract base class, then create subclasses for your distinct tables. That should solve the issue with your code getting out of sync.

    You’d have a single abstract model (which has no tables) from which your “real” models in your separate apps would be based on.

    Dynamically generated views

    If you must have separate models, you could potentially write a dynamically constructed view.

    def view_generator(model_class):
        class MyForm(forms.ModelForm):
             class Meta:
                  model = model_class
    
        def my_view(request):
            form = MyForm(request.POST or None)
            if request.method == 'POST':
                if form.is_valid():
                    form.save()
                    return http.HttpResponse("Thanks for posting!")
            return render(request, "mytemplate.html", {'form': form})
        return my_view
    
    
    # urls.py
    from foo import view_generator
    
    (r'^my_first_feedback_form', view_generator(Model1))
    (r'^my_second_feedback_form', view_generator(Model2l))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a simple WPF application in which I wanted to test the
I have written a simple application that displays a list of candidates for a
I have written a simple erlang app using gen_server. When starting it with application:start(myapp),
I have written a simple test application using asp.net mvc with C#. The application
I have written a simple facebook application using PHP SDK. Application works well but
I have written a simple contact manager application that uses a UITableView to display
I have written simple application with container-managed security. The problem is when I log
I have written a simple brainfuck interpreter in MATLAB script language. It is fed
I have written a simple Java dispatcher with a daemon thread to handle the
I have written a simple WCF service that accepts and stores messages. It works

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.