Saravanan666/pypi-org huggingface dataset:
Package: django-sorting-bootstrap
FeaturesDjango Sorting Bootstrap is a pluggable mini-API to easy add sorting for querysets, links and table headers inDjangotemplates. There is also a new tag that creates headers for sorting tables usingBootstrap’s layout.RequirementsPython 3.7+Django 2.0+Bootstrap 3+InstallationYou can installDjango Sorting BootstrapviapipfromPyPI:$pipinstalldjango-sorting-bootstrapDocumentationComplete instructions on installation and usage are found indocsdirectory and online athttps://django-sorting-bootstrap.readthedocs.io.ContributingContributions are very welcome.
To learn more, see theContributor Guide.LicenseDistributed under the terms of theMITlicense,Django Sorting Bootstrapis free and open source software.CreditsThis app is based onAgiliq’s django-sorting0.1. It has two improvements over it: the new tags and the Twitter Bootstrap compliance idea.
Package: django-sorting-field
This package implements a Django form field + widget for drag & drog sorting of itemsSorting any item with a field calledidis supportedThe drag and drop feature has been implemented withhtml5sortable.Known limitationsRefreshing the items on the widget not (yet?) supported out of the boxNo testsExample of the widgetUsageThe sort order field should be implemented on the model containing the sorted objects.
This allows ordering of different instances of the same item set differently.Let’s say you have image CarouselPlugin, Carousel, and Picture models, and you wish to be able to
sort the same Carousel instance differently on each CarouselPlugin.You also have a CMSPlugin object for the carousel.classCarousel(models.Model):passclassPicture(models.Model):carousel=models.ForeignKey(Carousel,related_name="pictures")image=SomeImageField()name=models.CharField()classCarouselPlugin(CMSPlugin):carousel=models.ForeignKey(Carousel,related_name="x")classCMSCarouselPlugin(CMSPluginBase):model=CarouselPlugindefrender(self,context,instance,placeholder):context.update({"pictures":self.instance.carousel.pictures.all(),})returncontextAchieving the wanted behavior can be done in the following steps:Add a (nullable) TextField to the model containing the order informationclassCarouselPlugin(CMSPlugin):carousel=models.ForeignKey(Carousel,related_name="x")carousel_order=models.TextField(null=True)Add the SortingFormField to the CMS Plugin and populate itfromdjango_sorting_field.fieldsimportSortingFormFieldclassCarouselPluginForm(forms.ModelForm):carousel_order=SortingFormField()def__init__(self,*args,**kwargs):super(CarouselPluginForm,self).__init__(*args,**kwargs)ifself.instance.pk:self.fields["carousel_order"].populate(items=self.instance.carousel.pictures.all(),)classCMSCarouselPlugin(CMSPluginBase):model=CarouselPluginform=CarouselPluginFormdefrender(self,context,instance,placeholder):context.update({"pictures":self.instance.carousel.pictures.all(),})returncontextFinally, sort the items passed to the context datafromdjango_sorting_field.utilsimportsort_by_orderclassCMSCarouselPlugin(CMSPluginBase):model=CarouselPluginform=CarouselPluginFormdefrender(self,context,instance,placeholder):context.update({"pictures":sort_by_order(self.instance.carousel.pictures.all(),self.instance.carousel_order),})returncontext
Package: django-sort-order-field
Sort Order Field provides a Django model field for controlling sort order.
The field includes an admin widget which makes it easy to arrange related
models in an inline form.At the moment, the admin widget assumes it is the only field which controls
ordering for its model, and it has no awareness of the sort direction. This
is less powerful than other sort field libraries, but its design may be
useful for certain situations.Easy to use sort buttons.Accessible keyboard navigation and non-sequential sort indexes.InstallationAdd “sort_order_field” to your INSTALLED_APPS setting:INSTALLED_APPS = [
    ...
    'sort_order_field',
]Basic usageAdd a SortOrderField to one of your models:from django.db import models
from sort_order_field import SortOrderField

class Poll(models.Model):
    question = models.CharField(max_length=100)

class PollOption(models.Model):
    class Meta:
        ordering = ('sort_order',)

    poll = models.ForeignKey('Poll', on_delete=models.CASCADE)
    sort_order = SortOrderField(_("Sort"))
    label = models.CharField(max_length=100)Add the sortable model to an inline model admin for your parent model:from django.contrib import admin
from . import models

class PollOptionInline(admin.TabularInline):
    model = models.PollOption
    fields = ('sort_order', 'label',)

