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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:47:37+00:00 2026-06-12T18:47:37+00:00

Can anyone please tell what is the difference between Abstract class and Mixin in

  • 0

Can anyone please tell what is the difference between Abstract class and Mixin in Django.
I mean if we are to inherit some methods from base class why there is separate terminology like mixins if that is just a class.

What is diff between baseclass and mixins

  • 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-12T18:47:38+00:00Added an answer on June 12, 2026 at 6:47 pm

    In Python (and Django), mixin is a type of multiple inheritance. I tend to think of them
    as “specilist” classes that adds a particular functionality to the class that
    inheritates it (along with other classes). They aren’t really meant to stand on
    their own.

    Example with Django’s SingleObjectMixin,

    # views.py
    from django.http import HttpResponseForbidden, HttpResponseRedirect
    from django.core.urlresolvers import reverse
    from django.views.generic import View
    from django.views.generic.detail import SingleObjectMixin
    from books.models import Author
    
    class RecordInterest(View, SingleObjectMixin):
        """Records the current user's interest in an author."""
        model = Author
    
        def post(self, request, *args, **kwargs):
            if not request.user.is_authenticated():
                return HttpResponseForbidden()
    
            # Look up the author we're interested in.
            self.object = self.get_object()
            # Actually record interest somehow here!
    
            return HttpResponseRedirect(reverse('author-detail', kwargs={'pk': self.object.pk}))
    

    The added SingleObjectMixin will enable you to look up the author with just self.get_objects().


    An abstract class in Python looks like this:

    class Base(object):
        # This is an abstract class
    
        # This is the method child classes need to implement
        def implement_me(self):
            raise NotImplementedError("told you so!")
    

    In languages like Java, there is an Interface contract which is an
    interface. However, Python doesn’t have such and the closest thing you can
    get is an abstract class (you can also read on abc. This is mainly because Python utlizes duck typing which kind of removes the need for interfaces. Abstract class enables polymorphism just like interfaces do.

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

Sidebar

Related Questions

Hey, can anyone please tell me, what are difference between Dom parser and Xerces
Can anyone please tell me the difference between DictionaryBase and generic Dictionary<TKey, TValue> ,
Can anyone please tell me whats the exact difference between App id and api
Can anyone please tell me the difference between Hibernate's: createCriteria createQuery createSQLQuery Can anyone
Can any one please tell me the difference between target and currenttarget in flex?
Can anyone tell me what is the difference between base and recommended packages. If
Can any one please tell me what is the difference between Task and Process
Please can any one tell me whats the difference between declaring a variable inside
Can anyone please tell/suggest me how can i store and retrieve comments multiple/different values
Can anyone please tell me how to extract this kind of data : [{number:8457215152,type:Cell,state:LA,country:US,tz:CT,zip:70546,msa:0},{number:4363685555,type:Cell,state:LA,country:US,tz:CT,zip:70546,msa:0}]

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.