Saravanan666/pypi-org huggingface dataset:
Package: django-stuff
Django Stuff is a collection of tools and utilities to make your development with Django simpler.RequirementsPython 3.xDjango 1.11 or laterFeaturesSignals Add methods in your model to do any task before or after save your modelExample using Pre-save signalNote: This will be made before you save your modelfromdjango_stuff.modelsimportSignalsModel...classYourModel(SignalsModel)...defpre_save(self):do_something()TimeStamp and History models to giving you information like when your record wore created/updated and History ChangesUUID Model as primary key or not instead of sequence ID.Serializer model to return a dict with all data of your django instance.Backend to Login using email or username.And many other stuff. For more information, see our documentation atRead the Docs.How to installGetting ItYou can get Django Stuff by using pip:$pipinstalldjango-stuffIf you want to install it from source, grab the git repository from Gitlab and run setup.py:$gitclonegit@github.com:rhenter/django_stuff.git$cddjango_stuff$pythonsetup.pyinstallInstalling ItTo enabledjango_stuffin your project you need to add it toINSTALLED_APPSin your projectssettings.pyfile:INSTALLED_APPS=(...'django_stuff',...)DocumentationCheck out the latestdjango-stuffdocumentation atRead the DocsContributingPlease send pull requests, very much appreciated.Fork therepositoryon GitHub.Make a branch off of master and commit your changes to it.Install requirements.pip install-rrequirements-dev.txtInstall pre-commit.pre-commitinstallRun the tests withcdtest-django-project;py.test-vv-sCreate a Pull Request with your contribution
Package: django-styleguide
styleguide for django[http://www.andrefarzat.com/django-styleguide](http://www.andrefarzat.com/django-styleguide)branch     | Build Status | Coverage Status | Requirements Status
———–| ————-| —————-| ——————-
master     | [![Build Status](https://travis-ci.org/andrefarzat/django-styleguide.png?branch=master)](https://travis-ci.org/andrefarzat/django-styleguide) | [![Coverage Status](https://coveralls.io/repos/andrefarzat/django-styleguide/badge.png?branch=master)](https://coveralls.io/r/andrefarzat/django-styleguide?branch=master) | [![Requirements Status](https://requires.io/github/andrefarzat/django-styleguide/requirements.png?branch=master)](https://requires.io/github/andrefarzat/django-styleguide/requirements/?branch=master)
django 1.7 | [![Build Status](https://travis-ci.org/andrefarzat/django-styleguide.png?branch=django1.7)](https://github.com/andrefarzat/django-styleguide/tree/django1.7) | [![Coverage Status](https://coveralls.io/repos/andrefarzat/django-styleguide/badge.png?branch=django1.7)](https://coveralls.io/r/andrefarzat/django-styleguide?branch=django1.7) | [![Requirements Status](https://requires.io/github/andrefarzat/django-styleguide/requirements.png?branch=django1.7)](https://requires.io/github/andrefarzat/django-styleguide/requirements/?branch=django1.7)Executing the tests1.pip install -r requirements-dev.txt1.python manage.py test1. Drink a coke
Package: django-stylist
StylistApp for updating and manipulating SASS/SCSS compiling on the flyInstallation OptionsFull install if you need to compile sass on the fly:pip installdjango-stylist[sass]If you just need the model to store style values:pip installdjango-stylistUpgrading from from 0.1.xLegacy users should add the setting STYLIST_USE_SASS = True should they choose to continue compiling sass files.
Package: django-stylus-watcher
django-stylus-watcher======================This add a command .Usage=====Put ``'stylus_watcher'`` into ``INSTALLED_APPS``.Set settings ``STYLUS_WATCHER = [('relative/path/to/main/stylus/file.styl', 'relative/path/to/compiled/file.css'), # A compilation rules('relative/path/to/main/stylus/file.styl', 'relative/path/to/compiled/file.css'), # Antoher compilation rules...etc]The watcher listen changes in every installed apps ``styl`` folderThen run ``python manage.py stylus_watcher``
Package: django-subcommand
Django SubcommandAdd sub command to A Django manage command.InstallationEdit settings.pyINSTALLED_APPS = (
    "subcommand",
)UsageGenerate the below command.$ python manage.py startsubcommand APP_NAME SUBCOMMAND_NAMEExamplesFor more information, please see theExampleSetup$ pip install django-subcommandLicenseMIT License
Package: django-subcommand2
DocumentationThe full documentation is athttps://django-subcommand2.readthedocs.org.InstallInstall django-subcommand:pip install django-subcommand2Usage# myapp.management.commands.parent_command.py
from subcommand.base import SubcommandCommand

from .subcommands.sub import MySubcommand


class Command(SubcommandCommand):
    help = 'My Parent Command'

    subcommands = {
        'sub': MySubcommand,  # python manage.py parent_command sub
    }


# myapp.management.commands.subcommands.sub.py
from django.core.management.base import BaseCommand


class MySubcommand(BaseCommand):
    help = 'My Sub Command'History0.1.0 (2016-01-26)First release on PyPI.0.1.1 (2016-01-26)Update badges.
Package: django-subcommandir
django-subcommandirDjango subcommands in subdirectoriesInstallation$pipinstalldjango-subcommandirExample of usagemy_app
├──...
├──management
│├──commands
││├──__init__.py
││├──load
│││├──__init__.py
│││├──month_report.py
│││└──year_report.py
││├──my_app_load.py
│├──__init__.py# .../management/commands/my_app_load.pyfromsubcommandirimportBaseCommandclassCommand(BaseCommand):subcommand_dir='load'# .../management/commands/load/month_report.pyfromdjango.core.management.baseimportBaseCommandclassCommand(BaseCommand):defadd_arguments(self,parser):parser.add_argument('--start',...)...defhandle(self,*args,**options):...Command calls:$pythonmanage.pymy_app_loadyear_report
$pythonmanage.pymy_app_loadmonth_report--start="2021-01"--end="2021-02"orfromdjango.core.managementimportcall_commanddefload_year_report():call_command('my_app_load','year_report')defload_month_report():call_command('my_app_load','month_report',start=...)LicenseMIT
Package: django-subcommands
Installation$[sudo]pipinstalldjango-subcommandsExamplesmanagement/commands/command.pyfromdjango.core.management.baseimportBaseCommandimportdjango_subcommandsclassSubCommand1(BaseCommand):defhandle(self,*args,**options):...classSubCommand2(BaseCommand):defhandle(self,*args,**options):...classCommand(django_subcommands.SubCommands):subcommands={"subcommand1":SubCommand1,"subcommand2":SubCommand2}$pythonmanage.pycommandsubcommand1readme42.com
Package: django-subdomain-instances
A simple way of allowing subdomains to be served by the same project, and
associating objects with particular subdomains.InstallationBy default, it will work if you use 127.0.0.1.nip.io (a domain that points
to localhost) on port 80. To use a different base domain/port, set theBASE_HOSTand/orBASE_PORTvariables.Addinstancesto yourINSTALLED_APPSand migrate to get the Instance
database table.Add Instance objects, with the label being the subdomain you wish to use.
Optionally, associate users with these instances.Addinstances.middleware.MultiInstanceMiddlewareto your middleware; it
must come after AuthenticationMiddleware. Now
if you go to<subdomain>.<BASE_HOST>, request.instance will be set to the
matching Instance object. If there’s a subdomain given but no match, it will
redirect toBASE_HOST.Requests to a subdomain will use yourROOT_URLCONFfile; requests to theBASE_HOSTwill useROOT_URLCONF_HOSTorinstances.urlsby default (which
just has one page that lists all instances)..Instance edit formIn your ROOT_URLCONF, use a line like the following to have a page for editing
the title and description of an instance:url(r’^instance/edit$’, InstanceUpdate.as_view(), name=’instance-edit’)Associating modelsTo have a model’s objects be associated with an instance, mix in InstanceMixin,
and if you have a custom manager make it a subclass of InstanceManager. This
adds aninstancefield, and provides afor_instancemanager method to
return all the objects in the given instance.Mix in InstanceViewMixin to any display class-based view to restrict the
default queryset to the request’s instance. Add InstanceFormMixin to any
create/update view to store the current instance upon save, and allow editing
only by those users associated with the instance. Remember to excludeinstancefrom any model form, as it won’t be seen.Running testspip install .
python runtests.py
Package: django-subdomains-handler
=====Django Lightweight Subdomains Handler=====This is a very short Django Middleware to handle each subdomainswith a specific URLconf file.Example-------If you want to have something like::api.example.orgwith a specific URLconf file for each of your subdomainsThis what you're looking for!Quick start-----------1. Add this on top of your MIDDLEWARE_CLASSES setting like this::MIDDLEWARE_CLASSES = ('lightsub.middleware.SubDomainMiddleware',...)2. Add the SUBDOMAINS_URLCONF dict to your setting project file::SUBDOMAINS_URLCONF = {'api': 'api.urls',}Where 'api.urls' is your Django-app 'api' and urls is your urls.py module3. Run your Django project and try to reach api.example.org
Package: django-subforms
Django Subformspipinstalldjango-subformsDocumentation:https://mrthearman.github.io/django-subforms/Source Code:https://github.com/MrThearMan/django-subforms/Contributing:https://github.com/MrThearMan/django-subforms/blob/main/CONTRIBUTING.mdThis library adds two new fields:NestedFormField, which can wrap forms as fields on another form
and thus provide validation for, e.g., a JSON field, andDynamicArrayField, which can wrap
fields, includingNestedFormField, as dynamically expandable lists of fields.
Package: django-subject-imagefield
django-subject-imagefieldThis package provides aSubjectImageFieldmodel field which inherits from the coreImageFieldand adds support for subject position.
The position coordiantes are stored inside another model field defined as an option (as it occurs with the width and height optional ImageField parameters).
A custom form field and widgets are used in order to allow the user to easily set the image subject dragging a pin over an image preview.
Some convenience properties are added to theattr_classof the field in order to access the subject position coordinates in a template.Use it together with some sort of thumbs generator application in order to show always the relevan part of an image, I find it playing well withsorl-thumbnail.Tested for django >= 1.11InstallationInstall with pip$ pip install django-subject-imagefieldAdd it to your installed apps:INSTALLED_APPS = {
    #...
    subject_imagefield,
}ConfigurationYou can set the image preview width for the widget:SUBJECT_IMAGEFIELD = {
    'PREVIEW_WIDTH': 500
}Value is considered as number of pixels, default: 300.UsageIn you models:from subject_imagefield.fields import SubjectImageField

class MyModel(models.Model):
    image = SubjectImageField('image', upload_to='pages/img', subject_location_field='subject_location')
    subject_location = models.CharField('subject coords', max_length=7)In a django template you've access to the following properties:subject_perc_position: a dictionary containing the subject position in percentage coordinates, i.e:{'x': 15, 'y': 37}subject_position: a dictionary containing the subject position coordinates in px relative to the original image dimensions, i.e:{'x': 700, 'y': 345}sorl: a shortcut to get a string used as cropping paramenter for sorl-thumbnail templatetag, i.e:'15% 37%'Example:{% load sorl_thumbnail %}

<p>Perc. subject position: {{ object.image.subject_perc_position }}</p>
<p>Original dimensions subject position: {{ object.image.subject_position }}</p>
<p>Thumb cropped considering subject position:</p>
{% thumbnail object.image "200x800" crop=object.image.sorl as thumb %}
<img src="{{ thumb.url }}" alt="ftw" />
{% endthumbnail %}
Package: django-subjective-sort
Django Subjective SortThis library enables subjective sorting of a list of objects. Imagine you are building a task management app, and
the UI allows a user to manually sort his or her daily tasks via drag-and-drop. Django Subjective Sort makes it easy to
handle re-positioning, both of the task that moved but also the other tasks that were affected by the move.How it worksAn abstract Django model class establishes an integer field namedpositionfor storing the position of an object in a
list. Objects have no position by default (e.g.position = None). Positioning is one-indexed with the object assigned
the1position having the highest prominence and objects without a position the lowest prominence. Objects cannot have
a position less than one, and cannot have a position greater than the number of objects in the list. If an object is
assigned a position greater than the number of objects with an assigned position, list objects without a position will
inherit one until the desired list position is reached.Important: Never modify the value of thepositionfield directly. Only manage object positioning using therepositionmethod.By design, Django Subjective Sort cannot influence list membership. It's only responsibility is managing the positioning
of objects in the list it is provided. Since only a single position value is stored, each object can belong to only one
subjectively sortable list. Using the task management example above, a task could be manually sorted among peers
assigned to the same day, but not also among peers assigned to the same week or month.Both for flexibility and because the Sortable model class is abstract, positioning changes are not automatically saved.
The example below demonstrates how to extend therepositionmethod to save positioning changes for all objects
affected by re-positioning in a single transaction.The Sortable model class contains two methods:repositionandsort_by_position. Therepositionmethod updates the
position of the object it is called on, as well as any of its list peers affected by the change. Thesort_by_positionmethod is a convenience method for sorting a list of objects by their position.Installation$pipinstalldjango-subjective-sortUsageExtend theSortableclass to add custom sorting logic to any Django model.# food/models.pyfromdjango_subjective_sort.modelsimportSortableclassFood(Sortable):passApply migrations.$pythonmanage.pymakemigrations$pythonmanage.pymigrateExtend therepositionmethod to save positioning changes for all objects affected by re-positioning in a single
transaction.# food/models.pyfromtypingimportListfromsrc.django_subjective_sort.modelsimportSortableclassFood(Sortable):# Extend the `Sortable` class to save sorting order.# This allows flexibility to save other changes simultaneously.defreposition(self,peers:List['Food'],position:int=None)->List['Food']:sortables_affected=super().reposition(peers,position)+[self]# Save the changesreturnFood.objects.bulk_update(sortables_affected,['position'])
Package: django-sublime-scroll
=====================Django Sublime Scroll====================="Sublime Text 2"-style scroll bars.Installation:=============* pip install django-sublime-scroll* Setup wkhtmltoimage* load template tags.. code:: jinja{% load sublime_scroll_tags %}{% sublime_scroll %}* It's a good idea to have some cache so that the page capture is not generated every time that the page is loaded. So at the very least, you should do this:.. code:: jinja{% load sublime_scroll_tags cache %}{% cache 500 sublime_scroll %}{% sublime_scroll %}{% endcache %}* Make sure to include RequestContext in response. Example:.. code:: pythonfrom django.template import RequestContextreturn render_to_response('index.html', {'form': form, },context_instance = RequestContext(request))Settings:=========.. code:: python# Absolute path to wkhtmltoimage if not in system PATH:SUBLIME_SCROLL_WKHTMLTOIMAGE_PATH # (default: "wkhtmltoimage")# Scroll Bar width:SUBLIME_SCROLL_SETTINGS# Default (in javascript):{'scroll_width': 150,'offset': 0,'z_index': 50,'content_width': 960,'full_height': "$('html').height()",'opacity': 0.1,'color': 'white',}
Package: django-submail
An easy django email backend to send email usingSubmail’s pythonMail API.RequirementsDjango >= 1.8. Django with other versions are not tested.InstallationInstall the backend from PyPI:pipinstalldjango-submailAdd the following lines to your project’ssettings.pyor your local settings:EMAIL_BACKEND="smbackend.SubmailBackend"SUBMAIL_APP_ID="Your Submail APPID"SUBMAIL_APP_KEY="Your Submail APPKey"UsageIf you usesend_mailmethod, you can simply do it by, for example:fromdjango.core.mailimportsend_mailsend_mail("Your Subject","This is a pure text email body.","Dong Zhuang <hello@foo.com>",["dongzhuang@bar.com"])If you want to use theEmailMessageclass, then:fromdjango.core.mailimportEmailMessagemail=EmailMultiAlternatives(subject="Your Subject",body="This is a pure text email body.",from_email="Dong Zhuang <hello@example.com>",to=["dongzhuang@foo.com"],headers={"Reply-To":"dongzhuang@bar.com"})mail.send()If you want to use theEmailMultiAlternativesclass, then:fromdjango.core.mailimportEmailMultiAlternativesmail=EmailMultiAlternatives(subject="Your Subject",body="This is a pure text email body.",from_email="Dong Zhuang <hello@example.com>",to=["dongzhuang@foo.com"],headers={"Reply-To":"dongzhuang@bar.com"})mail.attach_alternative("<p>This is an HTML email body</p>","text/html")mail.send()Sometimes you need to send some other emails using APPID other than the default SUBMAIL_APP_ID
set insettings.py, you can use addSUBMAIL_APP_IDandSUBMAIL_APP_KEYkeys in
header, for example:fromdjango.core.mailimportEmailMultiAlternativesmail=EmailMultiAlternatives(subject="Your Subject",body="This is a simple text email body.",from_email="Dong Zhuang <hello@example.com>",to=["dongzhuang@foo.com"],headers={"Reply-To":"dongzhuang@bar.com","SUBMAIL_APP_ID":settings.ANOTHER_APP_ID,"SUBMAIL_APP_KEY":settings.ANOTHER_APP_KEY})mail.attach_alternative("<p>This is an HTML email body</p>","text/html")mail.send()DEMOA demo is included in the repository, you can clone the git and run it locally.You can optionally run the demo usingvirtualenv.pipinstallvirtualenvvirtualenvvenvvenv/scripts/activateThenpipinstalldjangopipinstalldjango-submailgitclonehttps://github.com/dzhuang/django-submail.gitcddjango-submail/demopythonmanage.pymigrateMake a copy of example local settings:cddemocpsettings_local.py.examplesettings_local.pyvisettings_local.pyEdit params insettings_local.pyaccording to your own
submail app, and editdemo/test_smbackend/views.pyif
necessary, then run the dev server:cd..pythonmanage.pyrunserverand visithttp://127.0.0.1:8000to see the result.TODOsSupport Submail’s mail/xsend APISupport Submail’s addressbookLICENSEThe MIT License.ContributionDjango-submail is wholly open source and welcomes contributions of any kind. Feel
free to either extend it, report bugs, or provide suggestions for improvements.
The author of can be contacted atdzhuang.scut@gmail.com.
Package: django-submodel
A Django field which: works like a model instance, stores sub-model fields in single DB column, and supports smooth editing in Django admin.django-submodel works on Django 1.3+Installationpip installdjango-submodelUsage# in you_app/models.py

from django.db import models
from submodel.fields import SubModelField


# Define (field_name, model_field_instance) tuples in "fields" parameter in SubModelField,
#   similar as normal Model definition
# If SubModelField such as pref field is newly added to an existed model,
#   you may want to use south to migrate the schema
class UserProfile(models.Model):
    realname = models.CharField(max_length=100)
    pref = SubModelField(u'user preference',
                 fields=(
                     ('title', models.CharField(max_length=10)),
                     ('color', models.IntegerField(choices=((0, 'Black'), (1, 'White')))),
                     ('birthday_day', models.DateTimeField()),
                     ('feel_luck', models.BooleanField(default=True))))# in you_app/admin.py, to enable editing of sub fields of pref in Django admin

from submodel.admin import SubModelFieldInlineAdmin
from . models import UserProfile

class PrefInilneAdmin(SubModelFieldInlineAdmin):
    model = UserProfile._meta.get_field('pref').submodel # TODO improve

class UserProfileAdmin(admin.ModelAdmin):
    inlines = [PrefInilneAdmin]

admin.site.register(UserProfile, UserProfileAdmin)>>> # TODO in Python shell, the value of pref field as a model instanceTODOadd testssimpler APIdump and modify Deserializer to support missing subfields. schema policy?better historycheck compatibility w/ django-reversion and others …possible configmore strict check such as attname confliction, for example FK field user and field user_id
Package: django-submodule
=====Django Git Submodules=====Django Submodules is a simple Django app that allows youto manage apps as git submodules instead of pip.This allows you to have a local development version ofthird-party packages and merge changes from upstream.Ideally should only be used in development.These changes should be pushed back to the package repositoryand installed with pip on production.Quick start-----------1. Install django-git-submodules::pip install django-git-submodule2. Clone the the package you want on your project root::git clone https://github.com/tomchristie/django-rest-framework.git3. Import the app in your `settings.py`::from dj_git_submodule import submodulesubmodule.add('django-rest-framework')4. Now you should be able to add the app to `INSTALLED_APPS` and have django find it successfully.5. If you need to import multiple apps, you can create a file alongside your requirements.txt::from dj_git_submodule import submodulesubmodule.register('submodules.txt')
Package: django-subprocess-view
django-subprocess-viewAn app for a superuser to run subprocess commands in a Django projectSet upInstall from PyPIpython -m pip install django-subprocess-viewAdd the package to your settins INSTALLED_APPSINSTALLED_APPS=[..."subprocess_view",...]Add tourls.pyurlpatterns=[path("admin/",admin.site.urls),path("subprocess/",include("subprocess_view.urls")),# add this]UsageGo to the url path or the appEnter the command you wish to runclickSendCheck the results
Package: django-subscribe
A simple subscription app for Django.InstallationPrerequisites:DjangoIf you want to install the latest stable release from PyPi:$ pip install django-subscribeIf you feel adventurous and want to install the latest commit from GitHub:$ pip install -e git://github.com/bitmazk/django-subscribe.git#egg=subscribeAddsubscribeto yourINSTALLED_APPS:INSTALLED_APPS = (
    ...,
    'subscribe',
)Run the South migrations:./manage.py migrate subscribeUsageIn order to render a subscribe/unsubscribe button next to an object, do this:{% load i18n subscribe_tags %}
{% get_subscribers object as subscribers %}
{% get_ctype object as ctype %}
{% is_subscribed user object as user_is_subscribed %}
{% if user_is_subscribed %}
    <p><a href="{% url "subscriptions_delete" ctype_pk=ctype.pk object_pk=object.pk %}">{% trans "Un-subscribe" %}</a></p>
{% else %}
    <p><a href="{% url "subscriptions_create" ctype_pk=ctype.pk object_pk=object.pk %}">{% trans "Subscribe" %}</a></p>
{% endif %}TestFor a test run$ python manage.py check
$ python manage.py migrate
$ python manage.py createsuperuser
$ python manage.py runserverand check it out athttp://localhost:8000/adminRoadmapCheck the issue tracker on github for milestones and features to come.