Saravanan666/pypi-org huggingface dataset:
Package: django-simplesearch
django-simplesearch============A reusable [Django](http://www.djangoproject.com/) application for simple searching, based on [Julien Phalip's original code](http://julienphalip.com/post/2825034077/adding-search-to-a-django-site-in-a-snap>).How it Works------------A string of search terms are passed to the `get_query` function, along with a list of the model fields to search. These terms are normalized by `normalize_query`, which splits the query string into individual keyword, keeping quoted words together and removing [stop words](https://en.wikipedia.org/wiki/Stop_words). The `get_query` function then returns a [Q object](https://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects) which may be used to search the given fields for the given term.Installation------------django-simplesearch is available on PyPI and can be installed with PIP.pip install django-simplesearchAlternatively, you may download the source and install it.python setup.py installSetup-----Add `simplesearch` to your `settings.INSTALLED_APPS`.Usage-----django-simplesearch was created to search blog posts. To search a model `Post` in the fields `title` and `body` based on a search query submitted by a form to HTTP GET, you might do something like this:if 'q' in request.GET:query_string = request.GET['q']entry_query = get_query(query_string, ['title', 'body'])results = Post.objects.published().filter(entry_query).distinct()In this case, the `Post` objects that matched the search query is stored within `results`.
Package: django-simple-search
Django simple search provides the same functionality and convenience
thatsearch_fieldsdoes in the django admin.Seehttp://gregbrown.co.nz/code/django-simple-search/for more details.InstallationDownload the source fromhttps://pypi.python.org/pypi/django-simple-search/and runpython setup.py install, or:> pip install django-simple-searchDjango 1.8 or higher is required.Quick startfrom simple_search import search_filter
from .models import MyModel

query = 'test'
search_fields = ['^title', 'description', '=id']
f = search_filter(search_fields, query)
filtered = MyModel.objects.filter(f)For convenience you can create a search form class via the provided
factory:from .models import MyModel
from simple_search import search_form_factory

SearchForm = search_form_factory(MyModel.objects.all(),
                                 ['^title', 'description'])Referencesimple_search.search_filter(search_fields, query)Given a list ofsearch_fieldsto search on and a query, return amodels.Qobject which can be used to filter a queryset.search_fieldsbehaves exactly like the django adminsearch_fieldsoption. Example:search_fields = [
    # match from the start of the title field
    '^title',

    # match anywhere within the description field
    'description',

    # match from the start of the related category's title field
    '^category__title',

    # exact match on object id
    '=id'
]simple_search.search_form_factory(queryset, search_fields)Create a search form class which will filterquerysetaccording tosearch_fieldsand the form fieldq. Example:# forms.py
from .models import MyModel
from simple_search import search_form_factory

SearchForm = search_form_factory(MyModel.objects.all(),
                                 ['^title', 'description'])

# views.py
from django.shortcuts import render
from .forms import SearchForm

@render('search.html')
def search(request):
    form = SearchForm(request.GET or {})
    if form.is_valid():
        results = form.get_queryset()
    else:
        results = MyModel.objects.none()

    return {
        'form': form,
        'results': results,
    }Running testsUse tox (https://pypi.python.org/pypi/tox):> pip install tox
> cd path-to/django-simple-search
> tox
Package: django-simple-select2
django-simple-select2This simple django app enables users to do a few tweaks toDjango's built-in autocompletefeature.Installationpipinstalldjango-simple-select2Usagemodels.pyclassPublication(models.Model):name=models.CharField(max_length=100)def__str__(self):returnself.nameclassReporter(models.Model):full_name=models.CharField(max_length=50)email=models.EmailField()def__str__(self):returnself.full_nameclassArticle(models.Model):headline=models.CharField(max_length=100)pub_date=models.DateField()publications=models.ManyToManyField(Publication)reporter=models.ForeignKey(Reporter,on_delete=models.CASCADE)def__str__(self):returnself.headlineadmin.pyfromdjango.contribimportadminfrom.modelsimportArticlefromsimple_select2importSelect2Admin,AutoCompleteSelect2,AutoCompleteSelect2MultipleclassArticleModelAdmin(Select2Admin,admin.ModelAdmin):extra={'publications':AutoCompleteSelect2Multiple(url='select2-publication-list'),'reporter':AutoCompleteSelect2(url='select2-reporter-list')}admin.site.register(Article,ArticleModelAdmin)views.pyfromsimple_select2importAutoCompleteBaseViewfrom.modelsimportReporter,PublicationclassReporterView(AutoCompleteBaseView):model=Reportersearch_fields=('full_name','email')classPublicationView(AutoCompleteBaseView):model=Publicationsearch_fields=('name',)#urls.pyfromdjango.urlsimportpathfrom.viewsimportReporterView,PublicationViewurlpatterns=[path('reporter/',ReporterView.as_view(),name='select2-reporter-list'),path('publication/',PublicationView.as_view(),name='select2-publication-list'),...]SettingsSIMPLE_SELECT2_THEMESets the project-wide defaultthemeto be used by Select2 for all widgets inheriting fromAutoCompleteSelect2Mixin.
Can be overridden per widget using parametertheme.Supported values are:None(or unset) will use theme"admin-autocomplete". This is the default."admin-autocomplete"uses the theme of Django Admin."bootstrap4"uses a bundled copy of Takashi Kanemoto'sselect2-bootstrap4-theme.
Please note that this theme requires that youpull in Bootstrap 4 CSS and JavaScript assetsin your templates somewhere yourself."classic"uses the old classic theme of upstream Select2. Not much different from theme"admin-autocomplete"."default"uses the default upstream theme of Select2.SIMPLE_SELECT2_WIDTHSets the project-wide defaultwidthto be used by Select2 for all widgets inheriting fromAutoCompleteSelect2Mixin.
Can be overridden per widget using parameterwidth.For supported values, please check theofficial documentation of parameterwidthof Select2.
By default, django-simple-select2 does not enforce any width on Select2.DemoYou will find a simple demo app here,simple-select2-demo
Package: django-simple-settings
Supported types: bool, float, int, str.InstallationInstall a package.$pipinstalldjango-simple-settingsAdd “simple_settings” to your INSTALLED_APPS setting:INSTALLED_APPS=(...'simple_settings',)Add context processor if you would like:TEMPLATE_CONTEXT_PROCESSORS=('...','simple_settings.context_processors.simple_settings',)Create models:$pythonmanage.pymigrate||pythonmanage.pysyncdbUsageGet settings:fromsimple_settingsimportsettingsprintsettings.get('is_feature_available')printsettings.get('is_feature_available',default=False)printsettings['is_feature_available']Get all settings as dict:printsettings.all()Get settings in template if you include context processor:{{simple_settings.is_feature_available}}Set settings:settings.set('is_feature_available',True)settings.set('pi',3.14159265359)settings.set('answer',42)settings.set('metallica','Yeah!')Delete settings:settings.delete('is_feature_available')SettingsDefault application settings can be overriden in settings.py:SIMPLE_SETTINGS_CACHE_TIMEOUT=60*60*24#  default cache timeout is one daySIMPLE_SETTINGS_CACHE_ALIAS='default'# default cache backendRequirementsPython 2.6, 2.7, 3.3Django 1.3+
Package: django-simple-social
Introduction============The Django-Simple-Social library downloads a collection of social network libraries andprovides automatic backends, and interfaces for working with them. The goal of this project is to simplify working with third-party apps and authorization tools, such as Facebook, LinkedIn, and Twitter.Make sure you also read up on Djagno-Social-User, as it provides the foundational infrastructure for this library:https://github.com/mattsnider/Djagno-Social-UserKeep in mind this library is still under development, so there may be breaking changes. I'll update the documentation anytime that happens, but feel free to contact me as well.All functions and classes are documented inline. If you have additional questions, I can be reached on github or at admin@mattsnider.com.Getting started===============Standard stuff applies to install. Use PIP to install with dependencies:pip install django-simple-socialOr install from the command line:python setup.py installDependencies============There many dependencies for this library, because it requires APIs for working with each social network:django 1.3 or greaterDjango-Social-UserLinkedIn-API-JSON-ClienttwythonUsage Guide===========Add to both dependencies to your INSTALLED_APPS:INSTALLED_APPS = [...'django_simple_social','django_social_user',...]Update the DB:python manage.py sqlall django_social_user > temp.sqlpython manage.py manage.py dbshell < temp.sqlrm temp.sqlRegister any social network backends you want to use in your settings.py:AUTHENTICATION_BACKENDS = ('django_simple_social.backends.FacebookBackend','django_simple_social.backends.LinkedInBackend','django_simple_social.backends.TwitterBackend',...'django.contrib.auth.backends.ModelBackend')Add any required API keys (backend dependent) to settings.py, here are some examples:FACEBOOK_CONSUMER_KEY = 'asdf' # this is the APP_IDFACEBOOK_CONSUMER_SECRET = 'asdf'LINKED_IN_CONSUMER_KEY = 'asdf'LINKED_IN_CONSUMER_SECRET = 'asdf'TWITTER_CONSUMER_KEY = 'asdf'TWITTER_CONSUMER_SECRET = 'asdf'Run the backend autodiscover in urls.py:import django_simple_social; django_simple_social.autodiscover()Include references to Django-Social-User urls in urls.py:urlpatterns = patterns('',...url(r'^social/', include('django_social_user.urls', namespace='django_social_user')),...(r'^admin/', include(admin.site.urls)),)To begin the oauth process with a social network, expose the following link to an enduser:<a href="{% url 'django_social_user:authenticate' 'facebook' %}">Sign in with Facebook</a><a href="{% url 'django_social_user:authenticate' 'linkedin' %}">Sign in with LinkedIn</a><a href="{% url 'django_social_user:authenticate' 'twitter' %}">Sign in with Twitter</a>Todo====~~1. Support facebook~~2. django_social_user should support South migrations3. Support google4. Support openid5. Better error handling6. Asynchronous/JS driven authentication, instead of browser redirects7. Decouple APIs from this infrastructure and allow API customizatio
Package: django-simple-spam-blocker
Django Simple Spam Blocker is blocking spam by regular expression.Filtering the following matters.AuthorContentEmailIPRefererURLUserAgentAnd you can edit regular expression, on Django’s admin site.InstallationAdd thesimplespamblockerdirectory to your Python path.Addsimplespamblockerto yourINSTALLED_APPS.:INSTALLED_APPS = (
    # ...
    'simplespamblocker',
    # ...
)Add the following middleware to yourMIDDLEWARE_CLASSES.:MIDDLEWARE_CLASSES = (
    # ...
    'simplespamblocker.middleware.SpamBlockMiddleware',
    # ...
)Add path which you wanto to block spam toSIMPLESPAMBLOCKER_PROFILESonsettings.py.:SIMPLESPAMBLOCKER_PROFILES = (
    # Sample for django's comment framework
    (r'^/comments/post/$', {
        'method': 'post',
        'author': lambda request: request.POST.get('name', ''),
        'email': lambda request: request.POST.get('email', ''),
        'url': lambda request: request.POST.get('url', ''),
        'content': lambda request: request.POST.get('comment', ''),
    }),
)Run syncdb.:$ python manage.py syncdbNote: When your project use South, run the following command.:$ python manage.py migrate simplespamblockerRun your server, visit admin site and edit regular expression of Option model.SettingsSIMPLESPAMBLOCKER_PROFILESThe list of tuple – regular expression of path and block profile –.SIMPLESPAMBLOCKER_SPAM_TEMPLATEA path of template file which is rendering after blocking spam
This key is generated per Option model.default: ‘simplespamblocker/option/<id>’SIMPLESPAMBLOCKER_LOGGER_NAMEPython’s builtin logger name.
This logger logs at blocking spam.
Default value is None. (inactive)OthersThis project is Inspired bydjango-spaminspector.
Package: django-simple-sql-debug
This application shows the database queriesInstallationInstall sql_debug:pip install django-simple-sql-debugAdd it to yourINSTALLED_APPS:INSTALLED_APPS=[...'sql_debug',...]Add sql_debug’s URL patterns:fromsql_debugimporturlsassql_debug_urlsurlpatterns=[...path('sql_debug/',include(sql_debug_urls)),...]Run migrate:python manage.py migrateSettingsSQL_DEBUG_PATHS_BLACKLIST=['/sql_debug','/admin','/favicon.ico',]# by defaultSQL_DEBUG_MAX_REQUESTS=20# by defaultSQL_DEBUG_BLACKLISTED_PATHSA list of paths that are skipped by the application.SQL_DEBUG_MAX_REQUESTSMaximum number of queries stored in the database.ProductionAdd in production_settings.py# Remove django-sql-debugINSTALLED_APPS.remove('sql_debug')MIDDLEWARE.remove('sql_debug.middleware.SqlDebugMiddleware')Add in urls.pyifsettings.ENV=='local':# or (not settings.DEBUG)urlpatterns+=[path('sql_debug/',include(sql_debug_urls)),]ScreenshotsCreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageHistory0.1.0 (2019-07-30)First release on PyPI.
Package: django-simple-svg
django-simple-svgA simple plugin that adds ansvgtemplate tag to inline your SVGs in your
Django templates.This is an updated version of thisrepoHuge credit goes toMitchel CabuloyInstallationInstall it from pypi.pipinstalldjango-simple-svgAdd`simple_svg` ` ` to your ` ` `INSTALLED_APPS`.INSTALLED_APPS=(...'simple_svg',...)UsageStore your SVGs in folder named`svg`at the root of any of your static file
directories.my_app|--static||--svg||--logo.svg||--check.svg||--cross.svgUse the`svg`template tag.{%loadsvg%}<h1 class="logo">{%svg'logo'class="css-class"height="16"width="16"%}</h1>You can set`SVG_DIRS`to control where to look for your svgs.# settings.pySVG_DIRS=[os.path.join(BASE_DIR,'my-svgs')]SupportThe tests are run against Django 1.8 to 4.1.3 on Python 2.7, 3.4, 3.5, 3.6, 3.8, 3.10, 3.11.LicenseMIT
Package: django-simple-tags
django-simple-tagsCollection of simple django tags and filters.Installpipinstalldjango-simple-tagsInstalled Tags or FiltersTagssprintfstring_formatadmin_urlif_cookieget_cookiehas_cookieif_settingget_settinghas_settingmodel_select_includecallcall_methodreset: reset template variable valueFiltersadd_string_gapadd_string_left_gapadd_string_right_gapget_model_verbose_nameget_model_app_labelget_model_nameget_model_fullnameshow_boolean_iconUtilsget_related_model_field: get model's related model and field by field name.Settingspro/settings.pyINSTALLED_APPS=[...'django_simple_tags',...]Usage{%loaddjango_simple_tags%}{%loaddjango_simple_tags%}<h1>{%sprintf"hello %s""Tom"%}</h1><h1>{%string_format"hi {0}""Tom"%}</h1><h1>{%string_format"hi {name}"name="Tom"%}</h1><h1>{%string_format"{0} + {1} = {result}"34result=7%}</h1><a href="{%admin_urlcat"change"%}">{%admin_urlcat"change"%}</a><h1>{%if_cookierequest"sessionid""sessionid exists..""sessionid NOT exists.."%}</h1><h1>{%get_cookierequest"sessionid"%}</h1><h1>{%has_cookierequest"sessionid"ashas_sessionid%}{%ifhas_sessionid%}sessionid exists..{%else%}sessionid NOT exists..{%endif%}</h1><h1>{%if_cookierequest"xsessionid""xsessionid exists...""xsessionid NOT exists"%}</h1><h1>{%get_cookierequest"xsessionid""None"%}</h1><h1>{%has_cookierequest"xsessionid"ashas_xsessionid%}{%ifhas_xsessionid%}xsessionid exists...{%else%}xsessionid NOT exists...{%endif%}</h1><h1>{%if_setting"DEBUG""settings.DEBUG exists...""settings.DEBUG not exists..."%}</h1><h1>{%get_setting"DEBUG"%}</h1><h1>{%has_setting"DEBUG"ashas_debug%}{%ifhas_debug%}settings.DEBUG exists...{%else%}settings.DEBUG NOT exists...{%endif%}</h1><h1>{%if_setting"NO_DEBUG""settings.NO_DEBUG exists...""settings.NO_DEBUG NOT exists..."%}</h1><h1>{%get_setting"NO_DEBUG"False%}</h1><h1>{%has_setting"NO_DEBUG"ashas_no_debug%}{%ifhas_no_debug%}NO_DEBUG exists...{%else%}settings.NO_DEBUG NOT exists...{%endif%}</h1>{%model_select_includecat"hello.html"%}{%model_select_includecat"world.html"%}{%model_select_includecat"hi.html"%}<h1>{%sprintf"Select%sto view""Category"|add_string_gap:" "%}</h1><h1>{%sprintf"Select%sto view""Category"|add_string_left_gap:" ["|add_string_right_gap:"] "%}</h1><h1>{{model_class|get_model_app_label}}</h1><h1>{{model_class|get_model_name}}</h1><h1>{{model_class|get_model_fullname}}</h1><h1>{{model_class|get_model_verbose_name}}</h1>Releasesv0.1.0 2020/02/23First release.v0.2.0 2020/02/23Fix document.Remove print statements.Add filters: add_string_gap, add_string_left_gap, add_string_right_gap.v0.3.0 2020/03/03Add filters: get_model_app_label, get_model_name, get_model_fullname, get_model_verbose_name.v0.4.0 2020/03/21Add tags: call, call_methodv0.5.0 2020/03/22Add filter: show_boolean_iconv0.6.0 2020/04/27Add tag: resetAdd utils.get_related_model_fieldv0.6.1 2023/09/14Doc update.
Package: django-simpletask
django-simpletaskDjango application provides simple task model, admin, server services and client service.Installpip install django-simpletaskUsagepro/settingsINSTALLED_APPS = [
    'django_db_lock',
    'django_simpletask',
]

DJANGO_SIMPLETASK_ACLKEY = "TsE9Jd3TrUtTA9wjGCLXoDqh891srpyo"Note:Mostly you need a lock service, so we add django_db_lock in INSTALLED_APPS.Set DJANGO_SIMPLETASK_ACLKEY to your own aclkey. It will be used in task executor.app/models.pyfrom django.db import models
from django_simpletask.models import SimpleTask

class Task1(SimpleTask):
    title = models.CharField(max_length=64)

    class Meta:
        permissions = [] + SimpleTask.Meta.permissions

    def do_task_main(self):
        return "done!"

class Task2(SimpleTask):
    title = models.CharField(max_length=64)

    class Meta:
        permissions = [] + SimpleTask.Meta.permissions

    def do_task_main(self):
        return "done!"Note:Write your own task model based on SimpleTask.Add task reset permission.Implement you own do_task_main.app/admin.pyfrom django.contrib import admin
from django_simpletask.admin import SimpleTaskAdmin
from .models import Task1
from .models import Task2


class TaskAdmin(SimpleTaskAdmin, admin.ModelAdmin):
    list_display = ["title"] + SimpleTaskAdmin.list_display


admin.site.register(Task1, TaskAdmin)
admin.site.register(Task2, TaskAdmin)Note:Mostly we don't want to change anything inside task, so we set task fields readonly.task_executor.pyfrom daemon_application.app import DaemonApplication
from django_simpletask.services import SimpleTaskService

class TaskExcutor(DaemonApplication):
    def main(self):
        service = SimpleTaskService("http://127.0.0.1:8000/example/task/services/", aclkey="TsE9Jd3TrUtTA9wjGCLXoDqh891srpyo")
        service.start()
        service.join()

app = TaskExcutor().get_controller()

if __name__ == "__main__":
    app()Note:Add task_executor.py script.Set the server to your own url.Set the aclkey match the DJANGO_SIMPLETASK_ACLKEY setting.Releasev0.1.0First release.Take from django-fastadmin. django-fastadmin should forcus on admin extensions, but NOT abstract models.v0.1.1Add SimpleTask.do_tasks.v0.1.2Add SimpleTask.serve and SimpleTask.serve_forever.v0.1.3Add idle_sleep_time parameter for SimpleTask.serve_forever.v0.1.6Add reset action.Add SimpleTask.force_finish.Add multi-threads serve.v0.2.2Long running service don't use database.Add aclkey check for simpletask apis.v0.2.8Add SimpleTaskServiceProxy and required views.Add get_ready_tasks_queryset to SimpleTaskViews.v0.2.9Add channel params.v0.3.5Bad response handler.Services changed a a lot.v0.3.6Doc update.v0.3.7Fix ugettext problem.
Package: django-simple-task
Django Simple Taskdjango-simple-taskruns background tasks in Django 3 without requiring other services and workers. It runs them in the same event loop as your ASGI application. It is not resilient as a proper task runner such as Celery, but works for some simple tasks and has less overall overheads.GuideInstall the package:pipinstalldjango-simple-taskAdded it to installed apps:# settings.pyINSTALLED_APPS=[...'django_simple_task']Apply ASGI middleware :# asgi.pyfromdjango_simple_taskimportdjango_simple_task_middlwareapplication=django_simple_task_middlware(application)Call a background task in Django view:fromdjango_simple_taskimportdeferdeftask1():time.sleep(1)print("task1 done")asyncdeftask2():awaitasyncio.sleep(1)print("task2 done")defview(requests):defer(task1)defer(task2)returnHttpResponse(b"My View")It is required to run Django with ASGI server.Official DocConfigurationsConcurrency level can be controlled by addingDJANGO_SIMPLE_TASK_WORKERSto settings. Defaults to1.
Package: django-simpletask2-server
django-simpletask2-serverThe server program used with django-simpletask2. After startup, it can automatically process the asynchronous processing tasks generated by django-simpletask2.Installpip install django-simpletask2-serverUsagetest@test django-simpletask2-server % django-simpletask2-server --help
Usage: django-simpletask2-server [OPTIONS] COMMAND [ARGS]...

Options:
  --logfmt TEXT
  --logfile TEXT
  --loglevel TEXT
  --pidfile TEXT                  pidfile file path.
  --workspace TEXT                Set running folder
  --daemon / --no-daemon          Run application in background or in
                                  foreground.
  -c, --config TEXT               Config file path. Application will search
                                  config file if this option is missing. Use
                                  sub-command show-config-fileapaths to get
                                  the searching tactics.
  --error-sleep INTEGER
  --idle-sleep INTEGER
  -t, --threads INTEGER
  --auto-reset-task-interval INTEGER
  --do-auto-reset-task / --no-do-auto-reset-task
  --task-pull-timeout INTEGER
  --task-pull-engine TEXT
  --channel-flags-template TEXT
  --channel-name-strip-regex TEXT
  --channel-name-template TEXT
  --channels TEXT
  -r, --redis TEXT
  -a, --aclkey TEXT
  -s, --server TEXT
  --help                          Show this message and exit.

Commands:
  restart                Restart Daemon application.
  show-config-filepaths  Print out the config searching paths.
  show-configs           Print out the final config items.
  start                  Start daemon application.
  stop                   Stop daemon application.Config itemsserver: Required. Default to:http://127.0.0.1:8000/django-simpletask2/。aclkey: Required. No default value.redis: It is required when task-pull-engine is "redis". The value format likes: redis://:password@redis-server:redis-port/redis-db?decode_responses=True (The option decode_responses=True is required)channels: Required. Default to "default".threads: Required. Default to 1.task-pull-engine Required. Default to "redis". Other options are: api.idle_sleep: Default to 5 seconds.error_sleep: Default to 5 seconds.Other config items like logdevel, logfile, logfmt, workspace, pidfile, daemon and so on, see details ofdaemon-application.Releasesv0.0.8Doc update.v0.0.7Fix --channels option short name conflict problem.v0.0.6First release.