Saravanan666/pypi-org huggingface dataset:
Package: django-silly-auth
Django Silly AuthWhy one more authentication system for Django and DRF? again !I've used a few ones, and did not find the one that behaves the way I want,
efficient, but flexible, I wanted to gain som time, and get what I need straight to the point.The aim of DSA it to provide a good-enough-to-go authentication out of the box, but still remains highly
modular through its SILLY_AUTH config insettings.py, so it is always possible to improve your
authentication when you have the time for it.DRF and Django Classic supportedDSA works as well with both DRF and Classic, just use differents simple settings, and you're done.WIKI documentationRead this FIRST:coffee:If you find this package usefull, consider buying me a coffeeChangelog1.1.3: USE_I18N = False crash fixed1.1.0: login improved: returns 'auth_token', errors are normalized.1.0.5: test coverage: 75 %1.0.1:i18nfr + en
Package: django-silly-search
# django-silly-searchSimple django-app for search by Q-expressions.[![Build Status](https://travis-ci.org/Egregors/django-silly-search.svg?branch=master)](https://travis-ci.org/Egregors/django-silly-search)If you need the simple way to search, without full-text,morphology features, this app may be useful. But, if you need search for morecomplicated case, you should use something like [Haystack](http://haystacksearch.org/)## Features* Search for one or few models* Search for multiple fields## InstallClone this repo and install from the source:```git clone https://github.com/Egregors/django-silly-search.gitcd django-silly-searchpip install -e .```or just use PyPI```pip install django-silly-search```## How to useThe app provides a single function:```from silly_search import q_search# q_search(models, fields, q) -> list of ModelBase instances```The functions takes required arguments:`models` – Models for search. Should be instance of `ModelBase` (regular Model)or `list` of `ModelBase` instances`fields` – Fields for search. Should be `str` or `list` of `str` (just name of models field)`q` – phrase for search. Should be an `str`As result, you'll get list of ModelBase instances.Keep in mind, if you use it to search for few different models, you'll probably getlist of instances different ModelBase class heirs.## ExampleLet's say you have Models:```class Article(models.Model):title = models.CharField(max_length=128)description = models.CharField(max_length=255)text = models.TextField()class News(models.Model):pub_date = models.DateTimeField(auto_now_add=True)title = models.CharField(max_length=128)text = models.TextField()Z```and you want to make search on these models. So, you can search for one model and one field:```q_search(Article, 'title', q='spam')```or for one models, but few fields:```q_search(Article, fields=['title', 'text'], q='spam')```or for few models and few fields:```q_search(models=[Article, News], fields=['title', 'description', 'text'], q='spam')```## ContributingBug reports, bug fixes, and new features are always welcome.Please open issues, and submit pull requests for any new code.
Package: django-simple-account
RequirementsPython 3.6+A supported version of Django (currently 3.x)Getting ItYou can get Django simple account by using pip:$ pip install django-simple-accountIf you want to install it from source, grab the git repository from GitHub and run setup.py:$ git clone git://github.com/kostya-ten/django_simple_account.git
$ cd django_simple_account
$ python setup.py installInstallationTo enabledjango_simple_accountin your project you need to add it toINSTALLED_APPSin your projectssettings.pyINSTALLED_APPS=(# ...'django_simple_account',# ...)Enablecontext_processorsTEMPLATES=[{'BACKEND':'django.template.backends.django.DjangoTemplates','DIRS':[],'APP_DIRS':True,'OPTIONS':{'context_processors':[# ....'django_simple_account.context_processors.settings',],},},]Addurls.pyin projecturlpatterns=[# ...path('accounts/',include('django_simple_account.urls')),]
Package: django-simple-address
Simple-Address is a simple Django app to save US addresses (it can
potentially be used for others). It does not provide a front end.
The intent of this is to be used on the admin site for invoicing
purposes (and potentially others).Quick startPre-requisite:Make sure django-localflavor is installed and added to your INSTALLED_APPSInstall with pip install django-simple-address
Or clone (or download) the repository and run python setup.py install to
install the app (preferably in virtualenv).Add “simple-address” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'address',
]Runpython manage.py migrateto create the address models.Start the development server and visithttp://127.0.0.1:8000/admin/to create addresses (you’ll need the Admin app enabled).TODO: Add testing and frontend access.
Package: django-simple-admin-overlay
# Django Simple Admin Overlay**Lightweight Django app which displays simple overlay with admin links on the frontend pages.**Django Simple Admin Overlay replaces the need to manually append `/admin` to the browser's URL bar or to bookmark the administration link during the development of Django projects.Version: 0.2# Screenshots### Position: top, state: open![Top Open Toolbar](docs/img/django_simple_admin_overlay_top_open.png?raw=true "Top Open Toolbar")### Position: top, state: closed![Top Closed Toolbar](docs/img/django_simple_admin_overlay_top_closed.png?raw=true "Top Closed Toolbar")# Requirements* Python (3.5)* Django (1.10)Currently tested only on the above noted versions of Python and Django. Will test further with older versions and update the list.# InstallationInstall using `pip`pip install django-simple-admin-overlayAdd `'simple_admin_overlay'` to your `INSTALLED_APPS` settingINSTALLED_APPS = (...'simple_admin_overlay',)Enable `simple_admin_overlay` middlewareMIDDLEWARE = [...'simple_admin_overlay.middleware.SimpleAdminOverlayMiddleware',]# ConfigurationYou can change a limited number of options by adding `SIMPLE_ADMIN_OVERLAY_CONFIG` dictionary to your `settings.py`.Default values are:SIMPLE_ADMIN_OVERLAY_CONFIG = {'OVERLAY_POSITION': 'top','DEFAULT_STATE': 'open','SHOW_APPS_ONLY': False,'EXCLUDE_APPS': [],'EXCLUDE_MODELS': {},}#### `OVERLAY_POSITION (default='top')`Defines the display positioning of the fixed overlay.Available values: `top`, `right`, `bottom`, `left`#### `DEFAULT_STATE (default='open')`Defines the default state of the overlay, i.e. will it be shown or hidden on page load.Available values: `open`, `closed`#### `SHOW_APPS_ONLY (default=False)`If set to `True` only the application links will be shown, i.e. model links will be hidden.#### `EXCLUDE_APPS (default=[])`Applications defined within this list will not be listed in the overlay. Use the same application name format as used in the `INSTALLED_APPS` setting.#### `EXCLUDE_APPS (default={})`Models defined within this dictionary will not be listed in the overlay. Use the same model name format as the name of the classes within `models.py`.Example:EXCLUDE_MODELS': {'spam_app': ['spamAppModel', 'AnotherSpamAppModel'],'eggs_app': ['EggsAppModel'],}# Common issuesMake sure that you're logged in as an authenticated user and have access to the admin interface, i.e. that your `User` instance has `is_authenticated=True` and `is_staff=True`# To-do list- Add `DEVELOPMENT_MODE` option which would depend on the `DEBUG` setting- Persist toolbar state (open, closed) via cookie or local storage
Package: django-simple-affiliate
# Simple Affiliate System for DjangoThis is a very simple library that can be used to provide affiliate links in your django application.It is intentionally very lightweight, allowing your application to do whatever it wants with the data.The project is very loosely inspired by the [django-affiliate](https://github.com/st4lk/django-affiliate) library,though seeks to provide a lighter-weight way to provide the core set of functionality without requiring theuse of any additional data models.If you are looking for a more heavyweight/comprehensive solution you may be better off with[django-affiliate](https://github.com/st4lk/django-affiliate).## How it WorksYou give a code to each partner you want to send links to your application.They choose a link that includes their code in an `aid` parameter in the URL. E.g.`http://example.com/?aid=12345`This code is saved in the django session using a middleware, which also adds the id to the requestas `request.affiliate_id` (note: the ID will also be added if there was no URL param but an id was foundalready in the session).Then you can use whatever custom processing logic you want on the `request.affiliate_id` throughout therest of your code.## Requirements- python (only tested on 3.5 but should work in 2.7)- django (only tested in 1.11 but might work with older versions)## Quick start1. Install this package to your python distribution`pip install django-affiliate`2. Add `'simple_affiliate.middleware.affiliate_middleware'` to `MIDDLEWARE`:```pythonMIDDLEWARE = (# ...'simple_affiliate.middleware.affiliate_middleware',)```3. Reward / track affiliate```pythonif request.affiliate_id and made_some_cash(request):pay_affiliate_by_id(request.affiliate_id, dollar_value(request)```## Project Todos- [] Add / document expiration timeout functionality- [] Add tests
Package: django-simple-analytics
Django Simple AnalyticsSimple analytics is a very simple package to track requests done to the website and store them in database.InstallationFrom PYPi usingpip:pip install django-simple-analyticsUsageIn order to install the package add the following line toINSTALLED_APPSINSTALLED_APPS=[..."simple_analytics",]This will make the model available for you to call and query. To enable the middleware, add this at the bottom of the middleware list:MIDDLEWARE=[..."simple_analytics.middleware.page_counts",]Then, you need to run migrations, finally:./manage.py migrateTo actually create the table in the database.Now every request done to the django website will be recorded in the database with the following fields:Date: The date pf the request.Page: The path of the request.Method: The verb used to request the page.Whether the page exists or not.Origin: If the header exists in the requst, where the request originated.User: The user who performed the request. If the user is not authenticated, it will show as AnonymousUser.view_count: The number of requests to that page, per date and per method used.LicenceThis package is distributed underMIT Licence.
Package: django-simpleapi
django-simpleapi is an MIT Licensed django app, written in Python, for developers.How many times have you wanted to create a simple JSON api in Django.
I mean simple. There are great tools out their like * and * but sometimes
you just want to send back some JSON.This app makes it super simple to do that.fromsimpleapiimportapi_handler@api_handlerdefget_some_yak(request):return{'yak':'yummm'}urlpatterns=patterns('',url(r'^get/some/yak$',get_some_yak),)curlhttp://localhost:8000/get/some/yak{"data":{"yak":"yummm"},"meta":{"code":200}}FeaturesA Simple API for DjangoEasy execption handling, creationEasy addition to metaInstallationTo install Requests, simply:$pipinstalldjango-simpleapiDocumentationThis easyiest way to get started is to use theapi_handlerdecorator.fromsimpleapiimportapi_handler@api_handlerdefget_some_yak(request):return{'yak':'yummm'}Any view function that returns a dict object will work with this interface.Next, often in APIs you need to fail for some reason. Validation, missing params, you name it. There is an easy way to make that happenSimpleHttpExceptionfromsimpleapiimportapi_handler,SimpleHttpException@api_handlerdefget_some_yak(request):required_param=request.GET.get('required_param')ifrequired_paramisNone:raiseSimpleHttpException("Missing required_param",'missing-required-param',400)return{'yak':'yummm'}Now when you request this view and forget to pass required_param you would see something like this.curlhttp://localhost:8000/get/some/yak{"meta":{"code":400,"error_message":"Missing required_param","error_slug":"missing-required-param"}}Not only will the HTTP Status code be in the meta response, it will also be the HTTP Code sent back. Error slug is helpfull in resolving exceptions progrmattically. It’s mucher easier then relying on string grepping to figure out what went wrong.Finally, you might want to add you own information to the meta part of the envelope. This would helpfull for passing information like pagination information.fromsimpleapiimportapi_handler@api_handlerdefget_some_yak(request):request.META['_simple_api_meta']['yak_count']=1return{'yak':'yummm'}The response would now look something like this.curlhttp://localhost:8000/get/some/yak{"data":{"yak":"yummm"},"meta":{"code":200,"yak_counter":1}}
Package: django-simple-api
Language: English |ChineseDjango Simple APIA non-intrusive component that can help you quickly create APIs.Quick StartInstallDownload and install from github:pip install django-simple-apiConfigureAdd django-simple-api to yourINSTALLED_APPSin settings:INSTALLED_APPS=[...,"django_simple_api",]Register the middleware to yourMIDDLEWAREin settings:MIDDLEWARE=[...,"django_simple_api.middleware.SimpleApiMiddleware",]Add the url ofdjango-simple-apito your urls.py:# urls.pyfromdjango.urlsimportinclude,pathfromdjango.confimportsettings# Your urlsurlpatterns=[...]# Simple API urls, should only run in a test environment.ifsettings.DEBUG:urlpatterns+=[# generate documentationpath("docs/",include("django_simple_api.urls"))]Complete the first exampleDefine your url:# your urls.pyfromdjango.urlsimportpathfromyourviewsimportJustTesturlpatterns=[...,path("/path/<int:id>/",JustTest.as_view()),]Define your view:# your views.pyfromdjango.viewsimportViewfromdjango.http.responseimportHttpResponsefromdjango_simple_apiimportQueryclassJustTest(View):defget(self,request,id:int=Query()):returnHttpResponse(id)⚠️ To generate the document, you must declare the parameters according to the  rules ofSimple API(like the example above).ClickDeclare parametersto see how to declare parameters.Access interface documentAfter the above configuration, you can start your server and access the interface documentation now.If your service is running locally, you can visithttp://127.0.0.1:8000/docs/to view
your documentation.MoreFor more tutorials, seeDjango Simple API.
Package: django-simple-api-key
==============Simple Api Key==============Simple Api Key is a simple Django app to provide users api keys.  A decorator is provided for requiringthe api_key and api_username in an HTTP Request.  This should only be used with secure connections, forexample when using SSL.Quick start-----------1. Add "simple_api_key" to your INSTALLED_APPS setting like this::INSTALLED_APPS = (...'simple_api_key',)2. This app uses south to manage database migrations.Run `python manage.py migrate` to create the simple_api_key models.
Package: django-simple-api-proxy
Django Simple API ProxyThis is a simple tool for proxying any APIs easily on your Django server.You can use it as middleware to make a layer for user authorization or something.Installationpipinstalldjango-simple-api-proxyCheck it inPypi.Quick StartAdddjango_simple_api_proxyto yourINSTALLED_APPSinsettings.pylike this:INSTALLED_APPS=[...'django_simple_api_proxy',]Add APP settings to yoursettings.pylike this:TARGET_API_URL='https://httpbin.org'PROXY_ROUTE_PATH='my_test_route'PROXY_TARGET_PATH='get'Include thedjango_simple_api_proxyURL settings in your projecturls.pylike this:fromdjango.confimportsettingsfromdjango.urlsimportincludeurlpatterns+=[path(settings.PROXY_ROUTE_PATH,include('django_simple_api_proxy.urls'))]Test on your server.pythonmanage.pyrunserverHere's an example you success proxy an API by visit the following URLs.http://127.0.0.1:8000/my_test_route/http://127.0.0.1:8000/my_test_routeAnd the result will be as below.[06/Sep/2022 01:26:04] "GET /my_test_route/ HTTP/1.1" 200 314
2022-09-06 01:26:06.338 | DEBUG    | django_simple_api_proxy.views:get:73 - ----- Proxy GET
2022-09-06 01:26:06.339 | DEBUG    | django_simple_api_proxy.views:get_proxy_path:37 - URL: /get
2022-09-06 01:26:06.340 | DEBUG    | django_simple_api_proxy.views:update_payload:49 - Username: #anonymous{"args":{"username":"#anonymous"},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Host":"httpbin.org","User-Agent":"python-requests/2.27.1","X-Amzn-Trace-Id":"Root=1-6316360c-2308560261599de4071127ac"},"origin":"xxx.xxx.xxx.xxx","url":"https://httpbin.org/get?username=%23anonymous"}But when you visithttp://127.0.0.1:8000/my_test_route/123, you'll get error.Cause this URL is not found on target API server.So, this proxy server will return this for you.{"status":"error"}UsageAfter the quick start, you may want to change some methods with your API server like making an authorization.You can do it with inheriting theAPIProxyclass.Here is an example:importrequestsfromrest_framework.authenticationimportSessionAuthenticationfromrest_framework_simplejwt.authenticationimportJWTAuthenticationfromrest_framework.permissionsimportIsAuthenticatedfromdjango_simple_api_proxy.viewsimportAPIProxyclassMyAPIProxy(APIProxy):# give custom authenticationauthentication_classes=[SessionAuthentication,JWTAuthentication]# give custom permissionpermission_classes=[IsAuthenticated]defget(self,request,*args,**kwargs):"""Get."""# your new `GET` logic herelogger.debug("----- Proxy GET Heyyaya")response={"status":"default error!!"}try:params=dict(request.GET)path=self.get_proxy_path(request)params=self.update_payload(request,params)middle_resp_=self.send_request("GET",path,params=params)response=middle_resp_.json()exceptExceptionase:print('yooooo error occurs!!')print(e)returnself.response(response)MoreThere is an example project you can check in./example.
Package: django-simple-async-jobs
Simple async jobs is a Django app that provides you a simple way
for running periodic and one off jobs using django management commands.Installationpip installdjango-simple-async-jobsQuick startAdd “simple_jobs” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'simple_jobs',
]Setup the following settings:JOB_POLLER_TIMEOUT_BEFORE_KILLED = 60

DEFAULT_LOGGER_NAME = "jobs"
PERIODIC_JOBS_LOGGER_NAME = "periodic_jobs"
ONE_OFF_JOBS_LOGGER_NAME = "one_off_jobs"

DEFAULT_MAX_ONE_OFF_JOBS_RUNS_PER_LIFE = 10
DEFAULT_MAX_PERIODIC_JOBS_RUNS_PER_LIFE = 50

DEFAULT_MAX_JOB_RETRIES = 6
DEFAULT_JOB_RETRY_SECONDS_INTERVAL = 900Runpython manage.py migrateto create the jobs models.Start the development server and visithttp://127.0.0.1:8000/admin/to create a Job (you’ll need the Admin app enabled).Run thepython manage.py one_off_job_pollerorpython manage.py periodic_job_poller.It’s recommended to use one of the django management commands as CMD for docker container in docker-compose config with parameter restart=always.
Example:worker-one-off-jobs:
  build: .
  container_name: "worker-one-off"
  restart: "always"
  command: python manage.py one_off_job_pollerThe lifetime of container consists of the following:1) retrieve jobs
2) execute jobs until the limit is hit
3) sleep for time specified in settings
4) exitOnce container is dead it will be launched again by docker-compose.
Package: django-simple-attachments
Django Simple Attachments基于Django的图片储存模块Requirementssorl-thumbnail生成缓存图片django-taggit图片标签djangorestframeworkAPIdjango-extra-fieldsbase64字段上传Getting StartedInstall Packages$ pip install sorl-thumbnail
$ pip install django-taggit
$ pip install django-extra-fields
$ pip install djangorestframework
$ pip install django-simple-attachmentsUpdatesettings.pyINSTALLED_APPS = [
    ...
    'sorl.thumbnail',
    'taggit',
    'rest_framework',
    'attachments',
    ...
]Updateurls.pyfrom attachments.views import media_view

urlpatterns = [
    ...
    path('api/attachments/', include('attachments.urls')),
    re_path(r'^media/attachments/(?P<path>.*)(/?)?', media_view),
    ...
]URL使用支持url中对图片进行裁剪等操作, 模仿unslash<img src="/media/attachments/0001.png?width=100&height=100" />参数说明详细缩略图生成说明请参考Pillowwidth, 图片最大宽度height, 图片最大高度crop, 裁剪形式quality, 质量FieldsImagePickerField单张图片选择字段, 需使用webpack打包js文件from attachments.fields import ImagePickerField

class Brand(models.Model):
    name = models.CharField(max_length=200)
    logo = ImagePickerField(blank=True, null=True)MultipleImageField多张图片选择字段, 需使用webpack打包js文件, 支持拖拽排序, ** 字段基于postgres的ArrayField, 所以必须使用postgres数据库 **from attachments.fields import MultipleImageField

class Product(models.Model):
    name = models.CharField(max_length=200)
    images = MultipleImageField(size=4, blank=True, default=list)RichTextField基于tinymce的富文本编辑器, 支持图片上传使用前请下载tinymce$ cd static
$ bower install tinymce使用from attachments.fields import RichTextField

class Blog(models.Model):
    title = models.CharField(max_length=200)
    content = RichTextField(blank=True, null=True)Webpackmodule.exports={entry:{image_picker:'./attachments/components/image_picker.js',multiple_image:'./attachments/components/multiple_image.js'},output:{path:path.resolve('./static/dist/'),filename:'[name].bundle.js'},module:{rules:[{test:/\.js$/,exclude:/node_modules/,use:{loader:'babel-loader',options:{presets:[['@babel/preset-env',{'targets':{'node':10}}],'@babel/preset-react']}}}]},}Next实时图片裁剪搜索标签筛选删除权限图片自动标签实时图片格式转换自动清理Version0.2.0优化图片选择操作, 增加右侧实时查看并编辑图片基础信息, 增加搜索, 标签筛选0.1.0增加fields功能, 增加实时编辑功能