@admin.register(models.Poll)
class PollAdmin(admin.ModelAdmin):
    fields = ('question',)
    inlines = (PollOptionInline,)The sort order field will be rendered as a text field with JavaScript
enhancements. When the user enters a new sort order value, the inline forms
will be reorganized according to that value. The sort order fields will be
bound by their initial values, which helps to avoid conflicts if the same
objects appear in different inlines.
Package: django-sotp
Django SOTP 🔐Generate a secured base32 one time password to authenticate your user!Abstract 📑Django SOTP does just two things, and does them really well.One - it is stupidly secured and simple to integrateTwo - it clears out OTPs at the elapsed timeInstallation ⏳Installing django-sotp is very easy, you'll be using (I'd recommend you use a virtual environment, so you don't break your system) the command pip.Here's how to go about it:pipinstalldjango-sotpNext is, adding the installed packages to your project:INSTALLED_APPS=[...'sotp',]Sincedjango-sotpdepends on a particular package to clear out the OTPs at the elapsed time. We'd have to include another package to our installed apps.INSTALLED_APPS=[...'sotp','django_apscheduler',# added package ;-)]Now you've done it, all you need to do is add the time which you want the generated OTPs to expire:SOTP_TIME_EXPIRATION=5# in minutesYesss. Next is to make migrations and migrate to your database and you're good to go!pythonmanage.pymakemigrations&&pythonmanage.pymigrateCongratulations! You're all set! Let's jump right into how to start using it.How-To Use 📝You've gotdjango-sotpinstalled and ready to use, here's how to start using it!Step 1: Import the library to the file(.py)you want to use:fromsotp.servicesimportGenerateSOTPStep 2: Instantiate the class:otp=GenerateSOTP()Step 3: Call thegenerate_otplogic (method) directly in the file, and pass the user's email; since generate_otp requires the user email address to generate the otp code.# Generates otp code for the userotp.generate_otp(user_email=user.email)Step 4: A base32 secured token and code has been generated, and saved to the secured_otps table. Oh, let's not forget about the scheduler that has been called to remove the user otp and token after theSOTP_TIME_EXPIRATIONhas elapsed! 🤝Last Step (maybe?): You can call the function anywhere, anytime.If you are still finding it difficult to use this package, kindly check theexample appI made for reference, orcreate an issueand state the problem you are experiencing!Shell Example 🥁If you'd like to test out the package on your django shell..Step 1: Run the command:pythonmanage.pyshellStep 2: Import the libray directly on the shell:fromsotp.servicesimportGenerateSOTPStep 3: Call the generate_otp method, don't forget to add a user email address:secured_otp=otp.generate_otp(user_email="test@email.com")# email should exist :-)Step 4: A Token and OTP is generated, and saved to secured_otps database.{'totp':'5ZCLA7UQVXFP2B5WL5OZG4QDFDJ4GL65','OTP':'957092'}
Package: djangosourcecontrol
=====DjangoSourceControl=====DjangoSourceControl is a simple Django app to create Web-based Python files and projects.For each project, users can add, update, and create python projects, files, and versions.Note: Django source control has a unit test suite which can be ran by 'python manage.py test' to run the repo and api authentication tests.Quick start-----------1. Add "djangosourcecontrol" to your INSTALLED_APPS setting like this::INSTALLED_APPS = [...'djangosourcecontrol',]2. Include the djangosourcecontrol URLconf in your project urls.py like this::url(r'^djangosourcecontrol/', include('djangosourcecontrol.urls')),3. Run `python manage.py migrate` to create the djangosourcecontrol models.4. Start the development server and visit http://127.0.0.1:8000/admin/to assign the can_add_project, and/or the can_run_project to user.5. Visit http://127.0.0.1:8000/djangosourcecontrol/ to start creating projects.
Package: django-sourcerer
innovativeproject-django-sourcererLinksPypihttps://pypi.org/project/django-sourcerer/Source codehttps://github.com/nokia-wroclaw/innovativeproject-django-sourcererInstallpip install django-sourcererUsageAdddjango_sourcererandrest_frameworktexts tosettings.pyunderINSTALLED_APPSlist.INSTALLED_APPS=[
    ... 
    'django_sourcerer',
    'rest_framework'
]Add also tosettings.pyinformation that where the config file is located.SOURCERER_CONFIG_FILES = [
    "project_path/example.yaml"
]Then run following commands:./manage.py makemigrations django_sourcerer./manage.py migrateFor update objects from source type following command:./manage.py update_objectsFor view in API Framework add following lines of code to yoururls.py:from django.urls import path, include
from django_sourcerer.urls import django_sourcerer_urls

