Saravanan666/pypi-org huggingface dataset:
Package: django-ingredient-field
Quick startAdd “dj_ingredient_field” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'dj_ingredient_field',
]To use lazy loaded widgets include this module in your urlpatterns:urlpatterns = [
    path('cooking/', include('dj_ingredient_field.urls')),
    ...
]That’s it!UsageSimply add the fields you need to your model:from dj_ingredient_field import IngredientField, MeasurementUnitField

class MyModel(models.Model):
   ingredient = IngredientField()
   unit = MeasurementUnitField()The fields map to Ingredient and MeasurementUnit classes:from dj_ingredient_field import IngredientName, Ingredient, MeasurementUnit, INGREDIENT_UNITS

model.ingredient = Ingredient(IngredientName.I_ARUGULA)
model.unit = MeasurementUnit(**INGREDIENT_UNITS["Killogram"])All the available ingredients can be found in theIngredientNameenumIngredients and units can be customized, see ‘Settings’Documentationhttps://django-ingredient-field.readthedocs.io/en/latest
Package: django_ini_settings
# django-ini-settingsThis library aims to be a non-intrusive configurable way of moving some localsettings out of the django settings.py and into a deployable .ini file## Quick-startInstall this librarypip install django_ini_settingsAdd the hook into your settings.py, if you want to use the default configmapping the following would do:from django_ini_settings.load import load_iniload_ini(ini_file="/etc/application/application.ini",settings_module=sys.modules[__name__])This implies that your ini file is located in /etc/application/application.iniFor example this ini might look like:[database]user = postgrespassword = secret[security]secret_key = !sfgr42325asdasd$34324debug = falseTo insert custom configs you can either use the default format of the type as the groupand the config name as the option. e.g.[string]custom_url = /custom/url[bool]feature_on = false[int]max_num_files = 120This would be transformed to the following in your settings.pyCUSTOM_URL = "/custom/url"FEATURE_ON = FalseMAX_NUM_FILES = 120You can also provide your own mapping, including wildcards. e.g. add thefollowing in your settingsfrom django_ini_settings.load import load_inifrom django_ini_settings.settings_types import (DictItemSetting, StringSetting,BoolSetting, IntSetting)from django_ini_settings.statics import ANY, NAME_TO_UPPERCONFIG_FILE_MAPPING = {("database", "user"): DictItemSetting(("DATABASES", "default", "USER")),("database", "password"): DictItemSetting(("DATABASES", "default", "PASSWORD")),("database", "engine"): DictItemSetting(("DATABASES", "default", "ENGINE")),("database", "name"): DictItemSetting(("DATABASES", "default", "NAME")),("database", "host"): DictItemSetting(("DATABASES", "default", "HOST")),("database", "port"): DictItemSetting(("DATABASES", "default", "PORT")),("security", "secret_key"): StringSetting("SECRET_KEY"),("security", "debug"): BoolSetting("DEBUG"),("urls", "media_url"): StringSetting("MEDIA_URL"),("urls", "static_url"): StringSetting("STATIC_URL"),("application", "max_file_size"): IntSetting("MAX_FILE_SIZE"),("application", ANY): StringSetting(NAME_TO_UPPER),}load_ini(ini_file="/etc/application/application.ini",settings_module=sys.modules[__name__],config_mapping=CONFIG_FILE_MAPPING)## Environment VariablesInstead of doing:load_ini(ini_file="/etc/application/application.ini",settings_module=sys.modules[__name__])You can also set an environment variable "DJANGO_CONFIG_FILE" containing the location ofthe INI file. e.g.DJANGO_CONFIG_FILE=/etc/application/application.iniThen change the line to:load_ini(settings_module=sys.modules[__name__])## TestsTo run the tests, first make sure you have nose. If not then:pip install noseIf you have nose installed then from the same directory as this README:nosetests
Package: django-init-admin-command
django_init_adminDjango admin command to create an admin/admin superuser if no user existsThe main purpose is to init an admin user for the applications you deliver. Your end-user will be able to login with admin (pwd: admin) and manage his users.usageInstall the command in your python environment:pipinstalldjango_init_admin_commandInclude this command in you project settings.py file:INSTALLED_APPS=[# ...'init_admin_command',# ...Create the admin user in a deploy / install script:pythonmanage.pyinitadmin
Package: django-initialcon
django-initialcon is a small django application for generating small colourful
icons for users profile pictures. Project is hosted on Githubhttps://github.com/bettsmatt/django-initialconQuick startInstall using PIP:pip install django-initialconAdd ‘initialcon’ to INSTALLED_APPS:INSTALLED_APPS = {
    ...
    'initialcon',
}Include the initialcon URLconf in __init__.py:url(r'^initialcon/', include('initialcon')),Add font config to your settings.py:INITIALCON_FONTS = {
    'default': <pathtofont>),
    'alt': <pathtofont>)
}Run the development server and test everything works by accessinghttp://127.0.0.1:8000/initialcon/test%20nameConfigurationAlong with the fonts used the default size, maximum size and colors can be set by adding the following to your settings.py.:INITIALCON_SIZE = 100
INITIALCON_SIZE_MAX = 200)
INITIALCON_COLORS = [
    (153,180,51), (0,163,0), (30,113,69), (255,0,151), (45,137,239),
    (159,0,167), (0,171,169), (185,29,71),(227,162,26), (255,196,13),
    (126,56,120), (96,60,186), (43,87,151), (218,83,44), (238,17,17)
]
INITIALCON_FONTS = {
    'default': <pathtofont>),
    'alt': <pathtofont>)
}Example URLsBasic:localhost:8000/initialcon/test%20nameCustom size:localhost:8000/initialcon/test%20name?size=200Custom font:localhost:8000/initialcon/test%20name?font=altCustom size and font:localhost:8000/initialcon/test%20name?size=200&font=altExample codeTemplate:<img src="{{img.getImage}}" />Code:class MyModel(model.Models):

    image = ...
    name = ...

    def getImage(self):
        if self.image:
            ...
        else:
             return reverse('initialcon:generate', args=[self.name])
