Saravanan666/pypi-org huggingface dataset:
Package: django-view-timer
django-view-timerProfile execution time for django viewsSettingsNone of the following settings are mandatoryDJANGO_VIEW_TIMER_ENABLEDEnable/Disable profilerDefault value: TrueDJANGO_VIEW_TIMER_MIN_THRESHOLDDisregards execution time below threshold (in milliseconds)Default value: 20DJANGO_VIEW_TIMER_WARNING_LEVELSet number of milliseconds for warningsDefault value: 300DJANGO_VIEW_TIMER_LOG_FORMATLog FormatDefault Value:"View: {view}\tModule: {module}\tFunction: {function}\tExecution Time: {time} msecs"ScreenshotInstallationInstall usingpippip install django_view_timerin urls.py importfrom django_view_timer.urls import (
   patterns as dvt_patterns,
   url as dvt_url
)

urlpatterns = patterns('',
   url(r'^$', index, name='index'),
)

dvt_urlpatterns = dvt_patterns('',
   dvt_url(r'dvt_fun_base_str$', 'djangoproject.views.fun_base_test_view', name='dvt_fb_str_view'),
   dvt_url(r'dvt_fun_base$', fun_base_test_view, name='dvt_fb_view'),
   dvt_url(r'dvt_class_base$', ClassBaseTestView.as_view(), name='dvt_cb_view'),
)