urlpatterns = [
    path('', include(django_sourcerer_urls().urls))
]Then just start the API./manage.py runserver.Library works withcsvdatas now. It will be updated for json&xls formats.Example .yaml Filename: <name of data source>
source: <endpoint of data source>
format: csv
columns:
  - external_name: <column name>
    type: <column type e.g : int>
  - external_name: <column name>
    type: <column type e.g : str>RequiresPython 3
Package: django-south-admin
Django South AdminDjango app allowing for South management through Admin.django-south-adminallows you triggerSouthmigrations and manage migration histories through Django’s admin interface.django-south-adminutilizesdjango-object-toolsto hook into Django’s admin interface and take care of user permissions.ContentsDjango South AdminInstallationUsageAuthorsChangelog0.0.3 (2012-07-10)0.0.2 (2012-07-10)InstallationInstalldjango-object-toolsas describedhere.Install or adddjango-south-adminto your Python path.Addsouth_adminto yourINSTALLED_APPSsetting.UsageOnce installed you should see a newSouthsection on admin home. On theMigration historieslisting view a newMigratetool will be available allowing you to run South’smigratemanagement command.If you don’t see the tool make sure the logged in user has the appropriateCan migrate migration historysuser permission assigned (or set user as superuser).Clicking theMigratetool link will immediatly kick-off South’smigratemanagement command and return its output.AuthorsPraekelt FoundationShaun SephtonChangelog0.0.3 (2012-07-10)setup.py correction to have correct description.0.0.2 (2012-07-10)Initial release.
Package: django-south-central
Run maintenance commands for Django apps in database migrations fashion.QuickstartInstall django-south-central:pip install django-south-centralCreate database table for history:python manage.py syncdbUsageGenerate migration file and update its contents manually:python manage.py appmigration app_name migration_nameOr, generate Django call_command call with specified arguments:python manage.py appmigration app_name migration_name cmd_name cmd_argApply migration:python manage.py migrateapp app_nameHistory0.1.0 (2014-04-01)First release on PyPI.
Package: django-south-compass
What is it?Django south compass is a tool to guide your south migrations.It is a git hook that keeps your south migrations in sync with your repository.Installation$pipinstalldjango-south-compassUsageGo to your git repo and do:$django-south-compassinstallThis will setup a git hook so that whenever you checkout a branch, you’re
migrations are synced up.Eg.$gitbranch*masterfeature1feature2$gitcheckoutfeature1# Migrates to any new migrations added in feature1$gitcheckoutmaster# Migrates back to the last migration in master$gitcheckoutfeature2# Migrates to any new migrations added in feature2$gitcheckoutfeature1# Migrates back to the last migration common between
# feature1 and feature2, then migrates forward to feature1License3 Clause BSD.Bug report and HelpFor bug reports open a github ticket. Patches gratefully accepted. Need help?Contact us hereThanksDjango south compass was inspired byhookupfor rails.
Package: django-spa
django-spaDjango package to serve a single-page app (SPA).The following settings that make serving SPAs easier
are handled in django-spa:index.htmlserved when/requestedall/static/…files served on/…as wellDjango’s urls still work (Django admin, templates, Django REST framework APIs)everything else goes to/for frontend routing (e.g.react-router)UsageFor an example of using django-spa to serve a create-react-app frontend
that consumes a Django REST framework API, check outgenerator-django-rest.As part of setting up django-spa, you also need to set upWhiteNoise,
which we’ll summarise here.First, adddjango-spato yourrequirements.txtandpip install-rrequirements.txt(orpipenv installdjango-spa).
Whitenoise is installed as a dependency, so no need to specify it extra.Updatesettings.pywith the Whitenoise & django-spa middleware:MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'whitenoise.middleware.WhiteNoiseMiddleware',
    'spa.middleware.SPAMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]Disable runserver’s static file serving by addingrunserver_nostaticto the top of your INSTALLED_APPS list:INSTALLED_APPS = [
    'whitenoise.runserver_nostatic',
    'django.contrib.staticfiles',
    # ...
]Set the django-spa static file storage:STATICFILES_STORAGE = 'spa.storage.SPAStaticFilesStorage'You should be good to go!CreditsUsed some parts of the solution suggested in thisWhiteNoise issuefor serving index.html on/.
This package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.LicenseMITHistory0.3.0 (2019-12-15)add example projectsupport Django 3.00.2.0 (2017-09-01)Fix #30.1.1 (2017-04-08)Metadata fixes.0.1.0 (2017-04-08)First release on PyPI.Initial django-spa middleware.
Package: django-spaceless-templates
Django application, providing simple template loader. It reduces HTML output in templates by stripping out whitespace
characters between HTML and django template tags. With cached template loader, whitespace stripping is done only once
during template compilation. This is more efficient than solutions based on{% spaceless %}tag or middleware minification.This package is based on following unmaintained packages:Django template minifying loaderDjango template minifiedHow much bandwidth does it save? Check data from real project:Normal HTML109kB15kB gzippedSpaceless HTML67kB13kB gzippedSaved38 %12 % gzippedInstallationpipinstalldjango-spaceless-templatesBasic usageModify Your Django project settings’s module.For production(note cached loader):TEMPLATES=[{'DIRS':[str(APPS_DIR.path('templates')),],'OPTIONS':{'loaders':[('django.template.loaders.cached.Loader',['django_spaceless_templates.loaders.filesystem.Loader','django_spaceless_templates.loaders.app_directories.Loader',],),],},},]For development(each refresh reloads template):TEMPLATES=[{'DIRS':[str(APPS_DIR.path('templates')),],'OPTIONS':{'loaders':['django_spaceless_templates.loaders.filesystem.Loader','django_spaceless_templates.loaders.app_directories.Loader',],},},]SettingsUsing modified settings You can:turn on stripping only for templates with given extensionsTEMPLATE_MINIFIER_FILENAME_EXTENSIONS=('.html','.htm',)turn off stripping for particular directoriesTEMPLATE_MINIFIER_EXCLUDED_DIRS=('admin/',)turn off all strippingTEMPLATE_MINIFIER=False# default = Truerun Your own strip_function, which preprocess templatesTEMPLATE_MINIFIER_STRIP_FUNCTION='template_minifier.utils.strip_spaces_in_template'use only in productionifDEBUG:TEMPLATE_MINIFIER=FalseKnown issuesDon’t use//one line comments in your inline javascript<script>tags.Use /* */ instead:// comment something - !!it's evil!! and cause the rest of JS code is commented out.functionname(){}/* comment something - it's nice and clean <3! */functionname(){}Don’t use multiline{% blockquote %}without parametertrimmed.
Otherwise your blockquote translations won’t be translated. Correct usage:{%blockquotetrimmed%}Myparagraph...{%blockquote%}To preserve extra space use{{ " " }}:<div>Text {{ " " }} {{ variable }}</div>Running Tests(myenv) $ pip install -e .
(myenv) $ python ./runtests.pyCheck packagepython-mbuild;python-mtwinecheckdist/*
Package: django-spades
Django Spades can be used to keep track of things(events) that happen on your django and you want to track.There is basically two usages:1 - API2 - Saving a record modelQuick startInstall:pip install django-spadesAdd “Spades” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'Spades',
]Runpython manage.py migrateto create the models.UsageYou should see it under admin with a nice rendering of the json fieldUsing the Model:from Spades.models import Event
tmp={}
tmp['User']=request.user.id
tmp['AnyTag']="Checkpoint 1"
tmp['Tag2'] = some_variable

event = Event(name="USER_CLICKED_A_BUTTON",info=json.dumps(tmp))
Package: django-spaghetti-and-meatballs
Its a spicy meatball for serving up fresh hot entity-relationship diagrams straight from your django models.Adding spaghetti to your projectInstall some spaghetti:pipinstalldjango-spaghetti-and-meatballsAdd"django_spaghetti"to yourINSTALLED_APPSsetting like this:INSTALLED_APPS=[...'django_spaghetti',]Configure your saucedjango-spaghetti-and-meatballstakes a few options set in theSPAGHETTI_SAUCEvariable from your projectssettings.pyfile that make itextra spicy:SPAGHETTI_SAUCE={'apps':['auth','polls'],'show_fields':False,'exclude':{'auth':['user']},}In the above dictionary, the following settings are used:appsis a list of apps you want to show in the graph. If itsnotin here itwon’t be seen.show_fieldsis a boolean that states if the field names should be shown in the graph or just in the however over. For small graphs, you can set this toTrueto show fields as well, but as you get more models it gets messier.excludeis a dictionary where each key is anapp_labeland the items for that key are model names to hide in the graph.If its not working as expected make sure your app labels and model names are alllower case.Serve your plate in your urls fileOnce you’ve configured your sauce, make sure you serve up a plate of spaghetti in yoururls.pylike so:urlpatterns+=patterns('',url(r'^plate/',include('django_spaghetti.urls')),)A sample platterBelow is an example image showing the connections between models from thedjango-reversionanddjango-notificationsapps and Django’s built-inauthmodels.Colored edges illustrate foreign key relations, with arrows pointing from the defining
model to the related model, while gray edges illustrate many-to-many relations.
Different colors signify the different Django apps, and when relations link between
apps the edges are colored with a gradient.Hovering over a model, gives a pop-up that lists the following information:model nameapp labelThe models docstringA list of every field, with its field type and its help text (if defined). Unique fields have their name underlined.This was build with the sauce:SPAGHETTI_SAUCE={'apps':['auth','notifications','reversion'],'show_fields':False,}A complex live-demoTo see a complex example, wheredjango-spaghetti-and-meatballsreally shines,
checkout the live version built for theAristotle Metadata RegistryTesting and developingI like keeping my development environments isolated in docker. You can too. If you want to installpoetrylocally, you can skip this bit.Build a container with Pythong and Poetry installed -docker build . -t spaghettiRun a container for developingdocker run -v “$(realpath .)”:/site -w /site -p 8000:8000 -it –rm spaghetti bashInstall the dependencies -poetry installOpen a poetry shell -poetry shellRun the server -django-admin runserver 0.0.0.0:8000If you navigate to127.0.0.1:8000should should see the demo app.
Package: django-spam
django-spamInspired by this Nick Craver tweethttps://twitter.com/nick_craver/status/720062942960623616We all hate bots, lets admit it. Especially the ones that try to gain access to our most secret endpoints. Well we have an easy
solution for your django application. django_spam simply adds common admin urls to url conf so when bots (or human
for that matter) try and access them, they will get redirected...Django 2.0Django 2.1Django 2.2Django 3.0Django 3.1Django 3.2Python 3.4:heavy_check_mark:Python 3.5:heavy_check_mark::heavy_check_mark::heavy_check_mark:Python 3.6:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:Python 3.7:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:Python 3.8:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:Python 3.9:heavy_check_mark::heavy_check_mark::heavy_check_mark:Installation / Usagepipinstalldjango-spamAdd to apps list:INSTALLED_APPS=['...','django_spam','...']django_spam ships with some default endpoints bots might try to hit. If you would like to add extra routes, simply add
aSPAM_ROUTESvariable to your settings file that contains a list of extra endpoints you would like
to add.no leading slashesSPAM_ROUTES=['admin.php','admin/login.php','administrator/index.php','index.php','...',]Includedjango_spam.urlsto root url file:'...'path('',include('django_spam.urls')),'...',If for some odd reason you need to exclude routes, defineEXCLUDED_ROUTESin settings.no leading slashesEXCLUDED_ROUTES=['admin.php','index.php']DemoSeehereDevelopmentThis project usesPoetryto manage dev environment.  Once installed:Clone andcdinto repoinstall packages withpoetry installblackpoetry run black .flake8poetry run flake8testpoetry run coverage run --source=django_spam setup.py test
Package: django-spambayes
Django-SpamBayes includes a few utility apps for Django that offer an easy to
use interface to the SpamBayes statistical anti-spam filter allowing filtering
and moderation (with training) of comments, contact forms and other publicly
submitted data.Currently, two applications are available: DjangoBayes, which wraps the Django
model and provides the SpamBayes API; and CommentBayes, which is an add-on to
Django’scontrib.commentsapplication and provides filtering and moderation
of comments through signals.
Package: django-spaminspector
Django’s genetic spam inspector library via AkismetInstallsudo pip install django-spaminspectororsudo pip install git+git://github.com/lambdalisue/django-spaminspector.git#egg=django-spaminspectorHow to UseFirst, you need to specifiedSPAMINSPECTOR_AKISMET_KEYonsettings.pyAddspaminspectortoINSTALLED_APPSonsettings.pyAddspaminspector.middleware.SpamInspectionMiddlewaretoMIDDLEWARE_CLASSESonsettings.pyAdd view which you want to inspect toSPAMINSPECTOR_VIEWSThe code below is a profile for django’s comment framework:SPAMINSPECTOR_VIEWS = (
    ('django.contrib.comments.views.comments.post_comment', {
        'comment_type': 'comment',
        'comment_author': lambda request: request.POST.get('name', ""),
        'comment_author_email': lambda request: request.POST.get('email', ""),
        'comment_author_url': lambda request: request.POST.get('url', ""),
        'comment_contents': lambda request: request.POST.get('comment', ""),
    }),
)SettingsSPAMINSPECTOR_VIEWSthe list of view and inspection_profile. default settings is for django comment framework.SPAMINSPECTOR_AKISMET_KEYthe api key of Akismet of your url.SPAMINSPECTOR_SPAM_TEMPLATEan template uri. this template is used to show when comment is detected as spam. (optional)