Skip to main content
Author:

Keryn Knight

Version:
0.1.1

fakeinline provides enough of the methods and attributes to trick the Django Admin into displaying it when mounted as part of an inlines declaration on a ModelAdmin. Where possible it does so without subclassing real Django classes, as should be the case with Duck Typing.

The 2 necessary subclasses are the FakeInline class itself, which must subclass InlineModelAdmin, and the model attribute, FakeModel which must subclass Model, but is unmanaged and abstract, so there is nothing touching the database.

Release

Status

master

travis_master

Why?!

The most interesting thing about the Django Admin is trying to bend it to my will. This is an example of my winning.

No really, why?

Because it’s actually nicer to be able to wedge additional things into the admin, without overriding the change_form.html template on a per-model, per-app basis.

Example usage

Here’s a simple way of putting the classic words Hello world onto a ModelAdmin:

class MyFormset(FakeFormset):
    # this probably works, but usually you'd point it at a template file.
    template = Template('{{inline_admin_formset.formset.get_data}}')

    def get_data(self, *a, **kw):
        return 'Hello world'

class MyInline(FakeInline):
    formset = MyFormSet

class MyAdmin(ModelAdmin):
    inlines = [MyInline]

Whilst a silly example, it demonstrates how one might encapsulate display data (charts, change history, etc) in a re-usable(ish) component for display on the change view.

Tests

There’s a couple in fakeinline.tests … just enough to verify it doesn’t raise an exception on GET or POST.

The license

It’s the FreeBSD. There’s should be a LICENSE file in the root of the repository, and in any archives.


Copyright (c) 2016, Keryn Knight All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Change history for fakeinline

0.1.1

  • Initial release

Metadata

Release files for django-fakeinline 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-fakeinline 0.1.1
File Size Uploaded
django-fakeinline-0.1.1.tar.gz 10.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-fakeinline 0.1.1
File Interpreter ABI Platform
django_fakeinline-0.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 23.9 kB

Release files / django-fakeinline-0.1.1.tar.gz

Download URL django-fakeinline-0.1.1.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
63a1a8d657640615f5ab8fd73aea4aa54f87eefe465dd30c04f6a5feeecd2676
BLAKE2b-256 checksum
How to use checksums
74694a77c5e67ace97d6fe6ad08912b2b3b2db92945a9a7a43d19aa04cf7a35f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_fakeinline-0.1.1-py2.py3-none-any.whl

Download URL django_fakeinline-0.1.1-py2.py3-none-any.whl
Size 13.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
b8e1de2ca0de45e34a95c145f9263f79abb6d7cba71f6df4d8167bb4aedf91b8
BLAKE2b-256 checksum
How to use checksums
9872e1c50438ec23e3b550f6737929cb4d30a6d80764b5d1456edc0079dc1ccd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page