urlpatterns += dvt_urlpatterns
Package: django-view-tracking
django-view-trackingSimple logging of user access to URLs in Django.UsageInstall:pipinstalldjango-view-trackingEnable:# settings.pyINSTALLED_APPS=[...'django_view_tracking',...]MIDDLEWARE=[...'django_view_tracking.middleware.ViewTrackingMiddleware',...]Configure:# global kill switchDJANGO_VIEW_TRACKING_ENABLED=True# switch logging for anonymous users on or offDJANGO_VIEW_TRACKING_ANONYMOUS_USER=True# ignore logging for specific pathsDJANGO_VIEW_TRACKING_BLACKLIST=[reverse('admin:index'),]Migrate:pythonmanage.pymigrateEnjoy:View logs in the Django Admin underDjango View Tracking.LicenseMIT License
Package: django-view-utils
Django View Utilsdjango-view-utilsaims to be a collection of useful utilities for Django views. Mainly function based views.Features@viewdecoratorThe@viewdecorator is a simple way to create a view function and register it with a URL.# <app>/views.urlfromdjango_view_utilsimportview@view(paths="/hello-world/",name="hello-world")defmy_view(request):...# <app>/urls.pyfromdjango.urlsimportpathfromdjango_view_utilsimportinclude_view_urlsurlpatterns=[path("",include_view_urls()),]By default, django-view-utils will look for aviews.pyfile in your app.This can be disabled by settingDJANGO_VIEW_UTILS_AUTO_DISCOVERtoFalse, then registering view modules is up to you by supplying themoduleskeyword argument toinclude_view_urls.@viewdecorator optionsConveniently it also supportslogin_required,staff_requiredandpermission_required.@view(paths="/hello-world/",name="hello-world",login_required=True)defmy_view(request):...@view(paths="/hello-world/",name="hello-world",staff_required=True)defmy_view(request):...@view(paths="/hello-world/",name="hello-world",permissions=["myapp.can_do_something"])defmy_view(request):...InspirationThis decorator is very much inspired by the idea of "locality of behaviour" by Carson Gross (creator of HTMX):https://htmx.org/essays/locality-of-behaviour/.It also bears resemblance to the@app.routedecorator in Flask, the@app.<HTTP method>decorator in FastAPI and probably many other Python web frameworks.Table of ContentsInstallationLicenseInstallationpip install django-view-utilsDevelopmentgit clonecd django-view-utilspip install hatchhatch run tests:covhatch run tests:typecheckLicensedjango-view-utilsis distributed under the terms of theMITlicense.
Package: django-vimeo
django-vimeo==================Django module for easy embedding Vimeo videos into app... image:: https://travis-ci.org/suquant/django-vimeo.svg?branch=master:target: https://travis-ci.org/suquant/django-vimeo.. image:: https://coveralls.io/repos/suquant/django-vimeo/badge.svg?branch=master&service=github:target: https://coveralls.io/github/suquant/django-vimeo?branch=masterQuick start************#. Install ``django-vimeo``:::pip install django-vimeoor from sources::pip install git+https://github.com/suquant/django-vimeo.git#. Add ``django_vimeo`` to ``INSTALLED_APPS`` in your Django settings.#. Usage of template tags:::{% load django_vimeo_tags %}The video tag:{% vimeo instance.video width=600 as video %}<video width="600" loop="loop" autoplay="autoplay" poster="{{ video.optimal_picture.link }}"><source src="{{ video.optimal_file.link_secure }}" type='{{ video.optimal_file.type }}'>{% trans 'tag "video" not supported by your browser' %}<a href="{{ video.optimal_download.link }}">{% trans 'download video' %}</a>.</video>{% endvimeo %}Or embed shortcut:{% vimeo instance.video width=600 %}#. Usage of model fields::from django.db import modelsfrom django_vimeo import fieldsclass ExampleModel(models.Model):video = fields.VimeoField(null=True, blank=True)Release 0.1 (Januar 20, 2016)--------------------------- Initial release
Package: django-vingd
Django Vingd enables integrating Vingd into django project.Basic setupAdd “django_vingd” to INSTALLED_APPS.Configure django settings:VINGD_SETTINGS={'sandbox':{'VINGD_USR':'test@knopso.com','VINGD_PWD':'123',}}VINGD_MODE='sandbox'In any django app that uses vingd define Vingd Orders details (models.py):# Imaginary scenario where users are voting for candidates via vingd.fromdjango.dbimportmodelsfromdjango.httpimportHttpResponseRedirectfromdjango_vingd.modelsimportVingdOrderclassCandidate(models.Model):name=models.CharField(max_length=128)votes=models.IntegerField(default=0)defadd_vote(self):Candidate.objects.filter(id=self.id).update(votes=models.F('votes')+1)self.votes+=1classVoteOrder(VingdOrder):candidate=models.ForeignKey(Candidate)# Short object descriptiondefget_display_name(self):return'Vote for candidate'# Handle form submission (before sending user to vingd)deftake_order(self):self.candidate_id=self.request.POST.get('candidate_id')# Determine vingd pricedefget_vingd_amount(self):return75# 0.75 vingd# Access is confirmed (user has returned back from vingd)defaccept_order(self):self.candidate.add_vote()# Serve requested content to userdefsuccess_response(self):returnHttpResponseRedirect('/')Register order classes in your urls (urls.py):fromdjango_vingd.modelsimportVingdMetafrombase.modelsimportVoteOrderVingdMeta.register([VoteOrder,])urlpatterns=patterns('',(r'^vgd/',include('django_vingd.urls')),)In HTML template place vingd order forms:{%forcandidateincandidates%}<form action="{%urlvingd_order"VoteOrder"%}" method="POST">{%csrf_token%}{{candidate.name}}:{{candidate.votes}}<input type="hidden" name="candidate_id" value="{{candidate.id}}">
        <input type="submit" value="vote">
    </form>{%endfor%}Sync database and start your engines!Popup versionAdd jQuery to your page.Add popup related javascript to HTML head:{%loadvingd_tt%}{%vingd_scripts%}<script type="text/javascript">
    $(document).ready(function(){
        $('form').vingd_popup(function(data){
            alert('Vote added!');
        }, function(data){
            alert('Failed to add vote.');
        });
    });
