From 914bb62661f84b565f0c7e4bca2c936dfcc4dd81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Lazarevi=C4=87?= Date: Fri, 15 Nov 2024 14:38:33 +0700 Subject: [PATCH] Changed more imports from absolute to relative --- docs/ref/contrib/admin/actions.txt | 2 +- docs/ref/contrib/admin/admindocs.txt | 2 +- docs/ref/contrib/admin/index.txt | 18 ++++++++++-------- docs/topics/auth/customizing.txt | 2 +- docs/topics/auth/default.txt | 4 ++-- .../class-based-views/generic-editing.txt | 2 +- docs/topics/db/multi-db.txt | 2 +- docs/topics/forms/formsets.txt | 4 ++-- docs/topics/i18n/translation.txt | 2 +- docs/topics/pagination.txt | 4 ++-- docs/topics/signals.txt | 2 +- docs/topics/testing/overview.txt | 2 +- docs/topics/testing/tools.txt | 2 +- 13 files changed, 25 insertions(+), 23 deletions(-) diff --git a/docs/ref/contrib/admin/actions.txt b/docs/ref/contrib/admin/actions.txt index 735d6e5126..596d560b93 100644 --- a/docs/ref/contrib/admin/actions.txt +++ b/docs/ref/contrib/admin/actions.txt @@ -130,7 +130,7 @@ the action and its registration would look like:: from django.contrib import admin - from myapp.models import Article + from .models import Article @admin.action(description="Mark selected stories as published") diff --git a/docs/ref/contrib/admin/admindocs.txt b/docs/ref/contrib/admin/admindocs.txt index 5a605748ad..769cd50550 100644 --- a/docs/ref/contrib/admin/admindocs.txt +++ b/docs/ref/contrib/admin/admindocs.txt @@ -109,7 +109,7 @@ For example:: from django.shortcuts import render - from myapp.models import MyModel + from .models import MyModel def my_view(request, slug): diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index a73ce90ab4..6926b731e5 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -89,7 +89,7 @@ Other topics from django.contrib import admin - from myapp.models import Author + from .models import Author class AuthorAdmin(admin.ModelAdmin): @@ -510,7 +510,7 @@ subclass:: from django import forms from django.contrib import admin - from myapp.models import Person + from .models import Person class PersonForm(forms.ModelForm): @@ -543,8 +543,8 @@ subclass:: from django.db import models # Import our custom widget and our model from where they're defined - from myapp.models import MyModel - from myapp.widgets import RichTextEditorWidget + from .models import MyModel + from .widgets import RichTextEditorWidget class MyModelAdmin(admin.ModelAdmin): @@ -2254,7 +2254,8 @@ information. inlines to a model by specifying them in a ``ModelAdmin.inlines``:: from django.contrib import admin - from myapp.models import Author, Book + + from .models import Author, Book class BookInline(admin.TabularInline): @@ -2563,7 +2564,8 @@ If you want to display many-to-many relations using an inline, you can do so by defining an ``InlineModelAdmin`` object for the relationship:: from django.contrib import admin - from myapp.models import Group + + from .models import Group class MembershipInline(admin.TabularInline): @@ -2696,7 +2698,7 @@ any other inline. In your ``admin.py`` for this example app:: from django.contrib import admin from django.contrib.contenttypes.admin import GenericTabularInline - from myapp.models import Image, Product + from .models import Image, Product class ImageInline(GenericTabularInline): @@ -3169,7 +3171,7 @@ to reference your :class:`AdminSite` subclass. from django.urls import path - from myapp.admin import admin_site + from .admin import admin_site urlpatterns = [ path("myadmin/", admin_site.urls), diff --git a/docs/topics/auth/customizing.txt b/docs/topics/auth/customizing.txt index 947cb068e1..3f25d016e6 100644 --- a/docs/topics/auth/customizing.txt +++ b/docs/topics/auth/customizing.txt @@ -855,7 +855,7 @@ extend these forms in this manner:: from django.contrib.auth.forms import UserCreationForm - from myapp.models import CustomUser + from .models import CustomUser class CustomUserCreationForm(UserCreationForm): diff --git a/docs/topics/auth/default.txt b/docs/topics/auth/default.txt index 706a173921..76746a0f32 100644 --- a/docs/topics/auth/default.txt +++ b/docs/topics/auth/default.txt @@ -259,7 +259,7 @@ in ``myapp``:: from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType - from myapp.models import BlogPost + from .models import BlogPost content_type = ContentType.objects.get_for_model(BlogPost) permission = Permission.objects.create( @@ -299,7 +299,7 @@ the user from the database. For example:: from django.contrib.contenttypes.models import ContentType from django.shortcuts import get_object_or_404 - from myapp.models import BlogPost + from .models import BlogPost def user_gains_perms(request, user_id): diff --git a/docs/topics/class-based-views/generic-editing.txt b/docs/topics/class-based-views/generic-editing.txt index 0bcf5aea12..f1e0d26d0b 100644 --- a/docs/topics/class-based-views/generic-editing.txt +++ b/docs/topics/class-based-views/generic-editing.txt @@ -245,7 +245,7 @@ works with an API-based workflow as well as 'normal' form POSTs:: from django.http import JsonResponse from django.views.generic.edit import CreateView - from myapp.models import Author + from .models import Author class JsonableResponseMixin: diff --git a/docs/topics/db/multi-db.txt b/docs/topics/db/multi-db.txt index 11be913f4c..da72c5b133 100644 --- a/docs/topics/db/multi-db.txt +++ b/docs/topics/db/multi-db.txt @@ -683,7 +683,7 @@ Once you've written your model admin definitions, they can be registered with any ``Admin`` instance:: from django.contrib import admin - from myapp.models import Author, Book, Publisher + from .models import Author, Book, Publisher # Import our custom ModelAdmin and TabularInline from where they're defined. from myproject.admin import MultiDBModelAdmin, MultiDBTabularInline diff --git a/docs/topics/forms/formsets.txt b/docs/topics/forms/formsets.txt index 8c607a9c84..6403791a49 100644 --- a/docs/topics/forms/formsets.txt +++ b/docs/topics/forms/formsets.txt @@ -965,7 +965,7 @@ use the management form inside the template. Let's look at a sample view:: from django.forms import formset_factory from django.shortcuts import render - from myapp.forms import ArticleForm + from .forms import ArticleForm def manage_articles(request): @@ -1052,7 +1052,7 @@ a look at how this might be accomplished:: from django.forms import formset_factory from django.shortcuts import render - from myapp.forms import ArticleForm, BookForm + from .forms import ArticleForm, BookForm def manage_articles(request): diff --git a/docs/topics/i18n/translation.txt b/docs/topics/i18n/translation.txt index abe0b05260..85479e2c13 100644 --- a/docs/topics/i18n/translation.txt +++ b/docs/topics/i18n/translation.txt @@ -216,7 +216,7 @@ sophisticated, but will produce incorrect results for some languages:: from django.utils.translation import ngettext - from myapp.models import Report + from .models import Report count = Report.objects.count() if count == 1: diff --git a/docs/topics/pagination.txt b/docs/topics/pagination.txt index 50f57151a6..a95a1ca0c7 100644 --- a/docs/topics/pagination.txt +++ b/docs/topics/pagination.txt @@ -92,7 +92,7 @@ your view class, for example:: from django.views.generic import ListView - from myapp.models import Contact + from .models import Contact class ContactListView(ListView): @@ -140,7 +140,7 @@ function to paginate a queryset:: from django.core.paginator import Paginator from django.shortcuts import render - from myapp.models import Contact + from .models import Contact def listing(request): diff --git a/docs/topics/signals.txt b/docs/topics/signals.txt index d29e2b082d..7d5bd97307 100644 --- a/docs/topics/signals.txt +++ b/docs/topics/signals.txt @@ -193,7 +193,7 @@ signals sent by some model:: from django.db.models.signals import pre_save from django.dispatch import receiver - from myapp.models import MyModel + from .models import MyModel @receiver(pre_save, sender=MyModel) diff --git a/docs/topics/testing/overview.txt b/docs/topics/testing/overview.txt index a5b458c32a..217811ce5d 100644 --- a/docs/topics/testing/overview.txt +++ b/docs/topics/testing/overview.txt @@ -26,7 +26,7 @@ transaction to provide isolation:: from django.test import TestCase - from myapp.models import Animal + from .models import Animal class AnimalTestCase(TestCase): diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt index ec6ec4f274..6786c22a17 100644 --- a/docs/topics/testing/tools.txt +++ b/docs/topics/testing/tools.txt @@ -1247,7 +1247,7 @@ subclass:: from django.test import TestCase - from myapp.models import Animal + from .models import Animal class AnimalTestCase(TestCase):