Saravanan666/pypi-org huggingface dataset:
Package: django-csp-helpers
django-csp-helpersA set of template tags (and mixins!) to assist in building CSP-enabled websites usingdjango-csp.InstallAdd "csp_helpers" to yourINSTALLED_APPS:INSTALLED_APPS=[...'csp_helpers',]Mixinsdjango-csp-helpersincludes a pair of mixins that can be applied to views and forms to
allow for the use of CSP nonces in widgets and form media.How to useSimply addCSPViewMixinto your Views, andCSPFormMixinto your Forms or ModelForms.
You will need to usebothmixins together, they don't work alone.CSPFormMixinfromcsp_helpers.mixinsimportCSPFormMixinclassArticleForm(CSPFormMixin,ModelForm):...CSPViewMixinfromcsp_helpers.mixinsimportCSPViewMixinfrom.formsimportArticleFormclassArticleUpdateView(CSPViewMixin,UpdateView):form_class=ArticleForm...Using only CSPFormMixinIf you are managing your form manually, or not using class-based views, you will not be able
to useCSPViewMixin. In these cases, just call your form withcsp_nonceas an argument
manually, like below.form=ArticleForm(csp_nonce=request.csp_nonce)What it doesThedjango-csp-helpersmixins will modify and extend your views and forms in two ways.Form WidgetsForm widgets will be patched to inject a CSP nonce into the rendering context for template
widgets. You can access this with{{ csp_nonce }}in your widget templates.Form MediaForm media (CSS and JS) will be included with CSP nonces.Template Tagsdjango-csp-helpersalso includes a pair of template tagsrender_bundle_cspAn exact replacement for thedjango-webpack-loaderrender_bundletag that includes bundles with CSP nonces.{% load render_bundle_csp %}