Package: django-initial-field
Sometimes it is needed to pass some default values to the objects created by ModelForm. This simple mixin enables that by creating HiddenInput fields and passing initial parameters to the created ModelDocumentationThe full documentation is athttps://django-initial-field.readthedocs.io.QuickstartInstall Django initial form field:pip install django-initial-fieldUse InitialFieldMixin in yourModelFormand setinitial_fieldparameter:classMyForm(InitialFieldsMixin,forms.ModelForm):initial_fields=('my_field')Then set initial value in your FormView:classMyView(FormView):defget_initial(self):return{'my_field':"some value"}Running TestsDoes the code actually work?source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ toxCreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageHistory0.1.0 (2017-08-11)First release on PyPI.
Package: django-initials-avatar
django-initials-avatarSummaryA ridiculously simple avatar generator with initials from names.Original Repositoryeddiejibson/avatarsDjango Packagespackages/django-initials-avatarInstallingFirst add the application to your Python path. The easiest way is to use pip:pipinstalldjango-initials-avatarCheck theRelease Historytab on the PyPI package page for
pre-release versions. These can be downloaded by specifying the version.You can also install by downloading the source and running:pythonsetup.pyinstallConfiguringMake sure you have add the django_initials_avatar application to your INSTALLED_APPS list:INSTALLED_APPS=(...'django_initials_avatar',)Then ensure that your project URL conf is updated.fromdjango.urlsimportpath,includeurlpatterns=[...path("initials-avatar/",include('django_initials_avatar.urls'))]Default Background ColorsINITIALS_AVATAR_BG_COLORS=["#E284B3","#FFED8B","#681313","#F3C1C6","#735372","#009975","#FFBD39","#B1E8ED","#52437B","#F76262","#216583","#293462","#DD9D52","#936B93","#6DD38D","#888888","#6F8190","#BCA0F0","#AAF4DD","#96C2ED","#3593CE","#5EE2CD","#96366E","#E38080"]Default Text ColorINITIALS_AVATAR_TEXT_COLOR='#fff'Default Text LengthINITIALS_AVATAR_TEXT_LENGTH=2Default Avatar WidthINITIALS_AVATAR_WIDTH=500Default Avatar HeightINITIALS_AVATAR_HEIGHT=500Default Avatar Font SizeINITIALS_AVATAR_FONT_SIZE=250Avatar Rounded By DefaultINITIALS_AVATAR_ROUNDED=FalseAvatar Capitalize by DefaultINITIALS_AVATAR_CAPITALIZE=FalseAvatar Lowercase by DefaultINITIALS_AVATAR_LOWERCASE=FalseAvatar Bold by DefaultINITIALS_AVATAR_BOLD=FalseCache timeoutINITIALS_AVATAR_CACHE_TIMEOUT=60*60Usage OverviewIn most cases it will probably be more efficient to use the template tag to get the avatar's reverse url{%loadinitials_avatar%}{%render_initials_avatar"Your Name Here"%}You can also pass parameters{%loadinitials_avatar%}{%render_initials_avatar"Your Name Here"background="transparent"%}Available parameters:namebackgroundcolorlengthwidthheightsizeroundedcapitalizelowercaseboldDesired next stepMake it possible to render the png instead of an svg, perhaps directly converting the svg to png.
However so far the libraries need specific dll's and the intention would be to avoid this type of need.
Package: django-initial-setup
Django Initial SetupDjango Initial Setup provides inital setup screen developed with Django for first launch.InstallTo installdjango-initial-setup, run following command if you usepipenv.pipenv install django-initial-setupAfter installing, addfirst_setuptoINSTALLED_APPS.INSTALLED_APPS = (
    ...
    'first_setup',
)Activate routingAfter installeddjango-initial-setup, activate url path editingurls.pylike following. The routing accessing initial setup screen, is/initial_user_setup/welcomeby default if the path set like follwing.fromdjango.contribimportadminfromdjango.urlsimportpath,includeurlpatterns=[...path('',include('first_setup.urls')),]
Package: django-injector
Django InjectorAddInjectorto Django.Injector is a dependency-injection framework for Python, inspired by Guice. You canfind Injector on PyPIandInjector documentation on Read the Docs. Django-Injector is
inspired byFlask-Injector.Django-Injector is compatiable with CPython/Pypy 3.7+, Django 2.2+ and Django Rest Framework 3 (optional).Github page:https://github.com/blubber/django_injectorPyPI package page:https://pypi.org/project/django-injector/FeaturesDjango-Injector lets you inject dependencies into:Views (functions and class-based)Django template context processorsRest Framework views (functions and class-based)Rest Framework view setsInjector uses Python type hints to define types.InstallationDjango-Injector can be installed with pip:pip install django_injectorAfter installation adddjango_injectorto yourINSTALLED_APPSand optionally enable
the request injection middleware.INSTALLED_APPS=[...'django_injector',]MIDDLEWARES=[...'django_injector.inject_request_middleware',]The middleware enables the injection of the current request.WARNING:The injection middleware only works on WSGI application containers. Enabling the
middleware on an ASGI container (like daphne) will result in an error.Examplefromdjango.views.genericimportViewfrominjectorimportinjectfromrest_framework.viewsimportAPIViewclassMyService:...defmy_view(request,my_service:MyService):# Has access to an instance of MyService...classMyView(View):@injectdef__init__(self,my_service:MyService):# Class based views require the @inject decorator to properly work with# Django-Injector. The injection also works on the setup method.self.my_service=my_serviceclassMyAPIView(APIView):# Also works on ViewSet derivatives@injectdefsetup(self,request,my_service:MyService,**kwargs):# Injection on __init__ will result in a TypeError when using the HTML# renderer.Context processors have the same signature as view functions and work in the same way. They should
be registered in the template options as usual.It is also possible to use injection in management commands. In this case the injection
is done into the__init__method:fromdjango.core.managementimportBaseCommandfrominjectorimportinjectclassCommand(BaseCommand):@injectdef__init__(self,my_service:MyService):self.my_service=my_servicesuper().__init__()Injector Module supportDjango Injector supports Injector modules, just add aINJECTOR_MODULESsetting to your configuration
with a list of dotted paths to modules you want to load. The modules should either be callables that
accept a single argument,binderor subclasses ofinjector.Module. The modules will be loaded
when the injector Django app loads in the order they appear in the list. For example:INJECTOR_MODULES=['my_app.modules.configure_for_production','my_app.modules.ServiceModule',]DjangoModuleDjango Injector comes with a built-in module namedDjangoModulethat is always loaded as the first
module. It provides a couple of bindings for Django built-in types, namely:django.htt.HttpRequest: The current request. This only works ifdjango_injector.inject_request_middlewareis loaded and the application runs in a WSGI container.django.conf.Settings: Injectsdjango.conf.settings.
Package: django-inlaws
Were you ever looking at a record in your Django admin and wonder what else that object was related to? Django-InLaws shows you the relations of the object automatically!This is a proof of concept/request for comments releaseInstallationUse pip or easy_install to install the package from PyPI:pip install django-inlawsor:easy_install django-inlawsOr checkout the source fromgithuband run:python setup.py installUsageUsage is very simple.Add “inlaws” to yourINSTALLED_APPS.Create an “admin” directory in your project’s template directory.Create a file calledchange_form.html.The contents of the file should be:{% extends "inlaws/change_form.html" %}
Package: django-inlinecss
AboutInlining CSS is necessary for email generation and sending
but is currently a surprisingly large hassle.This library aims to make it a breeze in the Django
template language.UsageStep 1: DependenciesBeautifulSoupcssutilsPython 2.7+,3.4+Django 1.11+Step 2: Install django_inlinecssAdddjango_inlinecssto yoursettings.py:INSTALLED_APPS=('django.contrib.auth','django.contrib.webdesign','django.contrib.contenttypes','...','...','...','django_inlinecss')Step 3: Use the templatetagPlace your CSS file somewhere staticfiles can find itCreate your template:{% load inlinecss %}
{% inlinecss "css/extra-padding.css" %}<html><body><divclass='lots-o-padding'>Something in need of styling.</div></body></html>{% endinlinecss %}Step 4: Prepare to be Wowed<html><body><divstyle="padding-left: 10px; padding-right: 10px; padding-top: 10px;"class="lots-o-padding">Something in need of styling.</div></body></html>AcknowledgementsThanks to Tanner Netterville for his efforts onPynliner.Thanks to Thomas Yip for his unit tests on thesoupselectmodule. These tests
helped on getting the core CSS2 selectors to work.LicenseMIT license. See LICENSE.md for more detail.
Package: django-inlinecss-redux
AboutInlining CSS is necessary for email generation and sending
but is currently a surprisingly large hassle.This library aims to make it a breeze in the Django
template language.UsageStep 1: DependenciesBeautifulSoupcssutilsPython 3.6+Django 2.2+Step 2: Install django_inlinecssAdddjango_inlinecssto yoursettings.py:INSTALLED_APPS=('django.contrib.auth','django.contrib.webdesign','django.contrib.contenttypes','...','...','...','django_inlinecss')Step 3: Use the templatetagPlace your CSS file somewhere staticfiles can find itCreate your template:{% load inlinecss %}
{% inlinecss "css/extra-padding.css" %}<html><body><divclass='lots-o-padding'>Something in need of styling.</div></body></html>{% endinlinecss %}Step 4: Prepare to be Wowed<html><body><divstyle="padding-left: 10px; padding-right: 10px; padding-top: 10px;"class="lots-o-padding">Something in need of styling.</div></body></html>AcknowledgementsThis is a fork of django-inlinecss, with updates for newer versions of Python
and Django.Thanks to Tanner Netterville for his efforts onPynliner.Thanks to Thomas Yip for his unit tests on thesoupselectmodule. These tests
helped on getting the core CSS2 selectors to work.LicenseMIT license. See LICENSE.md for more detail.
Package: django-inline-csv-importer
Inline csv importer is a simple Django app to import csv data in admin inlines.Quick startAddinline_csv_importerto your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'inline_csv_importer',
]Include the mixin in yourModelAdminclass and definecsv_inline:class AwardAdmin(UploadCSVAdminMixin, admin.ModelAdmin):
    csv_inline = (
        (
            'Person import', {
                'fields': ('date', 'name', 'extra',),
                'inline': AwardPersonInline,
                'help_text': (
                    'CSV File should be in this format without headings: '
                    '<br> name, date, extra information.'
                )
            }
        ),
    )