</script>Handle ajax requests in your VoteOrders (models.py):fromdjango_vingd.utilimportHttpResponseJSON# ...defsuccess_response(self):request=self.requestifrequest.is_ajax():returnHttpResponseJSON({'ok':True,'votes':self.candidate.votes,})returnHttpResponseRedirect('/')Deny access to contentIn some situations user should not be allowed to access content. Such cases should be handled both for:denying access at vingd ordering time (before sending user to vingd)denying access at vingd verification time (after user has returned from vingd).In those cases one should raise exception within take_order and accept_order respectively.Handling exceptionsTo gracefully handle any kind of exception one should use VingdOrder handle_exception function:defhandle_exception(self,e):# log exception# inform userreturnHttpResponse("Inform user that something has gone wrong.")
Package: django-violation
django-violationDescriptionDescription Django-violation is a very simple app which serves the purpose of violation. It can easily be plugged into any django app of your choice with just little line of code/customization but with robust function.Installation>> pip install django-violationFeaturesdjango-violation is shipped with basic features that is needed for reporting / flagging an item, post, image, user, thread etc as invalid.Among some of its basic features are:An item cannot be submitted for violation by same person.Built-in django admin panel.Ability to redisplay rules that have been submitted by various users.Can be plugged with any django app.Highly customizable.Future implementationsAdding a UI interface.RequirementsPython >= 3.7Django >= 3.1UsageAdd package to list of your already available django apps in settings.pyCode:INSTALLED_APPS = [

...

'violation',

]Run database migration to sync preset violation that the app ships with.
Code:>> python manage.py migrateLogin your project admin panel and you should see VIOLATION added menu.Next is to write a view code to load object you will like report.CBVFor Lovers of class views, who want to customize to the core,  importBaseViolationViewMixini.e.from violation.viewmixins.violation import BaseViolationMixinInherit the view class and supply otherCreateViewparameters other than form_class.Do something similar to thisfrom violation.views.violation import BaseViolationView

class ThreadViolationView(BaseViolationView):
    model = YourModelClass
 template_name = ''It's worth noting thatBaseViolationViewancestors areBaseViolationMixinandCreateViewFBVFunction base view user can follow this code logicfrom django.shortcuts import render, get_object_or_404

from violation.forms.violation import ViolationForm

from .models import Thread # where this a an imaginary thread you want to report

TEMPLATE_URL = 'apps/threads'

def report_thread(request, pk):
    template_name = f'{TEMPLATE_URL}/report_thread.html'
    thread = get_object_or_404(Thread, pk=pk)
    form_kwargs = {
        'request': request,
        'object': thread,
    }
    if request.method == 'POST':
        form = ViolationForm(data=request.POST, **form_kwargs)
        if form.is_valid():
            form.save()
    else:
        form = ViolationForm(**form_kwargs)
    context = {
        'form': form,
        'thread': thread
    }
    return render(request, template_name, context=context)Most importantly, it is worth noting that request and object keywords must be passed to form in your view.For further customization, see project source code ingithub.LimitationsLack of links and UI.Limited info on how to fully use.VersioningSemVer is the versioning style utilized for this app. For the versions available, see the tags on this repositoryreleases.LicenseThis work uses MIT license