{% render_bundle_csp 'main' 'css' %}
{% render_bundle_csp 'main' 'js %}media_cspA less advanced version of the form media functionality provided by the mixins above. Simply load this tag
and pass it a form, and it will include the form media with CSP nonces.{% load media_csp %}

{# include form media #}
{% media_csp myform %}LicenseThis software is released under the MIT license.Copyright (c) 2019-2020 Luke Rogers

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Package: django-csp-nonce
DCN is a Content-Security-Policy nonce injection support system for
Django and CSP.It provides for on-the-fly nonce creation and deployment. Once
installed, DCN will generate a unique noncefor each request (one forscript-srcand a separate one forstyle-srcdirectives) append the nonce to theCSP header, then make the nonce(s) accessible to the templates via the
Django Context Processors.DCN stays out of the way ofDjango-CSPand can operateindependently with any method of CSP insertion that passes through
Django Middleware.DisclosureThis code has not been through a third party security audit.I’ve successfully tested this locally withpypy-5.4.1. TravisCI
has confirmed this doesn’t work with their version.Installationpip installdjango-csp-nonceAdd DCN toMIDDLEWARE_CLASSES:MIDDLEWARE_CLASSES=([...]'csp_nonce.middleware.CSPNonceMiddleware',# Make sure you put it *above* django-csp if you're using it[...])Add DCN tocontext_processors:TEMPLATES=[{'BACKEND':'django.template.backends.django.DjangoTemplates','DIRS':[...],'APP_DIRS':True,'OPTIONS':{'context_processors':['csp_nonce.context_processors.nonce',[...]],},},]Finally, add DCN directives to settings:CSP_NONCE_SCRIPT=False# True if you want to use itCSP_NONCE_STYLE=False# True if you want to use itCSP_FLAG_STRICT=False# True to include strict-dynamic in CSPUsageDCN takes care of nonce generation for you. As you work
on your templates, pull in your specific nonce from the context:<script type="text/javascript"{{script_nonce}}>
...
</script>

<style{{style_nonce}}>
...
</style>DependenciesDjangoKnown issuesNonce sync breaks onsettings.DEBUG=TrueImportant Changes1.0Out of beta!PyNacl is no longer a dependency.  (Moving forward the aim is to
stay compatible with environments such as Google App Engine which
don’t support non-python extensions.)Running TestsUsetoxto run the tests against multiple versions of Python that
you have installed and multiple versions of Django.  Please make sure
that you run your tests against at least Python 2.7 and Python 3.5.virtualenvvenv../venv/bin/activatepipinstalltoxtox
Package: django-csrf-protect-form
django-csrf-protect-formThe CSRF middleware and template tag from Django framework provides easy-to-use
protection against Cross Site Request Forgeries. This protector has some
inconveniences for XHR POST requests.This module enables CSRF protection only for HTML forms when content type of
the request is one of the following:application/x-www-form-urlencodedmultipart/form-datatext/plainIt is generally safe to exclude XHR requests from CSRF protection, because XHR
requests can only be made from the same origin. Check your CORS configuration
before using this module. Usedjango-cors-headersmodule to protect your site
with CORS.InstallationInstall withpiporpipenv:pipinstalldjango-csrf-protect-formConfigurationYou can set a list of content types which have CSRF protection enabled. The
default value is:CSRF_PROTECT_FORM_CONTENT_TYPE=['application/x-www-form-urlencoded','multipart/form-data','text/plain',]Usageviews.pyfromdjango_csrf_protect_formimportcsrf_protect_form@csrf_protect_formdefhello(request):returnHttpResponse("<html><head></head><body>Hello, world!</body></html>")or:urls.pyfromdjango_csrf_protect_formimportcsrf_protect_formfrom.viewsimporthellourlpatterns=[url('hello/',csrf_protect_form(hello)),]DocumentationSeehttp://django-csrf-protect-form.readthedocs.org/LicenseCopyright © 2019, Piotr RoszatyckiThis software is distributed under the GNU Lesser General Public License (LGPL
3 or greater).
Package: django-css-inline
Simple helper for loading CSS files as inline in HTML with Django.Example :{% load css_inline %}

...

<head>
    ...

    {% css_inline %}
        <link rel="stylesheet" href="/static/django_css_inline/test-1.css">
        <link rel="stylesheet" href="/static/django_css_inline/test-2.css">
        <link rel="stylesheet" href="https://static.snoweb.fr/django-css-inline/test-3.css">
    {% end_css_inline %}
</head>Every <link> includes between {% css_inline %} and {% end_css_inline %} give this results :<head>
    ...

    <style type="text/css">

        /* test-1.css styles */
        /* test-2.css styles */
        /* test-3.css styles */

    </style>
</head>SetupInstall with pip :pip installdjango-css-inlineAdd django_css_inline to django apps installed :INSTALLED_APPS = [
    ...
    'django_css_inline',
]In settings.py, chose to enable or disable django_css_inline. For example :# Default True
DJANGO_CSS_INLINE_ENABLE = not DEBUGIf you use static files with Django, don’t forget to collect them with :python manage.py collectstatic
Package: django-csv2json
RepositoryDownload the module from:http://gitlab.csn.uchile.cl/dpineda/csv2jsonCSV to JSONThis module is a conversor from csv data to json.The main goal is create a json file forDjango models.Thecsvmust have the same fields as thedjango modelThefields relatedtoanother modelsuses thenatural key. So every model must have anatural_keymethod.The third argumentHow to InstallUsingpippipinstalldjango_csv2jsonFrom the repositorypythonsetup.pyinstallHow to useThis modules dispose a classCSV2JSON, that requires a origin folder, a destiniy folder and a list of files. Every element from this list must be adictionarywith the keys "{model, file, field, opts}".Also, there are a command to use on thecommand line.csv2json--origin"./csn"--destiny"./json"--file_json"./files.json"For help, typecsv2json--helpCampos de files.jsonDebe contener un campomodelscon los modelos deDjangoque contengan campos en elcsv, determinar sus llaves.Debe contener el archivofilecsv.Debe contener elfielddel cual se transforma unslug(un string formateado a sencillo)Debe contener un dciccionario con las opciones o formato específico a cada campo.Debe incluirse un diccionario (vacío) o que contenga el cambio en el nombre de los campos de csv al modelo django.fields=["models","file","field","opts","switch"]files=[dict(zip(fields,({'organization.kindoforganization':{"logo","name","acronim","url"}},'kindoforganization.csv','name',{"description":read_file},{}))),dict(zip(fields,({'organization.organizationinfo':{"name","description","url_wiki"}},'organization.csv','name',{"kind":add_list},{}))),]kwargs={'files':files,'origin':'./csv','destiny':'./json'}CSV2JSON(**kwargs)
Package: django-csv-admin
This app includes model admin class for csv exporting and importing.For installation just add ‘csv_admin’ to your INSTALLED_APPSFor usage add in admin.py file:from csv_admin.admin import CSVExportAdmin


class MyAdmin(CSVExportAdmin):
    date_field = 'created_at'
    export_select_related = ['related_field_name']

    def _get_sum(self):
        sum = 1 + 2
        return sum

    def get_additional_fields(self) -> list:
        return ['sum']

    def get_additional_fields_params(self) -> dict:
        return {'sum': self._get_sum}CHANGELOG:1.0.5: Fixed custom url issues1.0.6: Fixed duplicating of date_field
Package: django-csv-app
=====Django-Csv=====Django-Csv-Tabulation is a simple app which is take the data from the uploaded csv file and do the cross tabulationDetailed documentation is in the "docs" directory.Quick start-----------1. Add "django-csv" to your INSTALLED_APPS setting like this::INSTALLED_APPS = (...'django-csv',)2. Include the django-csv URLconf in your project urls.py like this::url(r'^', include('django-csv.urls')),3. Run `python manage.py migrate` to create the django-csv models.4. Start the development server and visit http://127.0.0.1:8000/admin/to create a csv data (you'll need the Admin app enabled).5. Visit http://127.0.0.1:8000/ to participate in the django-csv.
Package: django-csv-export
django-export-csvdjango-export-csvis a reusable Django application for which provides generic views for downloading CSV files.InstallationTo get started usingdjango-export-csvsimply install it withpipinstalldjango-csv-exportUsageAdd'export_csv'to INSTALLED_APPS settings of the project.INSTALLED_APPS=['django.contrib.admin','django.contrib.auth',......'export_csv',]SubclassExportCSVin views.py file and provide model attribute.fromexport_csv.viewsimportExportCSVfrom.modelsimportAccountclassAccountCSV(ExportCSV):"""View for creating and rendering CSV of all Account model instances."""model=CustomerIn urls.py, add url pointing to the view classAccountCSVdeclared above.from.viewsimportAccountCSVurlpatterns=[(r'^account_csv/$',AccountCSV.as_view(),name='account-csv'),]That’s it. It will render a CSV file containing all the fields of all the instances ofAccountmodel.Customizing ExportCSV ViewNoteAll examples follow from the models in the example project.Use custom querysetBy default, all instances of themodelare included in (the queryset and)
the CSV.To provide a custom queryset, overrideget_querysetmethod to return
custom queryset.classAccountCSV(ExportCSV):model=Accountdefget_queryset(self):returnAccount.object.filter(is_active=True)Only include certain fields of the modelIt is possible that only some fields of themodelare needed.This can be achieved in two ways:providefield_nameslistoverrideget_field_namesmethodclassAccountCSV(ExportCSV):model=Accountfield_names=['owner','account_no','balance']classAccountCSV(ExportCSV):model=Accountdefget_field_names(self):return['owner','account_no','balance']Provide filenameBy default, the CSV rendered will have filename<model>_list.csv. For
example, forAccountmodel the filename will beaccount_list.csv.Custom file name can be provided using two ways.providefilenameattributeOverrideget_filenamemethod.classAccountCSV(ExportCSV):model=Accountfilename='active_account_list.csv'defget_queryset(self):returnAccount.object.filter(is_active=True)classAccountCSV(ExportCSV):model=Accountdefget_queryset(self):returnAccount.object.filter(is_active=True)defget_filename(self):return'active_account_list.csv'
Package: django-csv-exporter
# CSV ExporterThis Django package is a model exporter that can be run in a delayed task and emails a link to the resulting zip file containing a csv and all files.## How to use### To install the package```pip install django-csv-exporter```### To use the package```def export(query_or_queryset, attributes, callback=None, timedelta=datetime.timedelta(days=2)):``````from datetime import timedeltafrom functools import partialfrom csv_exporter import export, send_email_to_userusers = UserProfile.objects.filter(team='myteam', active=True)callback = partial(send_email_to_user, ['email1@gmail.com', 'email2@gmail.com'])zip_url = export(users, ('full_name', 'profile_picture', 'team.name', 'date_joined.isoformat'), callback, timedelta(days=2))```The function `send_email_to_user` is a helper function to send the zip_url to the users. The callback to export needs to accept the parameters (zip_url, timedelta). Timedelta is a length of time the url is valid for. Expiration works only for django-storages using s3-boto, otherwise the regular url is returned.### With Django RQ```import django_rqdjango_rq.enqueue(export, users, ('full_name', 'profile_picture', 'team.name', 'date_joined.isoformat'), callback, timedelta(days=2))# To save memory in redis you can also pass just the query instead of the QuerySet/listdjango_rq.enqueue(export, users.query, ('full_name', 'profile_picture', 'team.name', 'date_joined.isoformat'), callback, timedelta(days=2))```
Package: django-csv-exports
An admin action that allows you to export your models as CSV files without
having to write a single line of code –besides installation, of course.FeaturesEasy installationHigh level of customizabilityCreated with permissions in mindSane defaultsInstallationPython 2.7, 3.3+Django>= 1.5To install:pip install django-csv-exportsNext adddjango_exportsto yourINSTALLED_APPSto include the related css/js:INSTALLED_APPS = (
    # Other apps here
    'django_csv_exports',
)ConfigurationThere are two django settings that you can use to configure who can use the export action:# Use if you want to check user level permissions only users with the can_csv_<model_label>
# will be able to download csv files.
DJANGO_EXPORTS_REQUIRE_PERM = True
# Use if you want to disable the global django admin action. This setting is set to True by default.
DJANGO_CSV_GLOBAL_EXPORTS_ENABLED = FalseFields to exportBy default, all of the fields available in a model ar ordered and exported. You can override this behavior
at the admin model level. Define the following attribute in your AdminModel:class ClientAdmin(CSVExportAdmin):
    csv_fields = ['first_name', 'last_name', 'email', 'phone_number',]PermissionThere are two ways to limit who can export data as CSV files.Model level permissions: create a new model permission and assign it only to
user who should have access to the export action in the admin.class Client(models.Model):class Meta:permissions = ((“can_csv_client”, “Can export list of clients as CSV file”),)AdminModel Level permissions: define ahas_csv_permissionand return True if a user should have access:class ClientAdmin(admin.AdminModel):
    search_fields = ('name', 'id', 'email')
    csv_fields = ['name', 'id']

    def has_csv_permission(self, request):
        """Only super users can export as CSV"""
        if request.user.is_superuser:
            return TrueSelective InstallationSometimes, you don’t want to allow all of your admin models to be exported. For this, you will need to
setDJANGO_CSV_GLOBAL_EXPORTS_ENABLEDto False, and have your AdminModels extend ourCSVExportAdminadmin class:from django_csv_exports.admin import CSVExportAdmin

class ClientAdmin(CSVExportAdmin):
    passRunning the TestsYou can run the tests with via:python setup.py testor:python runtests.py
Package: django_csv_tests
This allows you to use a spreadsheet to define Django units tests that make requests to the Django testing client.  Inspired by Robot Framework.InstallationTo get the latest stable release from PyPipipinstalldjango_csv_testsInstall the appINSTALLED_APPS=(...,'django_csv_tests',)UsageCreate a CSV file with the headers “test name”, “expect failure”, “login as”,
“url”, “method”, “querystring”, “post body”, “expect status”,
“expect header”.  Then create a test file like:importosfromdjango.contrib.authimportget_user_modelfromdjango.testimportTestCasefromdjango_csv_testsimportgenerate_testsclassTheTestCase(TestCase):defsetUp(self):self.user=get_user_model().objects.create_user(username='john.doe',email='john@doe.com',password='password')csv_path=os.path.join(os.path.dirname(__file__),'tests.csv')generate_tests(csv_path,TheTestCase)You can define tests as a sequence of requests with associated assertions.  A
test is defined with a test name and one or more rows that describe requests to
make.  If a row does not have a test name it indicates that the request defined
on that row is part of the last named test.Column valuestest nameA string used to name the test.expect failureA boolean used to indicated whether the test is expected to fail.  Any non-zero
length string indicates True.  An easy way is enter this in a spreadsheet is as
“x”.login asA JSON encoded string that provides the username and password of the user to log
in as.  This is passed as keyword arguments to
django.contrib.auth.authenticate().  Example: {“username”: “john.doe”,
“password”: “password”}.urlThe URL that the request should be made to.methodAn HTTP method.  GET and POST are supported.querystringA JSON encoded string that contains querystring keys and values.  This becomesrequest.GET.post bodyA JSON encoded string that contains data to submit in a POST request.  This is
used only if the method is POST.  This becomesrequest.POST.expect statusThe HTTP status code expected for the response.expect headerA JSON encoded string that contains header keys and values expected in the
response.  Example: A redirect response could have the header
{“Location”: “http://testserver/new_location/”}TodoImplement “expect context”, “expect session”, and “expect” directives.Run Tests./configure.shsourcevenv/bin/activatepythondjango_csv_tests/tests/manage.pytest
Package: django-csv-utils
Contains helpers for CSV interaction.There are two primary uses:Running an import command with a list of importersExporting a streaming CSV response exportExample import:fromdjango_csv_utilsimportCSVImportException,ImportCommand,Importerfromusers.modelsimportUserclassUserImporter(Importer):"""Imports User objects from a CSV."""header=["first_name","last_name","email",]defimport_row(self,row):errors=[]first_name=row.get("first_name","")last_name=row.get("last_name","")email=self.get_str_errblank(row,"email",errors).lower()ifUser.objects.filter(email=email).exists():errors.append("The email{}is already in use".format(email))iferrors:raiseCSVImportException(', '.join([str(e)foreinerrors]))new_user=User.objects.create(email=email,first_name=first_name,last_name=last_name)return"Imported{0}".format(new_user.get_full_name())classCommand(ImportCommand):imports={'users':UserImporter}Example StreamingHTTPResponse:fromdjango_csv_utilsimportStreamingCSVViewfromusers.modelsimportUserclassUserCSVView(StreamingCSVView):"""Give the list of users."""header=['fist_name','last_name','email',]defget_queryset(self):"""Return the right list of users."""returnUser.objects.filter(is_active=True,is_superuser=False)defget_row(self,item):return(item.first_name,item.last_name,item.email,)
Package: django-cta-ds
django-cta_dsdjango-cta_ds is a Django app to use for demiansoft.Quick startAdd "cta" to your INSTALLED_APPS setting like thisINSTALLED_APPS=[...'cta',]코드를 넣고자 하는 위치에 다음을 추가 한다.{% load cta_tags %}
{% make_cta %}context examplecontext={"theme":"mentor_ds","cta":{"title":"카카오톡 상담","desc":"카카오톡을 통해 상담 및 예약 가능합니다.","link":"http://pf.kakao.com/_xexhxgxlV"}}
Package: django-cte
Common Table Expressions with DjangoInstallationpip install django-cteDocumentationThedjango-cte documentationshows how
to use Common Table Expressions with the Django ORM.Running testscd django-cte
mkvirtualenv cte  # or however you choose to setup your environment
pip install django pynose flake8

nosetests
flake8 --config=setup.cfgAll feature and bug contributions are expected to be covered by tests.Uploading to PyPIPackage and upload the generated files.pip install -r pkg-requires.txt

python setup.py sdist bdist_wheel
twine upload dist/*
Package: django-cte-forest
django-cte-forest implements efficient adjacency list trees using Django
and PostgreSQL Common Table Expressions (CTE).Note!This is a friendly fork ofdjango-cte-treesby Alexis Petrounias
which introduces support for Python 3 and recent Django versions.You’ll find additional details and information in thedocumentationor
on the original authors webpage ondjango-cte-trees
Package: django-cte-stubs
django-cte-stubsType stubs for thedjango-ctepackage,
enabling static type checking and improved IDE experiences for Django developers.Key FeaturesComprehensive type stubs for thedjango-ctepackage.Better type hinting and autocompletions in supported IDEs.Compatible with Python 3.9 and above.Compatible with django-stubs 4.*Compatible with django-cte 1.3.* for now.InstallationTo get started withdjango-cte-stubs, simply install the package via pip:pipinstalldjango-cte-stubsOnce installed, setuphttps://github.com/typeddjango/django-stubsif not already, and addmypy_django_cte_plugin:plugins =
    mypy_django_plugin.main,
    mypy_django_cte_plugin.main,Typing ExamplesWe have provided a few examples of how typing is implemented using these stubs. Explore the following modules in our test suite for more insights:simple.pysimple CTE typingsimple_typed.pysimple CTE with strong typingas_manager.pywith as_manager()raw.pyWith raw sql coderecursive_example.pyWith a recursive CTE.Feedback & ContributionsWe encourage feedback, bug reports, and contributions:Issues: If you find any issues or areas of improvement, please raise an issue in our GitHub repository.Contributions: Check out ourCONTRIBUTING.mdfor guidelines on how to provide contributions.