Package: django-inline-ordering
This app aims at easing implementing drag & drop reordering of inline data in
Django Admin.Recent version ofGrappelliincludes
drag and drop inlines, so if you are already using Grappelli, installing
django-inline-ordering does not make sense. If you didn’t evaluate Grappelli yet,
I encourage you to do so!The django-inline-ordering is being tested during development on:Firefox 3.5+Internet Explorer 7+Google Chrome 10+Opera 11+Suggestions on how to improve django-inline-ordering are very welcome.InstallationPut ‘inline_ordering’ on your python pathAdd ‘inline_ordering’ to INSTALLED_APPS tuple in settings fileUsageFor each model that you want to be reorderable with drag & drop, you need to
setup an admin class and slightly modify model declaration. This way you can
easily apply reordering to existing model classes. You’ll also have to runcollectstatictask or copy one file to your MEDIA_ROOT when using Django
< 1.3.Let’s start with a simple example: Gallery has many Images. User might
want to reorder the photos in the gallery to fit his likings.Setup your admin inline class to inherit after OrderableStackedInlinefrom inline_ordering.admin import OrderableStackedInline


class ImageInline(OrderableStackedInline):

  model = Image


class GalleryAdmin(ModelAdmin):

    model = Gallery
    inlines = (ImageInline, )Setup your model to inherit after Orderablefrom inline_ordering.models import Orderable

