Code Monkey home page Code Monkey logo

django-sites-ext's Introduction

Django Sites Ext

ChangeSiteMixin is a helper mixin aimed to make editing of objects in multi site environment easier.

Current functionality in ChangeSiteAdmin works like this:

  1. When creating new object, administrator is offered to choose site to which object will be associated
  2. In change_form view, site is restricted to selected site and cannot be changed. Also, choices for fields specified in filter_by_site_fields are limited only to selected site.
  3. When editing existing object, "Change site" button allows to change site this object belongs to. If model has changesite method, it would be called to allow further work to be performed when site is changing.

Requirements

  • Django 1.3 or later

Configuration

  1. Put sites_ext into your INSTALLED_APPS at settings module:

    INSTALLED_APPS = (
       ...
       'sites_ext',
    )

Usage

Replace admin.ModelAdmin with ChangeSiteAdmin` for those models which should have support for changing language:

from django.contrib import admin
from sites_ext.admin import ChangeSiteAdmin

from models import Product

class ProductAdmin(ChangeSiteAdmin):
    filter_by_site_fields = ('categories', )

admin.site.register(Product, ProductAdmin)

Example application

Example app is bundled, username and password for admin are: admin:password.

django-sites-ext's People

Contributors

bmihelac avatar

Stargazers

saidimu apale avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.