1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #20910 -- Replaced snippet directive with code-block.

This commit is contained in:
Curtis Maloney
2018-09-11 03:00:34 +10:00
committed by Tim Graham
parent f8ff529ee3
commit c49ea6f591
32 changed files with 234 additions and 375 deletions

View File

@@ -2929,8 +2929,8 @@ instantiate any other Python class) and register your models and
``ModelAdmin`` subclasses with it instead of with the default site. Finally,
update :file:`myproject/urls.py` to reference your :class:`AdminSite` subclass.
.. snippet::
:filename: myapp/admin.py
.. code-block:: python
:caption: myapp/admin.py
from django.contrib.admin import AdminSite
@@ -2943,8 +2943,8 @@ update :file:`myproject/urls.py` to reference your :class:`AdminSite` subclass.
admin_site.register(MyModel)
.. snippet::
:filename: myproject/urls.py
.. code-block:: python
:caption: myproject/urls.py
from django.urls import path
@@ -2972,24 +2972,24 @@ You can override the default ``django.contrib.admin.site`` by setting the
to the dotted import path of either a ``AdminSite`` subclass or a callable that
returns a site instance.
.. snippet::
:filename: myproject/admin.py
.. code-block:: python
:caption: myproject/admin.py
from django.contrib import admin
class MyAdminSite(admin.AdminSite):
...
.. snippet::
:filename: myproject/apps.py
.. code-block:: python
:caption: myproject/apps.py
from django.contrib.admin.apps import AdminConfig
class MyAdminConfig(AdminConfig):
default_site = 'myproject.admin.MyAdminSite'
.. snippet::
:filename: myproject/settings.py
.. code-block:: python
:caption: myproject/settings.py
INSTALLED_APPS = [
...

View File

@@ -31,8 +31,8 @@ In your custom ``change_form.html`` template, extend the
<script type="text/javascript" src="{% static 'app/formset_handlers.js' %}"></script>
{% endblock %}
.. snippet:: javascript
:filename: app/static/app/formset_handlers.js
.. code-block:: javascript
:caption: app/static/app/formset_handlers.js
(function($) {
$(document).on('formset:added', function(event, $row, formsetName) {
@@ -69,8 +69,8 @@ namespace, just listen to the event triggered from there. For example:
<script type="text/javascript" src="{% static 'app/unregistered_handlers.js' %}"></script>
{% endblock %}
.. snippet:: javascript
:filename: app/static/app/unregistered_handlers.js
.. code-block:: javascript
:caption: app/static/app/unregistered_handlers.js
django.jQuery(document).on('formset:added', function(event, $row, formsetName) {
// Row added