class Image(Orderable):
  src = models.ImageField(upload_to='gallery/images')
  title = models.CharField(max_length=255)
  alt = models.TextField()

class Meta(Orderable.Meta):
  passAs ordering column was namedinline_ordering_position, avoid using
this name in your model.The Meta class declaration is NOT necessary - add it only if you need to set
your own meta attributes.Makeinline_ordering.jsaccessible over HTTPSince Django 1.3, there is astaticfiles appthat django-inline-ordering is
aware of. Just runmanage.py collectstaticto copy/symlink media files.The simplest way, back in Django 1.2, was to copymedia/inline_ordering.jsto yourMEDIA_ROOT.If you however believe that would make a mess, take advantage of the
‘INLINE_ORDERING_JS’ setting and set it to a location which should be requested
when accessing orderable inlines:INLINE_ORDERING_JS = STATIC_URL + '/js/third_party/inline_ordering.js'Known issuesReordering won’t work for new records until saved. This needs a onchange
handler for the record form or some model refactoring.At this point there is no support for tabular inlines. If you would like to
approach this problem, fork the project on Github.DevelopmentA simple test project has been added in fdc2189 under tests/testproject. Use
tools/buildenv.sh to build a virtualenv for development and syncdb to create
necessary models and admin permissions.Version 1.0.1 is likely to be the last one, as I’m planning to release a new
library to support ordering in Django admin both of inlines as well as on the
change list.Kudossimon forhttp://djangosnippets.org/snippets/1053/
Package: django-inlines-actions
Easy-to-use actions for Django admin inlinesInstallationInstall django_inlines_actionspipinstalldjango_inlines_actionsAddinlines_actionsto yourINSTALLED_APPS.Add theInlineActionsModelAdminMixinto yourModelAdmin.Add theInlineActionsMixinto yourTabularInline.Addinline_actionsattribute to yourTabularInlineas a tuple of your actions.inline_actions=('your_action_name','another_action_name',)Every actionmust havefollowing signature:defyour_action_name(self,request,obj,parent_obj):UsageAction is basically a link to another url with corresponding view.
It does not depends on form as some other solutions and not execute onEnterhit.
Action should returnNoneto return to the current changeform or aHttpResponseinstance.
If you want do disableActionscolumn setinline_actionstoNone.inline_actions=('change_title',)defchange_title(self,request,obj,parent_obj):obj.title=obj.title+' | '+parent_obj.nameobj.save()FeaturesPermissionsPermissions are instance of list/tuple classes and can be either custom function or django built-in permission.defyour_action_name(self,request,obj,parent_obj):passyour_action_name.permissions=('permission_func_name','django_builtin_permission_name',)permissions functionmust havefollowing signature:defpermission_func_name(self,request,obj,parent_obj):Must returnFalseto fail permission check otherwise permission will be passed.IfpermissionsreturnsFalseaction will no be rendered for user and action will raisePermissionDeniedon execution.Short DescriptionShort Description are either custom function or simple string.defyour_action_name(self,request,obj,parent_obj):passyour_action_name.short_description='My Uniq Description'your_action_name.short_description='short_description_func_name'short_description functionmust havefollowing signature:defshort_description_func_name(self,request,obj,parent_obj):Css ClassCss Class are either custom function or simple string.defyour_action_name(self,request,obj,parent_obj):passyour_action_name.css_class='my-css-class-name'your_action_name.css_class='css_class_func_name'css_class functionmust havefollowing signature:defcss_class_func_name(self,request,obj,parent_obj):Examplefromdjango.contribimportadminfrominlines_actionsimportInlineActionsModelAdminMixin,InlineActionsMixinfrom.modelsimportArticle1,Author1classArticleInline(InlineActionsMixin,admin.TabularInline,):model=Article1inline_actions=('make_published',)defmake_published(self,request,obj,parent_obj):obj.is_published=notobj.is_publishedobj.save()defmake_published_permission(self,request,obj,parent_obj):ifnotrequest.user.is_superuser:returnFalsedefmake_published_short_description(self,request,obj,parent_obj):return'Published Make'defmake_published_css_class(self,request,obj,parent_obj):return'some_class'make_published.permissions=('make_published_permission','example_app:can_change_article')make_published.short_description=make_published_short_descriptionmake_published.css_class=make_published_css_classclassAuthorAdmin(InlineActionsModelAdminMixin,admin.ModelAdmin,):inlines=(ArticleInline,)admin.site.register(Author1,AuthorAdmin)Testspip install requirements.txt
tox
Package: django-inline-static
django-inline-staticprovides template tags to inline css and javascript files in
Django templates, also corrects relative urls in css “url()” calls.FeaturesTemplate tag to inline any static fileinline_staticfileTemplate tag to inline javascript filesinline_javascriptTemplate tag to inline css filesinline_stylerelative to absolute path converter for paths in css filesRequirementsdjango-inline-static supports Python 3 only and requires at least Django 1.11.Prepare for developmentA Python 3.6 interpreter is required in addition to pipenv.$pipenvinstall--python3.6--dev$pipenvshell$pipinstall-e.Now you’re ready to run the tests:$pipenvrunpy.testResourcesDocumentationBug TrackerCode