GITENV file updated 10

parent 5f8e6e29

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

from django.contrib.admin.decorators import action, display, register
from django.contrib.admin.filters import (
AllValuesFieldListFilter, BooleanFieldListFilter, ChoicesFieldListFilter,
DateFieldListFilter, EmptyFieldListFilter, FieldListFilter, ListFilter,
RelatedFieldListFilter, RelatedOnlyFieldListFilter, SimpleListFilter,
)
from django.contrib.admin.options import (
HORIZONTAL, VERTICAL, ModelAdmin, StackedInline, TabularInline,
)
from django.contrib.admin.sites import AdminSite, site
from django.utils.module_loading import autodiscover_modules
__all__ = [
"action", "display", "register", "ModelAdmin", "HORIZONTAL", "VERTICAL",
"StackedInline", "TabularInline", "AdminSite", "site", "ListFilter",
"SimpleListFilter", "FieldListFilter", "BooleanFieldListFilter",
"RelatedFieldListFilter", "ChoicesFieldListFilter", "DateFieldListFilter",
"AllValuesFieldListFilter", "EmptyFieldListFilter",
"RelatedOnlyFieldListFilter", "autodiscover",
]
def autodiscover():
autodiscover_modules('admin', register_to=site)
"""
Built-in, globally-available admin actions.
"""
from django.contrib import messages
from django.contrib.admin import helpers
from django.contrib.admin.decorators import action
from django.contrib.admin.utils import model_ngettext
from django.core.exceptions import PermissionDenied
from django.template.response import TemplateResponse
from django.utils.translation import gettext as _, gettext_lazy
@action(
permissions=['delete'],
description=gettext_lazy('Delete selected %(verbose_name_plural)s'),
)
def delete_selected(modeladmin, request, queryset):
"""
Default action which deletes the selected objects.
This action first displays a confirmation page which shows all the
deletable objects, or, if the user has no permission one of the related
childs (foreignkeys), a "permission denied" message.
Next, it deletes all selected objects and redirects back to the change list.
"""
opts = modeladmin.model._meta
app_label = opts.app_label
# Populate deletable_objects, a data structure of all related objects that
# will also be deleted.
deletable_objects, model_count, perms_needed, protected = modeladmin.get_deleted_objects(queryset, request)
# The user has already confirmed the deletion.
# Do the deletion and return None to display the change list view again.
if request.POST.get('post') and not protected:
if perms_needed:
raise PermissionDenied
n = queryset.count()
if n:
for obj in queryset:
obj_display = str(obj)
modeladmin.log_deletion(request, obj, obj_display)
modeladmin.delete_queryset(request, queryset)
modeladmin.message_user(request, _("Successfully deleted %(count)d %(items)s.") % {
"count": n, "items": model_ngettext(modeladmin.opts, n)
}, messages.SUCCESS)
# Return None to display the change list page again.
return None
objects_name = model_ngettext(queryset)
if perms_needed or protected:
title = _("Cannot delete %(name)s") % {"name": objects_name}
else:
title = _("Are you sure?")
context = {
**modeladmin.admin_site.each_context(request),
'title': title,
'objects_name': str(objects_name),
'deletable_objects': [deletable_objects],
'model_count': dict(model_count).items(),
'queryset': queryset,
'perms_lacking': perms_needed,
'protected': protected,
'opts': opts,
'action_checkbox_name': helpers.ACTION_CHECKBOX_NAME,
'media': modeladmin.media,
}
request.current_app = modeladmin.admin_site.name
# Display the confirmation page
return TemplateResponse(request, modeladmin.delete_selected_confirmation_template or [
"admin/%s/%s/delete_selected_confirmation.html" % (app_label, opts.model_name),
"admin/%s/delete_selected_confirmation.html" % app_label,
"admin/delete_selected_confirmation.html"
], context)
from django.apps import AppConfig
from django.contrib.admin.checks import check_admin_app, check_dependencies
from django.core import checks
from django.utils.translation import gettext_lazy as _
class SimpleAdminConfig(AppConfig):
"""Simple AppConfig which does not do automatic discovery."""
default_auto_field = 'django.db.models.AutoField'
default_site = 'django.contrib.admin.sites.AdminSite'
name = 'django.contrib.admin'
verbose_name = _("Administration")
def ready(self):
checks.register(check_dependencies, checks.Tags.admin)
checks.register(check_admin_app, checks.Tags.admin)
class AdminConfig(SimpleAdminConfig):
"""The default AppConfig for admin which does autodiscovery."""
default = True
def ready(self):
super().ready()
self.module.autodiscover()
This diff is collapsed.
def action(function=None, *, permissions=None, description=None):
"""
Conveniently add attributes to an action function::
@admin.action(
permissions=['publish'],
description='Mark selected stories as published',
)
def make_published(self, request, queryset):
queryset.update(status='p')
This is equivalent to setting some attributes (with the original, longer
names) on the function directly::
def make_published(self, request, queryset):
queryset.update(status='p')
make_published.allowed_permissions = ['publish']
make_published.short_description = 'Mark selected stories as published'
"""
def decorator(func):
if permissions is not None:
func.allowed_permissions = permissions
if description is not None:
func.short_description = description
return func
if function is None:
return decorator
else:
return decorator(function)
def display(function=None, *, boolean=None, ordering=None, description=None, empty_value=None):
"""
Conveniently add attributes to a display function::
@admin.display(
boolean=True,
ordering='-publish_date',
description='Is Published?',
)
def is_published(self, obj):
return obj.publish_date is not None
This is equivalent to setting some attributes (with the original, longer
names) on the function directly::
def is_published(self, obj):
return obj.publish_date is not None
is_published.boolean = True
is_published.admin_order_field = '-publish_date'
is_published.short_description = 'Is Published?'
"""
def decorator(func):
if boolean is not None and empty_value is not None:
raise ValueError(
'The boolean and empty_value arguments to the @display '
'decorator are mutually exclusive.'
)
if boolean is not None:
func.boolean = boolean
if ordering is not None:
func.admin_order_field = ordering
if description is not None:
func.short_description = description
if empty_value is not None:
func.empty_value_display = empty_value
return func
if function is None:
return decorator
else:
return decorator(function)
def register(*models, site=None):
"""
Register the given model(s) classes and wrapped ModelAdmin class with
admin site:
@register(Author)
class AuthorAdmin(admin.ModelAdmin):
pass
The `site` kwarg is an admin site to use instead of the default admin site.
"""
from django.contrib.admin import ModelAdmin
from django.contrib.admin.sites import AdminSite, site as default_site
def _model_admin_wrapper(admin_class):
if not models:
raise ValueError('At least one model must be passed to register.')
admin_site = site or default_site
if not isinstance(admin_site, AdminSite):
raise ValueError('site must subclass AdminSite')
if not issubclass(admin_class, ModelAdmin):
raise ValueError('Wrapped class must subclass ModelAdmin.')
admin_site.register(models, admin_class=admin_class)
return admin_class
return _model_admin_wrapper
from django.core.exceptions import SuspiciousOperation
class DisallowedModelAdminLookup(SuspiciousOperation):
"""Invalid filter was passed to admin view via URL querystring"""
pass
class DisallowedModelAdminToField(SuspiciousOperation):
"""Invalid to_field was passed to admin view via URL query string"""
pass
This diff is collapsed.
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
class AdminAuthenticationForm(AuthenticationForm):
"""
A custom authentication form used in the admin app.
"""
error_messages = {
**AuthenticationForm.error_messages,
'invalid_login': _(
"Please enter the correct %(username)s and password for a staff "
"account. Note that both fields may be case-sensitive."
),
}
required_css_class = 'required'
def confirm_login_allowed(self, user):
super().confirm_login_allowed(user)
if not user.is_staff:
raise ValidationError(
self.error_messages['invalid_login'],
code='invalid_login',
params={'username': self.username_field.verbose_name}
)
class AdminPasswordChangeForm(PasswordChangeForm):
required_css_class = 'required'
This diff is collapsed.
# This file is distributed under the same license as the Django package.
#
# Translators:
# F Wolff <friedel@translate.org.za>, 2019
# Pi Delport <pjdelport@gmail.com>, 2013
# Pi Delport <pjdelport@gmail.com>, 2013
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-05-17 11:50+0200\n"
"PO-Revision-Date: 2019-01-04 18:43+0000\n"
"Last-Translator: F Wolff <friedel@translate.org.za>\n"
"Language-Team: Afrikaans (http://www.transifex.com/django/django/language/"
"af/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: af\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#, javascript-format
msgid "Available %s"
msgstr "Beskikbare %s"
#, javascript-format
msgid ""
"This is the list of available %s. You may choose some by selecting them in "
"the box below and then clicking the \"Choose\" arrow between the two boxes."
msgstr ""
"Hierdie is die lys beskikbare %s. Kies gerus deur hulle in die boksie "
"hieronder te merk en dan die “Kies”-knoppie tussen die boksies te klik."
#, javascript-format
msgid "Type into this box to filter down the list of available %s."
msgstr "Tik in hierdie blokkie om die lys beskikbare %s te filtreer."
msgid "Filter"
msgstr "Filteer"
msgid "Choose all"
msgstr "Kies almal"
#, javascript-format
msgid "Click to choose all %s at once."
msgstr "Klik om al die %s gelyktydig te kies."
msgid "Choose"
msgstr "Kies"
msgid "Remove"
msgstr "Verwyder"
#, javascript-format
msgid "Chosen %s"
msgstr "Gekose %s"
#, javascript-format
msgid ""
"This is the list of chosen %s. You may remove some by selecting them in the "
"box below and then clicking the \"Remove\" arrow between the two boxes."
msgstr ""
"Hierdie is die lys gekose %s. Verwyder gerus deur hulle in die boksie "
"hieronder te merk en dan die “Verwyder”-knoppie tussen die boksies te klik."
msgid "Remove all"
msgstr "Verwyder almal"
#, javascript-format
msgid "Click to remove all chosen %s at once."
msgstr "Klik om al die %s gelyktydig te verwyder."
msgid "%(sel)s of %(cnt)s selected"
msgid_plural "%(sel)s of %(cnt)s selected"
msgstr[0] "%(sel)s van %(cnt)s gekies"
msgstr[1] "%(sel)s van %(cnt)s gekies"
msgid ""
"You have unsaved changes on individual editable fields. If you run an "
"action, your unsaved changes will be lost."
msgstr ""
"Daar is ongestoorde veranderinge op individuele redigeerbare velde. Deur nou "
"’n aksie uit te voer, sal ongestoorde veranderinge verlore gaan."
msgid ""
"You have selected an action, but you haven't saved your changes to "
"individual fields yet. Please click OK to save. You'll need to re-run the "
"action."
msgstr ""
"U het ’n aksie gekies, maar nog nie die veranderinge aan individuele velde "
"gestoor nie. Klik asb. OK om te stoor. Dit sal nodig wees om weer die aksie "
"uit te voer."
msgid ""
"You have selected an action, and you haven't made any changes on individual "
"fields. You're probably looking for the Go button rather than the Save "
"button."
msgstr ""
"U het ’n aksie gekies en het nie enige veranderinge aan individuele velde "
"aangebring nie. U soek waarskynlik na die Gaan-knoppie eerder as die Stoor-"
"knoppie."
msgid "Now"
msgstr "Nou"
msgid "Midnight"
msgstr "Middernag"
msgid "6 a.m."
msgstr "06:00"
msgid "Noon"
msgstr "Middag"
msgid "6 p.m."
msgstr "18:00"
#, javascript-format
msgid "Note: You are %s hour ahead of server time."
msgid_plural "Note: You are %s hours ahead of server time."
msgstr[0] "Let wel: U is %s uur voor die bedienertyd."
msgstr[1] "Let wel: U is %s ure voor die bedienertyd."
#, javascript-format
msgid "Note: You are %s hour behind server time."
msgid_plural "Note: You are %s hours behind server time."
msgstr[0] "Let wel: U is %s uur agter die bedienertyd."
msgstr[1] "Let wel: U is %s ure agter die bedienertyd."
msgid "Choose a Time"
msgstr "Kies ’n tyd"
msgid "Choose a time"
msgstr "Kies ‘n tyd"
msgid "Cancel"
msgstr "Kanselleer"
msgid "Today"
msgstr "Vandag"
msgid "Choose a Date"
msgstr "Kies ’n datum"
msgid "Yesterday"
msgstr "Gister"
msgid "Tomorrow"
msgstr "Môre"
msgid "January"
msgstr "Januarie"
msgid "February"
msgstr "Februarie"
msgid "March"
msgstr "Maart"
msgid "April"
msgstr "April"
msgid "May"
msgstr "Mei"
msgid "June"
msgstr "Junie"
msgid "July"
msgstr "Julie"
msgid "August"
msgstr "Augustus"
msgid "September"
msgstr "September"
msgid "October"
msgstr "Oktober"
msgid "November"
msgstr "November"
msgid "December"
msgstr "Desember"
msgctxt "one letter Sunday"
msgid "S"
msgstr "S"
msgctxt "one letter Monday"
msgid "M"
msgstr "M"
msgctxt "one letter Tuesday"
msgid "T"
msgstr "D"
msgctxt "one letter Wednesday"
msgid "W"
msgstr "W"
msgctxt "one letter Thursday"
msgid "T"
msgstr "D"
msgctxt "one letter Friday"
msgid "F"
msgstr "V"
msgctxt "one letter Saturday"
msgid "S"
msgstr "S"
msgid "Show"
msgstr "Wys"
msgid "Hide"
msgstr "Versteek"
# This file is distributed under the same license as the Django package.
#
# Translators:
# Bashar Al-Abdulhadi, 2015,2020
# Bashar Al-Abdulhadi, 2014
# Jannis Leidel <jannis@leidel.info>, 2011
# Omar Lajam, 2020
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-11 20:56+0200\n"
"PO-Revision-Date: 2020-07-06 09:56+0000\n"
"Last-Translator: Bashar Al-Abdulhadi\n"
"Language-Team: Arabic (http://www.transifex.com/django/django/language/ar/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ar\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
#, javascript-format
msgid "Available %s"
msgstr "%s المتوفرة"
#, javascript-format
msgid ""
"This is the list of available %s. You may choose some by selecting them in "
"the box below and then clicking the \"Choose\" arrow between the two boxes."
msgstr ""
"هذه قائمة %s المتوفرة. يمكنك اختيار بعضها بانتقائها في الصندوق أدناه ثم "
"الضغط على سهم الـ\"اختيار\" بين الصندوقين."
#, javascript-format
msgid "Type into this box to filter down the list of available %s."
msgstr "اكتب في هذا الصندوق لتصفية قائمة %s المتوفرة."
msgid "Filter"
msgstr "انتقاء"
msgid "Choose all"
msgstr "اختر الكل"
#, javascript-format
msgid "Click to choose all %s at once."
msgstr "اضغط لاختيار جميع %s جملة واحدة."
msgid "Choose"
msgstr "اختيار"
msgid "Remove"
msgstr "احذف"
#, javascript-format
msgid "Chosen %s"
msgstr "%s المُختارة"
#, javascript-format
msgid ""
"This is the list of chosen %s. You may remove some by selecting them in the "
"box below and then clicking the \"Remove\" arrow between the two boxes."
msgstr ""
"هذه قائمة %s المحددة. يمكنك إزالة بعضها باختيارها في الصندوق أدناه ثم اضغط "
"على سهم الـ\"إزالة\" بين الصندوقين."
msgid "Remove all"
msgstr "إزالة الكل"
#, javascript-format
msgid "Click to remove all chosen %s at once."
msgstr "اضغط لإزالة جميع %s المحددة جملة واحدة."
msgid "%(sel)s of %(cnt)s selected"
msgid_plural "%(sel)s of %(cnt)s selected"
msgstr[0] "لا شي محدد"
msgstr[1] "%(sel)s من %(cnt)s محدد"
msgstr[2] "%(sel)s من %(cnt)s محدد"
msgstr[3] "%(sel)s من %(cnt)s محددة"
msgstr[4] "%(sel)s من %(cnt)s محدد"
msgstr[5] "%(sel)s من %(cnt)s محدد"
msgid ""
"You have unsaved changes on individual editable fields. If you run an "
"action, your unsaved changes will be lost."
msgstr ""
"لديك تعديلات غير محفوظة على بعض الحقول القابلة للتعديل. إن نفذت أي إجراء "
"فسوف تخسر تعديلاتك."
msgid ""
"You have selected an action, but you haven’t saved your changes to "
"individual fields yet. Please click OK to save. You’ll need to re-run the "
"action."
msgstr ""
"لقد حددت إجراءً ، لكنك لم تحفظ تغييراتك في الحقول الفردية حتى الآن. يرجى "
"النقر فوق موافق للحفظ. ستحتاج إلى إعادة تشغيل الإجراء."
msgid ""
"You have selected an action, and you haven’t made any changes on individual "
"fields. You’re probably looking for the Go button rather than the Save "
"button."
msgstr ""
"لقد حددت إجراء ، ولم تقم بإجراء أي تغييرات على الحقول الفردية. من المحتمل "
"أنك تبحث عن الزر أذهب بدلاً من الزر حفظ."
msgid "Now"
msgstr "الآن"
msgid "Midnight"
msgstr "منتصف الليل"
msgid "6 a.m."
msgstr "6 ص."
msgid "Noon"
msgstr "الظهر"
msgid "6 p.m."
msgstr "6 مساءً"
#, javascript-format
msgid "Note: You are %s hour ahead of server time."
msgid_plural "Note: You are %s hours ahead of server time."
msgstr[0] "ملاحظة: أنت متقدم بـ %s ساعة من وقت الخادم."
msgstr[1] "ملاحظة: أنت متقدم بـ %s ساعة من وقت الخادم."
msgstr[2] "ملاحظة: أنت متقدم بـ %s ساعة من وقت الخادم."
msgstr[3] "ملاحظة: أنت متقدم بـ %s ساعة من وقت الخادم."
msgstr[4] "ملاحظة: أنت متقدم بـ %s ساعة من وقت الخادم."
msgstr[5] "ملاحظة: أنت متقدم بـ %s ساعة من وقت الخادم."
#, javascript-format
msgid "Note: You are %s hour behind server time."
msgid_plural "Note: You are %s hours behind server time."
msgstr[0] "ملاحظة: أنت متأخر بـ %s ساعة من وقت الخادم."
msgstr[1] "ملاحظة: أنت متأخر بـ %s ساعة من وقت الخادم."
msgstr[2] "ملاحظة: أنت متأخر بـ %s ساعة من وقت الخادم."
msgstr[3] "ملاحظة: أنت متأخر بـ %s ساعة من وقت الخادم."
msgstr[4] "ملاحظة: أنت متأخر بـ %s ساعة من وقت الخادم."
msgstr[5] "ملاحظة: أنت متأخر بـ %s ساعة من وقت الخادم."
msgid "Choose a Time"
msgstr "إختر وقت"
msgid "Choose a time"
msgstr "اختر وقتاً"
msgid "Cancel"
msgstr "ألغ"
msgid "Today"
msgstr "اليوم"
msgid "Choose a Date"
msgstr "إختر تاريخ "
msgid "Yesterday"
msgstr "أمس"
msgid "Tomorrow"
msgstr "غداً"
msgid "January"
msgstr "يناير"
msgid "February"
msgstr "فبراير"
msgid "March"
msgstr "مارس"
msgid "April"
msgstr "أبريل"
msgid "May"
msgstr "مايو"
msgid "June"
msgstr "يونيو"
msgid "July"
msgstr "يوليو"
msgid "August"
msgstr "أغسطس"
msgid "September"
msgstr "سبتمبر"
msgid "October"
msgstr "أكتوبر"
msgid "November"
msgstr "نوفمبر"
msgid "December"
msgstr "ديسمبر"
msgctxt "one letter Sunday"
msgid "S"
msgstr "أحد"
msgctxt "one letter Monday"
msgid "M"
msgstr "إثنين"
msgctxt "one letter Tuesday"
msgid "T"
msgstr "ثلاثاء"
msgctxt "one letter Wednesday"
msgid "W"
msgstr "أربعاء"
msgctxt "one letter Thursday"
msgid "T"
msgstr "خميس"
msgctxt "one letter Friday"
msgid "F"
msgstr "جمعة"
msgctxt "one letter Saturday"
msgid "S"
msgstr "سبت"
msgid "Show"
msgstr "أظهر"
msgid "Hide"
msgstr "اخف"
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment