Saravanan666/pypi-org huggingface dataset:
Package: django-client-side
Django client-side dependencies appManage client-side JS / CSS dependencies for your django project.Version: 0.3.1Author: powderflaskSource:https://github.com/powderflask/django-client-sideMIT LicenseOVERVIEW:Maintain client-side dependencies in one place (i.e., not scattered in templates).Provides testable, executable client-side app dependencies set.Template tags used to pull JS / CSS dependencies into templates.Local static resources and/or from CDN.Use any client-side build tools or none - demo app uses npm as JS package manager and build tool.conditional dependencies for different build environmentsDependencies:python 3djangoQuick startpip install https://github.com/powderflask/django-client-side.gitAddclient_sidetoINSTALLED_APPSINSTALLED_APPS = [
    ...
    'client_side',
]define client-side dependency set (see tests.dependencies for example)in settings.py, configureCLIENT_SIDE_DEPENDENCIESsetting:CLIENT_SIDE_DEPENDENCIES = 'myproject.client_side.dependencies.DEPENDENCIES'  # dotted-path to your dependency sets(may be a dotted-path to aDependencySetsobject or specify theDependencySetsobject directly in settings.)Use{% stylesheet <name> %}and{% javascript <name> %}in your templates to pull in sets of dependenciesUpdate your client-side dependency sets any time without ever touching your templates!GuideDefine Client-Side Componentsfrom client_side.component import Component, DependencySets, Script, StylesheetDefine aComponentfor each dependency, with zero or moreScriptelemenets and/or zero or moreStylesheetelements:component = Component(
    Script(url="https://example.com/component.js", sri="sha384-js-sri-here"),
    Stylesheet(url="https://example.com/component.css", sri="sha384-css-sri-here"),
)Swap components for different environments, passstatic=Truefor dependencies loaded fromstaticfiles:lib_common = Component(
    Script(url="lib/common.js" if settings.DEBUG else "lib/common.min.js", static=True),
    Stylesheet(
        url="lib/common.css" if settings.DEBUG else "lib/common.min.css", static=True
    ),
)Group Components into Logical Dependency SetsDefine one or moreDependencySetswith logical component groups:DEPENDENCIES = DependencySets(
    core=(component, lib_common,),
    debug=(debug_toolbar, hijack), 
)Include DependencySets in Templates{% load dependency_tags %}
...
      {% stylesheet 'core' %}
...
      {% javascript 'core' %}
      {% if debug %}
        {% javascript 'debug' %}
      {% endif %}AcknowledgmentsSpecial thanks to BC Hydro,Chartwell,
and allContributorsFor Developers> pip install -r reqirements_dev.txtTests> pytest> toxCode Style> isort> black> flake8VersioningSemantic Versioning> bumpverBuild / Deploy Automationinvoke> invoke -lGitHub Actions(see.github/workflows)
Package: django-client-tracker
# IntroductionClient Tracker is a Django app to keep track of clients visiting your website.
Client IP, and location is fetched using a client-side script. It keeps track of
how long users stay on your site. Users don’t need to login on your site for this
to work. Please make sure that you inform the users that the site uses cookies as
it is required for this application.## PrerequisitesDjango 2.0+## InstallationCopy “clienttracker” application to your project folderAdd “clienttracker” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'clienttracker',
]Include the clienttracker URLconf in your project urls.py like this::path(‘ticker/’, include(‘clienttracker.urls’))Run “python manage.py migrate” to create the clienttracker models.Include tracer.js in base.html at the bottom of the page. If you do not use base.html you will needto include the js in every html file separately.<script src=”{% static ‘js/tracer.js’ %}”></script>Start the development server and visithttp://127.0.0.1:8000/.## Known ProblemsAs of now the data is not represented in any format, it is only saved in database.There is an issue with logging (inside views.py) which was identified when it was put in pythonanywhere.com. Logging was removed from it since.
Package: django-client-whitelist
Django Client WhitelistDjango Client Whitelist is a middleware that restricts access to certain endpoints in a Django app to a predefined list of client hosts. It is a simple and effective solution to improve the security of your application.ProblemIn a production environment, it is crucial to restrict access to API endpoints to only those hosts that are authorized to access them. Unauthorized access can lead to malicious attacks and compromise the security of your Django application.SolutionDjango Client Whitelist provides a solution to this problem by allowing you to create a predefined list of client hosts that are allowed to access the API. With this middleware in place, you can be sure that only authorized hosts can request your API endpoints, making your application more secure.InstallationInstall Django Client Whitelist using pip:pipinstalldjango-client-whitelistaddclient_whitelistto yourINSTALLED_APPS:# settings.pyINSTALLED_APPS=[# ...'client_whitelist',# ...]Add ClientWhitelistMiddleware to your middleware stack:# settings.pyMIDDLEWARE=[# ...'client_whitelist.middleware.ClientWhitelistMiddleware',# ...]UsageDefine thePROTECTED_ENDPOINTSandALLOWED_CLIENT_HOSTSsettings in your settings file:# settings.pyPROTECTED_ENDPOINTS=['/admin/','/api/',]ALLOWED_CLIENT_HOSTS=['example.com','192.168.1.1',]Note: In a development environment, it may be convenient to allows requests from any client host.ALLOWED_CLIENT_HOSTS=['*']However, it is important to note that this should not be used in a production environment as it undermines the security measures provided by Django Client Whitelist. It is recommended to use a predefined list of client hosts that are authorized to access the API in a production environment.Once you have installed and configured Django Client Whitelist, it will start protecting your endpoints immediately. Any requests to a protected endpoint from a client host that is not in the allowed list will result in a 403 Forbidden response.ContributingPull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.LicenseMIT
Package: django-cli-g73
DJANGO CLIDescriptionThis is a small project created with the initial purpose of facilitating, through a single command, the creation of views, templates, models, serializers and basic endpoints for the django web framework together with the django rest framework.
You can see in :Django-CliDjango-Cli in PyPiRequirementspython 3.7+Usagebefore using any command in the package first go to your django project folder and start your virtual environment before user the commandpip install django-cli-g73Install Manuallygit clonehttps://github.com/wdavid73/django-clienter to the folder django-clirun the command :python setup.pyCommands localpython cli/main.py make-viewpython cli/main.py make-templatepython cli/main.py make-modelpython cli/main.py make-serializerpython cli/main.py make-endpointCommandsdjango-cli make-viewdjango-cli make-templatedjango-cli make-modeldjango-cli make-serializerdjango-cli make-endpoint
Package: django-cli-query
Copyright (c) 2009-2014 Dennis Kaarsemaker <dennis@kaarsemaker.net>
A command-line interface to query the Django ORMInstall:python setup.py installAdd cli_query to the INSTALLED_APPLICATIONS setting in your settings.pyUsage: cd your_project_dir; ./manage.py query [options] [filters]The django ORM will be queried with the filters on the commandline. Records
will be separated with newlines, fields with the specified separator
(the default is a comma). Alternatively, a template can be specified which
will be passed the result of the query as the ‘objects’ variableQuery key/value pairs can be prefixed with a ‘!’ or ‘~’ to negate the query.
The __in filter works, use a comma separated string of argumentsYou can also update fields using -u field=value. For every changed object, you
will be prompted to approve the changes.Examples:Display name and assettag of all mc01 servers
%prog query -a servers -m Server name__startswith=mc01 -f name,assettagGet a list of name, ip, mac for all servers where the does not contain .82.
%prog query -a servers -m Interface !ip_address__contains=’.82.’ -f server.name,ip_address,mac_addressUse a template to get the roles, depending on mac address
%prog query -a servers -m Server interface__mac_address=00:17:A4:8D:E6:BC -t ‘{{ objects.0.role_set.all|join:”,” }}’List all eth0/eth1 network interfaces
%prog query -a servers -m Interface name__in=eth0,eth1 -f ip_address,mac_addressUpdate the state of all mc2* servers
$prog query -a servers -m Server name__startswith=mc2 -u status=liveOperators you can filter with are listed onhttps://docs.djangoproject.com/en/dev/ref/models/querysets/#field-lookups
Package: django-clite
django-cliteA CLI tool that handles creating and managing Django projectsdjango-cliteInstallationExtending the CLIDependenciesInteractive DocsTo DoPull requestsLICENSEInstallationInstall viapip:pipinstalldjango-cliteAfter installation, the CLI will expose the binary with the name:django-cliteExtending the CLICurrently, there are two main ways of extending the functionality of the CLI:Adding your own commands/pluginsOverriding the provided resource templatesIncluding your own commandsIf you would like to extend the functionality of this CLI, you can include your ownplugins/commandsby
setting an environment variable:DJANGO_CLITE_PLUGINS. Simply set this variable to the path where your plugins are.Plugin commands are auto-discovered if they are placed under the plugins directory,
but please be sure to do the following for this to work:Name your package and click command the same. That is, a package calledget, for example, should define agetcommand.Place the command definition within the package'smain.pymodule. For example:# get/main.pyimportclick@click.command()@click.pass_contextdefget(ctx):passSub-commands should be added to the top-most command group in the package'smain.pymodule.# get/main.pyimportclick@click.group()# <- group@click.pass_contextdefget(ctx):pass@click.command()@click.pass_contextdeffoo(ctx):passget.add_command(foo)Access your commands via your top-most command group.django-clite get fooNOTE:If you would like to skip a plugin/command from being auto-discovered, simply rename the package by either
prepending or appending any number of underscores (_). Any code contained within the package will be ignored.Overriding the templatesThe flag--templates-dircan be used to configure an additional path wherein the CLI can look for resource templates.
Alternatively, you can use the environment variableDJANGO_CLITE_TEMPLATES_DIRfor the same purpose.Take a look at thetemplate files directoryfor a reference of what files can be overriden. The
paths of the templates you wish to override need to match the provided template. For example, if you wish to override the
model template, which is defined undersrc/cli/template_files/models/model.tpl,
you should define your own model template under your desired directory, i.e/path/to/templates/models/model.tpl.DevelopmentInstall from source:git clone https://github.com/oleoneto/django-clite.git
cd django-clite
pip install --editable .DependenciesCheck outpyproject.tomlfor all installation dependencies.Interactive DocsIn order to maintain consistency in our documentation of all the different commands and features of the CLI,
we've decided to move theREADMEto a series of Jupyter notebooks which you can explore per command under thedocsdirectory.To DoCheck out our open issues.Pull requestsFound a bug? See a typo? Have an idea for new command?
Feel free to submit a pull request with your contributions. They are much welcome and appreciated.LICENSEdjango-cliteisBSD Licensed.
Package: django-cljs-loader
Transparent integration of ClojureScript in a Django project. Currently
supportsLeiningenandFigwheel, which means you
can rely on Figwheel’s auto-refresh features during development.This project is heavily inspired by thedjango-webpack-loaderproject, which has the similar goal of transparently including and using
Webpack bundles in a Django project.The integration with Leiningen is simplistic: information is read from
the Leiningenproject.cljfile to determine which output bundles are
available and where. This means that there is a tight coupling to the
structure of the Leiningen project file – expect things to break if you
have a really exotic project setup!Install$>pipinstalldjango-cljs-loaderUsageExamplesThis repository contains one example application, have a look at that to
see a working setup in action.Simple clock
applicationSome more advanced examples are on the way!SettingsOnly Leiningen projects are supported. With aproject.cljfile
somewhere in your project, you can set thedjango-cljsloader up in
your app settings.It should look something like this:fromedn_format.edn_leximportKeywordBASE_DIR=...# should point to the project rootSTATIC_URL='/static/'CLJS_LOADER={# where to find the Leiningen project file'PROJECT_FILE':os.path.join(BASE_DIR,'project.clj'),# If True, tries to load JS files from the Figwheel dev server.# Set to False in production mode.'FIGWHEEL':True,# Which cljs build (defined in the project.clj file) to use.# Change this for production.'CLJS_BUILD':Keyword('dev'),# The root folder for assets built by Leiningen.# In development mode, this matches the Figwheel root.'ROOT':'assets/public',}# Add the folder where cljsbuild output lands as a source directory for the# staticfiles app. This assumes you are using the staticfiles app.STATICFILES_DIRS=(os.path.join(BASE_DIR,CLJS_LOADER['ROOT']),)Where you put the ClojureScript source files is up to you -assets/cljsis one possibility. See the example projects.Template tagUse therender_bundletemplate tag to hook the compiled
ClojureScript bundle into your application. It will insert ascripttag and call themainfunction you have defined in the Leiningen
project file.{% load render_bundle from cljs_loader %}
...
<body>
  ...
  {% render_bundle %}
</body>DevelopmentOpen a second terminal and runlein figwheel. Alternatively, launch
a REPL and do(fig-start). The JavaScript bundle will be loaded from
the Figwheel development server.ProductionAssuming you have a cljsbuild profile calledprod:$> lein cljsbuild once prodThe compiled bundle that is produced bylein cljsbuildcan be
collected withpython manage.py collectstatic, or whichever your
preferred method of including production assets is.Therender_bundletemplate tag does not need to change.ContributingYou can run the test suite in thetestsfolder with the following
command:$> make test
Package: django-cloak
# django-cloak[![Build Status](https://travis-ci.org/PSU-OIT-ARC/django-cloak.svg?branch=master)](https://travis-ci.org/PSU-OIT-ARC/django-cloak)cloak is an app that allows administrative users to browse the site as a different user. It also includes a management command (`login`) to generate a login link for a particular user.## Installation1. pip install django-cloak1. Add `cloak` to your INSTALLED_APPS setting1. Add `cloak.middleware.CloakMiddleware` to your `MIDDLEWARE_CLASSES` (after session and auth middleware)1. Add `url(r'^cloak/', include('cloak.urls'))` to your urls.py## RequirementsSessionMiddleware and django.contrib.auth## Usages### Command line./manage.py login user_identifierwhere `user_identifier` is the value of the USERNAME_FIELD field of your user model.This will spit out a path you can append to your site's base URL, which will automatically log you in as that user.**Note**: The backend associated with the user (i.e. the value of `user.backend`) will be the first backend listed in AUTHENTICATION_BACKENDS.Without a user_identifier, the command will try to find a user with `is_superuser=True`, or `is_staff=True`, or any user, in that order.### TemplatesTo cloak as a user, create a form that POSTs to the cloaking URL. The URL can either contain the PK of the user, or you can pass the PK as a POST parameter:<form method="post" action="{% url 'cloak' user.pk %}">{% csrf_token %}<input type="submit" name="submit" value="Cloak" /></form>or<form method="post" action="{% url 'cloak' %}">{% csrf_token %}<select name="pk"><option value="1">Matt</option><option value="2">Thom</option><option value="3">Brandon</option></select><input type="submit" name="submit" value="Cloak" /></form>## Other InformationYou can tell if a user is cloaked by checking the "is_cloaked" attribute on the user object (this flag is set in the middleware).When determining if a user is allowed to cloak, the cloak view tries to call a `request.user.can_cloak_as(other_user)` method. If no such method is defined, the code falls back on the `request.user.is_staff` flag.
Package: django-cloneable
django-cloneabledjango-cloneableprovides aCloneableMixinclass that has aclone()method. It can be mixed into any Django model.Theclone()method must be called on an already saved instance (one that
haspkset). It then returns a new instance of the model that has all the
same field values as the original instance, but it will be a seperate database
row with a distinct primary key.An example:fromdjango.dbimportmodelsfromdjango_cloneableimportCloneableMixinclassIngredient(CloneableMixin,models.Model):name=models.CharField(max_length=50)is_spicy=models.BooleanField(default=False)classPizza(CloneableMixin,models.Model):name=models.CharField(max_length=50)price=models.IntegerField()ingredients=models.ManyToManyField(Ingredient)tomatos=Ingredient.objects.create(name='Tomato',is_spicy=False)cheese=Ingredient.objects.create(name='Cheese',is_spicy=False)chili=Ingredient.objects.create(name='Chili',is_spicy=True)margarita=Pizza.objects.create(name='Margarita')margarita.ingredients.add(tomatos)margarita.ingredients.add(cheese)diabolo=margarita.clone(attrs={'name':'Diabolo'})diabolo.ingerdients.add(chili)# Nothing has changed on the original instance.assertmargarita.name=='Margarita'assertmargarita.ingredients.all()==[tomatos,cheese]# The original m2m values were copied, and the new values were added.assertdiabolo.name=='Diabolo'assertdiabolo.ingredients.all()==[tomatos,cheese,chili]As shown in the example, you can provide theattrsthat shall be replaced
in the cloned object. That lets you change the cloned instance before it gets
saved. By default the clone will be saved to the database, so that it haspkwhen it gets returned.There are numerous hooks on how you can modify the cloning logic. The best way
to learn about them is to have a look at the implementation ofCloneableMixin.DevelopmentInstall the dependencies (including the test dependencies) with:pip install -r requirements.txtThen you can run all tests with:toxChangelog0.1.0Initial release.
Package: django-closable_admin_filter
=====Closable Admin Filter=====When there are too many fields in Django admin and it's necessary to have the filter, it turns to very ugly situation, when filter `flies` over the fields.So here's a simple Django app to provide a "HIDE" button for the filter.Quick start-----------1. Install the package using::pip install django-closable_admin_filter2. Add "closable_admin_filter" to your INSTALLED_APPS setting like this::INSTALLED_APPS = (...'closable_admin_filter',)3. Add the AdminClosableFilterMixin to your inherited from ModelAdmin class like this::class MyAdmin(AdminClosableFilterMixin, admin.ModelAdmin):...4. Visit http://your.domain/admin/your_app/your_model/ to enjoy the result.
Package: django-closuretree
django-closuretreeis an implementation of theclosure treetechnique forDjangoapplications designed to provide efficient querying oftree-based structuresin a relational database. Its goal is to reduce the number of queries required when querying the children or parents of a given object.Given the following model:classNode(models.Model):name=models.CharField(max_length=24)parent=models.ForeignKey('self',related_name='children')The children of each model can be queried with:Node.objects.get(name='A').children.all()However, for recursive lookups, this results in a large number of queries. Instead,django-closuretreeallows you to extract them all in one go:fromclosuretree.modelsimportClosureModelclassNode(ClosureModel):name=models.CharField(max_length=24)parent=models.ForeignKey('self',related_name='children',null=True)a=Node.objects.create(name='A')Node.objects.create(name='B',parent=a)Node.objects.get(name='A').get_descendants()A single query will obtain all the descendants.Quick StartInstalldjango-closuretreewithpip installdjango-closuretree.Inherit your models fromclosuretree.models.ClosureModelinstead ofdjango.db.models.Model.That’s it. You can now useget_descendants()andget_ancestors()on a model instance.If you’re adding this to an existing application that already has data in the database, you’ll need to run therebuildtable()method of each model before the closure tree will be populated with the existing data:Node.rebuildtable()ContributingTo contribute, fork the repo, do your work, and issue a pull request. We ask that contributors adhere toPEP8standards, and include full tests for all their code.
Package: django-closure-tree
Django closure tree model.Abstract base model for creating a Closure Tree using a recursive Postgres view.http://schinckel.net/2016/01/27/django-trees-via-closure-view/UsageInherit from the Node model:fromclosure_tree.modelsimportNodeclassMyNode(Node):name=models.CharField(max_length=30)Create migrations:$./manage.pymakemigrationsAdd the CreateTreeClosure migration step:$./manage.pymakemigrations--emptymyappfromclosure_tree.migrationsimportCreateTreeClosureclassMigration(migrations.Migration):dependencies=[('dummy','0001_initial'),]operations=[CreateTreeClosure('MyNode'),]
Package: django-cloud-browser
Info:A Django application browser for cloud (S3, Cloud Files) datastores.Author:Ryan Roemer (http://github.com/ryan-roemer)Build:Version:Cloud Browser is a simple web-based object browser for cloud-based blob
datastores. Just add as an application to a Django project, add some settings,
and you’ll be able to browse cloud containers and implied subdirectories, as
well as view / download objects.Currently supported backend datastores include:Local file system for testing.Amazon S3Azure Blob StorageGoogle Cloud StorageOpenStack SwiftAnd many moreBe sure to check out the following project resources:Documentation.GitHub page.Access ControlsCloud Browser also has a very rudimentary set of access controls (presently
white and black lists), so that you can expose a subset of cloud objects
to a set of less-then-fully trusted users for read-only access without having
to pass around the full cloud API account and secret key.Nested File BrowsingOne of the underlying motivations for this project is the current control
panel for Rackspace Cloud Files that only allows listing of the flat object
namespace within a container, without any nested hierarchy. When you get up to
5 million or so objects, it can be tedious / impracticable to search through
results, even if you have carefully added delimiters (e.g., slashes) to your
cloud objects names.Accordingly, Cloud Browser correctly handles “implicit” or “pseudo” directories
in the underlying flat namespace of cloud blob names (e.g., divides up an
object called “long/path/with/slashes/to/foo.txt”), and allows viewing into the
artificially nested hierarchy. Cloud object results are paged, and subsequent
pages can be viewed at arbitrary object-per-page and starting points.
Conveniently, URL paths can be inputted and linked to a starting point within
a long list of results.