Package: django-visit-count
Django Visit CountCount visits using cache for Django models.InstallationSet-upDjango's cache framework.Install the Python package.pip install django_visit_countUsageUseVisitCountMixin. It adds avisit_countfield to your model.fromdjango_visit_count.mixinsimportVisitCountMixinclassMyBlogPost(VisitCountMixin,models.Model):...Create and run migrations on your model.$pythonmanage.pymakemigrationsmy_blog_app
$pythonmanage.pymigratemy_blog_appCount visits in your view like this:defview_blog_post(request,post_id):post=get_object_or_404(MyBlogPost,pk=post_id)post.count_visit(request)...Advanced UsageIf you need more control, you can useis_new_visitfunction.classMyBlogPost(models.Model):total_visits=models.PositiveIntegerField(default=0)...fromdjango_visit_count.utilsimportis_new_visitdefview_blog_post(request,post_id):post=get_object_or_404(MyBlogPost,pk=post_id)ifis_new_visit(request,post):post.total_visits=F("total_visits")+1post.save(update_fields=["total_visits"])...You can pass an optional keyword argumentsession_duration(integer, number of seconds)
tocount_visitoris_new_visit.SettingsDefault settings:VISIT_COUNT_DEFAULT_SESSION_DURATION=5*60# secondsDevelopmentInstall development dependencies in your virtualenv withpip install -e '.[dev]'Install pre-commit hooks usingpre-commit install.LicenseMIT
Package: django-visit-on-site-in-new-window
django-visit-on-site-in-new-windowTurn VISIT-ON-SITE button to open in the new window on Django's admin site.Installpipinstalldjango-visit-on-site-in-new-windowUsagepro/settings.pyINSTALLED_APPS=[...'django_static_jquery3','django_visit_on_site_in_new_window',...]app/admin.pyfromdjango.contribimportadminfromdjango_visit_on_site_in_new_window.adminimportDjangoVisitOnSiteInNewWindowAdminfrom.modelsimportBookclassBookAdmin(DjangoVisitOnSiteInNewWindowAdmin,admin.ModelAdmin):list_display=["name","author"]admin.site.register(Book,BookAdmin)Releasesv0.1.0 2020/03/10First release.v0.1.1 2023/09/15Doc update.
Package: django-visitor
Django visitorThis is a fairly simple visitor tracking application for Django,
designed to make allowing tracking visitors as painless as possible. It
requires a functional installation of Django 1.1 or newer, but has no
other dependencies.For installation instructions, see the file “INSTALL” in this
directory;Change Log0.1.7 - Fixed an issue with visitor_utils.get_visitor_from_request() that was causing an error with missing get_visitor()0.1.6 - Fixed the pypi tar.gz, it was missing some files0.1.5 - Added VISITOR_IGNORE_IP_LIST custom setting to help with issues behind a load balancer.0.1.4 - Merged in changes from pydanny (cleanup and better docs)0.1.3 - Added missing constant “REQUEST_LOG_ID” used by other applications.0.1.2 - Added support for akamai’s site accelerator, it puts the visitors origin IP in a custom header, so I needed to add a change to support this.
Package: django-visitor-information-middleware
Django Visitor Information MiddlewareThis module contains a collection of middleware classes which make writing
timezone and location aware applications easier.Information provided by this middleware can be used to do things like:Display a cookie consent message if visitor is coming from the country
within the EUDisplay timezone change notification if a user’s location timezone doesn’t
match a timezone which is currently set in the profile…Installationpipinstalldjango-visitor-information-middlewareGeolocation DatabaseTo determine location information based on the user IP address, this module
uses GEO IP database.By default, it ships with a free GeoLite2 database
(http://dev.maxmind.com/geoip/geoip2/geolite2/).If you want to use a custom database file, simply setVISITOR_INFO_GEOIP_DATABASE_PATHsetting to point to your geoip database
file. Keep in mind that this file needs to be readable by a process under
which your Django application is running.Included MiddlewareTimezoneMiddlewareThe middleware activates a timezone for an authenticated user.VisitorInformationMiddlewareThis middleware adds the following keys to therequest.visitordictionary:country- country the visitor is based incity- city the visitor is based inlocation.timezone- timezone used in the location visitor is based inlocation.unit_system- unit system used in the location visitor is based
inuser.timezone- timezone of the currently authenticated useruser.unit_system- unit system of the currently authenticated user.cookie_notice- True if a cookie consent notice should be displayed for
the current visitor.Note: Location of the user is determined based on the user’s IP address.Changelog0.1.0 - 2013-10-25Initial release.
Package: djangovisor
# djangovisorThis is a django project, which collects data from <a href="https://github.com/Supervisor/supervisor" target="_blank">supervisor</a> instances on one or multiple servers, stores it and plots it it using <a href="http://getbootstrap.com/" target="_blank">bootstrap</a> and the javascript library <a href="http://dygraphs.com/" target="_blank">dygraphs</a>. Example website: http://djangovisor.cfs-me-research.net/djangovisor/.There is a very similar app for the server monitoring tool <a href="https://mmonit.com/monit/" target="_blank">monit</a> called <a href="https://github.com/nleng/django-monit-collector" target="_blank">django-monit-collector</a>.### Features- Collects supervisor data from one or multiple servers.- Collects process cpu and memory usage and stores the data for a given time period.- Displays it in pretty graphs.- Start/stop/restart buttons for processes.- Shows the tails of spuervisor and process specific logfiles.- Status tables and graphs are refreshing automatically via ajax.- Processes are automatically removed when they stop sending data (removed from supervisord.conf). Servers can be deleted manually.### InstallationJust install it via pip:```pip install djangovisor```Or clone the repository if you want to modify the code:```git clone https://github.com/nleng/djangovisor```Add 'djangovisor' to your installed apps in settings.py:```INSTALLED_APPS = ['djangovisor',# ...]```Include djangovisor in your url.py:```url(r'^djangovisor/', include('djangovisor.urls')),```On every server that should be monitored enable the xml web interface in your supervisord.conf:```[inet_http_server]port=*:9001username=yournamepassword=yourpassword```If you use another port, you would have to change it in the sender.py script. Also, the port must not be blocked by the firewall, e.g.```ufw allow 9001```Since supervisor does not send process cpu and memory information, we use a script sender.py, which you have to copy to any server you want to observe.You have to change the user and password in the script sender.py. Then the simplest solution is to just run a cronjob, e.g. every minute:```crontab -e* * * * * /usr/bin/python /path/to/sender.py```You can also use the script sender_psutil.py if you prefer using the library psutil, which has to be installed.If you want to you can change the default values in your settings.py:```# in seconds, should be the same as set in the crontabUPDATE_PERIOD = 60# maximum days to store data, only correct, if UPDATE_PERIOD is set correctlyMAXIMUM_STORE_DAYS = 7```Set up your webserver and run:```python manage.py collectstaticpython manage.py migratepython manage.py createsuperuser```### LicenseBSD License.
Package: django-visual-queries
=====Visual Query Builder=====Simple app that provides an admin interface for generating and saving queries based on your defined models.Quick start-----------1. Add "qb" to your INSTALLED_APPS setting like this::INSTALLED_APPS = [...'qb',]2. Run `python manage.py migrate` to create the qb models.3. Start the development server and visit http://127.0.0.1:8000/admin/to start building queries (you'll need the Admin app enabled).
Package: django-vitae
Django-Vitae is a CV generator that can be used with theDjangoweb framework.Many academics have trouble keeping CVs up to date. Django-Vitae was created to streamline this process. Django-Vitae allows users to make highly customizable curricula vitae for use on their websites. The application provides models for common entries on curricula vitae such as education, employment, publications, teaching, and service. Django-Vitae eliminates many of the repetitive tasks related to producing curricula vitae. The included templates provide a complete CV “out of the box”, but allows researchers who might be interested in customizing the format using Django templating language.Django-Vitae usessemantic versioning. Though it aims to provide a complete suite to create a CV, the project does not been tested extensively (andyoucan contribute to that effort!) and pieces might still throw errors. See notes below for quirks and errors in usage that must be resolved.RequirementsDjango-Vitae is developed and tested in Python 3. It depends on several external packages (other than Django):Markdown(makes pretty HTML with simple text entries)citeproc-py(creates citations formatted according to desiredCSLstyles [not yet implemented])citeproc-py-styles(adds library ofCSLstyles)reportlab(creates PDFs on-the-fly)InstallationFromPyPI:pip install django-vitaeFor the latest development version:git clone https://github.com/mikebader/django-vitae
cd django-vitae
python setup.py installIf you are new toDjango, you may want to visit theGetting Startedguide in the documentation.DocumentationIncomplete documentation can be found in thedocs/directory and athttp://djangocv.readthedocs.io/.TestingTo test, you need to install the following packages:Nose&django-nose(used for testing suite)Coverage(used to document testing coverage)pip install nose
pip install django-nose
pip install coverageA test suite can be found in thetests/directory. WithNoseandCoverageinstalled, you may run the tests withruntests.py. From thedjango-vitaeroot directory:./runtests.pyTo test only a single model, you may use the flag--attr=<model_name>for the model (not implemented for all models). For example, to test books, you would use:./runtests.py --attr=book
Package: django-vite-plugin
Django Vite PluginIntroductionViteis a modern frontend build tool that provides an extremely fast development environment and bundles your code for production.This plugin configures Vite for use with Django backend.Installationpipinstalldjango_vite_pluginThen in your projectssettings.pyfile, adddjango_vite_pluginin installed apps# Some settingsINSTALLED_APPS=[# Some apps'django_vite_plugin',# Other apps]These are the available configuration options# Other settings
DJANGO_VITE_PLUGIN = {
    'WS_CLIENT': '@vite/client',
    'DEV_MODE': getattr(settings, 'DEBUG', True),
    'BUILD_DIR': getattr(settings, 'STATIC_ROOT') or 'static',
    'BUILD_URL_PREFIX': getattr(settings, 'STATIC_URL'), # Bundled assets would be prefixed with this on production
    'SERVER': {
        'HTTPS': False,
        'HOST': '127.0.0.1',
        'PORT': 5173
    },
    'JS_ATTRS': {
        'type': 'module'
    },
    'CSS_ATTRS': {
        'rel' : 'stylesheet',
        'type': 'text/css'
    },
    'STATIC_LOOKUP': True
}See the official documentation for more detailsUsage<!--Your Template file-->{% load vite %}<!DOCTYPE html><htmllang="en"><head><!--Other elements--><!--Vite dev client for hmr (will not be displayed on production)-->{% vite %}<!--These attributes will be present in both `asset1.css` & `asset2.js`-->{% vite 'asset1.css' 'asset2.js' someattr='value' %}</head><body><!--Page content--></body></html>Official DocumentationDocumentation for the Django Vite plugin can be found on theGithub.LicenseThe Django Vite plugin is open-sourced software licensed under theMIT license.
Package: django-vite-react
An easy way to use React with Django.QuickStartInstallpipinstalldjango-vite-reactUpdate Settings.pyINSTALLED_APPS=[...'react',...]Setup ViteCreate file package.json{"name":"django-react","version":"1.0.0","description":"use react.js in django templates","main":"index.js","scripts":{"dev":"vite","build":"vite build","test":"echo \"Error: no test specified\" && exit 1"},"keywords":[],"author":"ChanMo","license":"ISC","devDependencies":{"@vitejs/plugin-react":"^3.1.0","vite":"^4.1.1"},"dependencies":{"react":"^18.2.0","react-dom":"^18.2.0"}}Create file vite.config.jsimport{defineConfig}from'vite'importreactfrom'@vitejs/plugin-react'// https://vitejs.dev/config/exportdefaultdefineConfig({plugins:[react()],build:{outDir:'static/dist/',manifest:true,rollupOptions:{input:['components/app.jsx',]}}})Install npm packagenpminstallnpmrundevCreate your jsx fileExamplecomponents/app.jsximportReactfrom'react';importReactDomfrom'react-dom/client';functionApp(props){return(<h1>{props.title}</h1>)}constroot=ReactDom.createRoot(document.getElementById("app"));root.render(<App{...window.props}/>);Use ReactMixin in your ClassViewfromdjango.views.genericimportTemplateViewfromreact.mixinsimportReactMixinclassIndexView(ReactMixin,TemplateView):app_root='components/app.jsx'defget_props_data(self):return{'title':'Hello'}Visit url in your browerhttp://localhost:8000/Build jsBefore deploy, runyarn dev,Final Structure.
├── backend
│   ├── asgi.py
│   ├── __init__.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── db.sqlite3
├── manage.py
├── node_modules
├── package.json
├── todo
│   ├── admin.py
│   ├── apps.py
│   ├── components
│   │   └── todo.jsx
│   ├── __init__.py
│   ├── migrations
│   │   └── __init__.py
│   ├── models.py
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── static
│   └── dist
│       ├── assets
│       │   └── todo-1cc3d04a.js
│       └── manifest.json
└── vite.config.jsTodo[ ] easier to integrate[ ] decorate function