Skip to content

Instantly share code, notes, and snippets.

View adigunsherif's full-sized avatar

Sherif Adigun adigunsherif

View GitHub Profile
@squio
squio / submit_line.html.md
Last active April 7, 2022 14:11
Override Django Admin submit_line.html

Enhancing https://stackoverflow.com/posts/65938495/

It is also possible to override/extend the innermost {% block submit-row %} like so:

{% extends 'admin/submit_line.html' %}
{% load i18n admin_urls %}

{% block submit-row %}
 {% if extra_button_allowed %}
@ostcar
ostcar / gist:eb78515a41ab41d1755b
Last active October 28, 2023 10:34
Adds a _id suffix to PrimaryKeyRelatedField
class IdManyRelatedField(ManyRelatedField):
field_name_suffix = '_ids'
def bind(self, field_name, parent):
self.source = field_name[:-len(self.field_name_suffix)]
super().bind(field_name, parent)
class IdPrimaryKeyRelatedField(PrimaryKeyRelatedField):
"""