Saravanan666/pypi-org huggingface dataset:
Package: django-hide-admin
django-hide-adminHides Django admin from users without staff level access. Anonymous users or users without staff level access will see404 Not founderror if they try to open the Django admin login page or any other admin pages.Since the Django admin login page is not available, your project should have a login page for users and staff. Once staff are logged in, they can open/admin/(by default) to access admin interface.Installationpip install django-hide-adminUsageReplacedjango.contrib.adminwithhide_admin.apps.HideAdminConfiginINSTALLED_APPS.
Package: django-hidefield
django-hidefieldProvides a field base class to hide fields in django admin.
The class turns a field label in an admin edit form into a
show/hide toggle link.Tested with Django 4.2.Installationpip install django-hidefieldplace'hidefield'inINSTALLED_APPSUsageBuild a custom field class for any model field type you want to hide.
The field has an additional argumenthidewith the following meaning:'closed': the field is hidden at start'data': the field is hidden at start, if the field contains data (default)'no-data': the field is hidden at start, if the field contains no data'opened': (or any other value) the field is shown at startExamplefromdjango.dbimportmodelsfromhidefield.fieldsimportHideFieldclassHideCharField(HideField,models.CharField):passclassMyModel(models.Model):name=HideCharField(max_length=32,hide='data')Seeexampleappfor more examples.
Package: django-hide-herokuapp
Django app for Heroku users designed to hide your*.herokuapp.comfrom search engine results.Use caseYou want to develop a website calledartisanalraisinbeer.comusing
Django deployed on Heroku. You write a little bit of Django code and
create a new Heroku app calledartisanalraisinbeerto deploy to.While developing, you can visit your site by going to this URL:http://artisanalraisinbeer.herokuapp.comEventually, you finish the first version of your website, buy the
domain nameartisanalraisinbeer.com, and set everything up
so that you can view the site just by going to the following URL:http://www.artisanalraisinbeer.comYou can still visithttp://artisanalraisinbeer.herokuapp.com, which
is fine—but there’s one problem: you want your main site to show
up in search results,notyour.herokuapp.comsite.How it worksThis app goes about this two ways:robots.txtand theX-Robots-Tag.
Why both?To be double-plus sure…:eyes:Ifherokuappseems to be in theoriginating hostof the user request, then we do two things:Put the following inrobots.txt:User-agent: *
Disallow: /SetX-Robots-Tagin our response header tonoindex, nofollow.For search engines that respect these settings, they should start to ignore these sites
in future crawls.Quick startAdd'hide_herokuapp'to yourINSTALLED_APPSsetting.Add theHideHerokuappFromRobotsMiddlewaremiddleware to yourMIDDLEWARE_CLASSESlike this:MIDDLEWARE_CLASSES = (
    ...
    'hide_herokuapp.middleware.HideHerokuappFromRobotsMiddleware',
)Include thehide_herokuappURLs in your project’surls.pylike this:urlpatterns = [
   ...
   url(r'^', include('hide_herokuapp.urls')),
   ...
]alternatively, you may hook up the view directly:from hide_herokuapp.views import herokuapp_robots_view

urlpatterns = [
  ...
  url(r'^robots\.txt$', herokuapp_robots_view),
  ...
]ContributePyPI (Downloads)https://pypi.python.org/pypi/django-hide-herokuappOfficial repositoryhttps://github.com/isms/django-hide-herokuappIssue trackerhttps://github.com/isms/django-hide-herokuapp/issues
Package: django-hierarkey
This package allows you to attach a key-value store to a model, e.g. to store preferences of
an user or a customer. The package supports arbitrary datatypes, defaults and model hierarchies,
i.e. you can define a different model instance as your instance’s parent and the values of the
parent instance will be used as default values for the child instances.This approach has been in use inpretixfor quite a while, so it has been tested in
production.Tested with Python 3.8-3.10 and Django 3.2-4.0.LicenseThe code in this repository is published under the terms of the Apache License.
See the LICENSE file for the complete license text.This project is maintained by Raphael Michel <mail@raphaelmichel.de>. See the
AUTHORS file for a list of all the awesome folks who contributed to this project.
Package: django-highcharts-series
Django Highcharts seriesThis will create a series for line/column graph just by passing in the data and
the name of the column/columns as a list.InstallationRun the following to install:''' python
pip install django-highcharts-series
'''Usuage''' python
from django_highcharts_series import LINE_GRAPHseries, category = LINE_GRAPH(data, [column_name], category_column)'''
Package: django-highlander
django-highlander=================There can be only one!This is a Django `manage.py` Command class for long running tasks stated from crontab.This will assure there is only one instance running at any time, so crontab will not be able to start a secondinstance unless the previous one finished.How to use----------Just inherit from Highlander instead of BaseCommand:from djangohighlander.command import Highlanderclass Command(Highlander):def handle(self, *args, **options):...
Package: django-highlightjs
Use Highlight.js (https://highlightjs.org) in your Django templates, the Django way.InstallationInstall using pip:pip installdjango-highlightjsAlternatively, you can install download or clone this repo and callpip install-e..Add to INSTALLED_APPS in yoursettings.py:'highlightjs',In your templates, load thehighlightjslibrary and use thehighlightjs_*tags:SettingsThe django-highlightjs has some pre-configured settings.
They can be modified by adding a dict variable calledHIGHLIGHTJSin yoursettings.pyand customizing the values you want.
TheHIGHLIGHTJSdict variable is contains these settings and defaults:HIGHLIGHTJS={# The URL to the jQuery JavaScript file'jquery_url':'//code.jquery.com/jquery.min.js',# The highlight.js base URL'base_url':'//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js',# The complete URL to the highlight.js CSS file'css_url':'//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/{0}.min.css',# Include jQuery with highlight.js JavaScript (affects django-highlightjs template tags)'include_jquery':False,# The default used style.'style':'monokai_sublime',}Usage in yoursettings.py:HIGHLIGHTJS={'style':'github',}All other styles available athttps://github.com/isagalaev/highlight.js/tree/main/src/stylesExample template{%loadhighlightjs%}<html>
<head>
  <link href="{%highlightjs_css_url%}" rel='stylesheet' type='text/css'>
</head>
<body>{# Highlight Syntax using Highlightjs #}{%highlightjs_thiscode_to_highlight%}{%highlightjs_thiscode_to_highlight'python'%}{%highlightjs_javascriptjquery=1%}</body>
</html>RequirementsPython 3.10, 3.11 or 3.12Django >= 4Contributions and pull requests for other Django and Python versions are welcome.Bugs and requestsIf you have found a bug or if you have a request for additional functionality, please use the issue tracker on GitHub.https://github.com/mounirmesselmeni/django-highlightjs/issuesLicenseYou can use this under MIT SeeLICENSEfile for details.AuthorMy name is Mounir Messelmeni, you can reach me atmesselmeni.mounir@gmail.com.
Package: django-highlightselect-model-admin
django-highlightselect-model-adminDescriptionA Django App that highlights selected rows on the admin UI.Usagein settings.pyINSTALLED_APPS = [
...
'highlightselect_model_admin',
...
]collect staticspython manage.py collectstaticin admin.pyfrom highlightselect_model_admin import HighLightSelectModelAdmin
from .model import MyModel

@admin.register(MyModel)
class MyModelAdmin(HighLightSelectModelAdmin):
    """
    Inherit from HighLightSelectModelAdmin insead of django.contrib.admin.ModelAdmin
    """
    ...
    action = ('my_action', )
    
    def my_action(self, request, queryset):
        selected_ids = []
        for q in queryset:
            selected_ids.append(q.id)
        
         self.highlight_message_user(request, 'Selected!', selected_ids)Issueshttps://github.com/laonan/django-highlightselect-model-admin/issues
Package: django-hijack
Django HijackWith Django Hijack, admins can log in and work on behalf of other users without having to know their credentials.DocsDocs are available on Read the Docshttp://django-hijack.readthedocs.org/en/stable/, both forv2.xandv3.x.VersionsThere are two versions available:v2.xandv3.x.v3.xprovides a security first design, easy integration, customisation, out-of-the-box Django admin support and dark-mode.
It is a complete rewrite and all former APIs are broken.TestimonialsI am using django-hijack on a project with hundreds of users, wonderful tool for support. Thank you!--benzinonapolonionredditThis is a super useful tool. I have a site where I occasionally impersonating users to help troubleshoot their issues. This is a huge time saver.--orangishyellowonreddit... one of our standard apps to install now.--thundersnowonredditLove django-hijack--bmihelaconTwitter
Package: django-hijackemail
This app fills a very specific use case: you want to test email delivery
in a QA environment and your clients, as admins, want to receive real emails,
but you don’t want the QA process to trigger emails to real end users.With a couple settings, you can ensure only email to specified addresses
will go to the original recipients, and all others will go to a catch-all
address or domain.Installationpip installdjango-hijackemailAddhijackemailto yourINSTALLED_APPS. In your environment’s
settings file, set yourEMAIL_BACKENDtohijackemail.backends.HijackEmailBackend.Then configure the settings below as necessary.SettingsHIJACK_EMAIL_BACKENDA string represented the dotted path to the actual
email backend used to send messages.
Default isdjango.core.mail.backends.smtp.EmailBackend.HIJACK_EMAIL_TRANSFORMATIONA function which takes an email address, and returns
a transformed version of it.The default transformation convertsjohn.doe@example.comtojohn.doe-at-example.com@local.HIJACK_EMAIL_REPLACEMENTInstead of transforming the original email, just send
all email to this address. Default is None.HIJACK_EMAIL_DOMAINUse the default transformation with this catchall
domain. Default is “local”.HIJACK_EMAIL_EXCLUDEA list of email addresses that should not be hijacked.
Default is empty list.
Package: django-hilbert
django-hilbert===================This is one of many Django apps which is a loose collection of utility functions.It is a mixture of Python code and Javascript that I find myself writing over andover. Primarily it focuses around utilities for AJAX and testing.Installation Requirements------------------------------------ `Django <http://www.djangoproject.com/>`_ >= 1.2- `jQuery <http://jquery.com/>`_ >= 1.4.2Optional (but recommended)- `django-staticfiles <https://github.com/jezdez/django-staticfiles>`_The jQuery library is not included in the distribution but should be includedin your templates.To use the :ref:`CoverageRunner` you need to install Ned Batchelder's`coverage.py <http://nedbatchelder.com/code/modules/coverage.html>`_.Installation Instructions-----------------------------------It is easiest to install django-hilbert from `PyPi <http://pypi.python.org/pypi>`_::pip install django-hilbert
Package: django-hint
django-hintDjango_hintis a module to help you type hint your django project to work with different IDEs. It has been tested in PyCharm and with pylint in VSCode.Notice: Python3.6 or later is required for this moduleInstallationYou can use thepipto install django_hintpip3 install django_hintUsageThe following use cases can be type hinted usingdjango_hintto help your IDE recognize the type of variable.Database QuerySetModel ClassWSGIRequestDjango-Rest-Framework Token AuthenticationAs a bonus, all of the native python type hints such asList,Union,Optionaletc. fromtypingmodule can be imported fromdjango_hintDatabase QuerySetIt is used to hint that the variable is anQuerySetobject containing multiple objects whose nature we will determine. This type is used for filter functions that return a iterable query, such asfilter,all,order_by, etc.You need to hint it toQueryTypeand pass the object type inside the[]. Example:fromdjango_hintimportQueryTypesample_query:QueryType[SampleModel]=SampleModel.objects.filter(name='sample')Thesample_queryvariable will be treated as aQuerySet. While looping through the objects, each object will be treated as aSampleModelPlease note that if you extend your model toStandardModelTypeas explained below,QueryTypewill not usually be neededModel ClassDjango adds a few attributes to aModelinstance which are not available in themodels.Modeland will not be available in your IDE.
The most notable attribute is theManagerwhich is accessible via an attribute calledobjects.To include these attributes in your IDE, You have to extend your model to theStandardModelTypeclass ofdjango_hintas well asmodels.Modeland use it just like any other model class.StandardModelTypeprovides theobjectsproperty and provides the return type of theobjects's functions such asfilter,get, etc. In order to provide the correct return types, you have to pass the model's name as the generic type toStandardModelTypeNote thatStandardModeltypewill NOT have any effect on your database and will NOT make new migrations onmakemigrationscommand.fromdjango.dbimportmodelsfromdjango_hintimportStandardModelTypeclassSampleModel(models.Model,StandardModelType['SampleModel']):"""Just like any other model"""name:str=models.CharField(max_length=100)all_samples=SampleModel.objects.all()forsampleinall_samples:print(sample.name)WSGIRequestIt is used to hint the nature of therequestargument of the view (both function and class based).
Therequestwill be treated as aHttpRequesthaving theuservariable attached to it. Example:fromdjango_hintimportRequestTypedefsample_view(request:RequestType):ifrequest.user.is_authenticated:print(request.POST.get('data'))Django-Rest-Framework Token AuthenticationIf you are using the token authentication of theDjango-Rest-Framework, the request object will have auservariable and anauthvariable ofrest_framework.authtoken.models.Tokeninstance.DRFTokenRequestTypewill hint the IDE of those two variables.fromdjango_hintimportDRFTokenRequestTypedefsample_view(request:DRFTokenRequestType):print(request.auth.key)
Package: django_hipster_api
# hipster_apiwrapper django rest framework## ПрименениеДля удобства использования restapi в вашем проектеПодключение```pythonINSTALLED_APPS = (...'rest_framework','hipster_api',)TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), '..', 'templates').replace('\\', '/'),)```## Пример views```pythonfrom hipster_api import fields as hfieldsfrom hipster_api.views import HViewclass QuestsView(HView):"""Работа с постами"""class Fields(object):fields = hfields.FieldsListResponse(verbose_name=u'Список полей через запятую', methods=['get'])offset = hfields.IntegerLarger(default=0, larger=0, glt=True, methods=['get'])limit = hfields.IntegerLarger(default=20, larger=0, methods=['get'])active = hfields.IntegerList(default=u'0,1', methods=['get'])name = hfields.String(verbose_name=u'Название поста', default=u'', methods=['put'])description = hfields.String(verbose_name=u'Название поста', default=u'', methods=['put'])def get(self, request, format=None):"""Получение постов:public:"""fields = ['id'] + self.objects.fieldsposts = Post.objects.values(*fields).filter(active__in=self.objects.active)[self.objects.offset:self.objects.limit]return Response(quests)def put(self, request, format=None):"""Создание поста:private только админа:"""Post(name=self.objects.name, description=self.objects.description).save()return Response(status=202)```### запросы```GET /api/v1/posts.json?fields=nameGET /api/v1/posts.json?fields=name,descriptionPUT /api/v1/posts.jsonname = 'тест'description = 'тес тест'```## Собираем документацию`python manage.py hipster_api_doc`### вывод в шаблоне```html{% block container %}<div class="row"><div class="col-md-9" role="main">{% if file_name %}{% include file_name %}{% endif %}</div><div class="col-md-3" role="complementary"><nav class="affix"><ul class="nav">{% include 'docs/menu2.html' %}</ul></nav></div></div>{% endblock %}````file_name` - должен путь к доке `docs/files/...`# реализованные поля* [x] String* [x] StringList* [x] FieldsListResponse* [x] Integer* [x] IntegerLarger* [x] IntegerList* [x] IntegerLess* [x] Float* [x] FloatLess* [x] FloatLarger* [x] FloatList* [x] Boolean* [x] DateTime* [x] Date* [x] JsonField
Package: django-historical-currencies
Django currencies with historical exchange ratesThis is a fairly minimal Django app that renders amounts of currencies,
stores historical exchange rates in the database, and performs currency
conversion.When working with any historical multi-currency data, one often needs to
be able to perform exchange rate calculations with historical rates.
This allows the conversion to be accurately reproduced in the future.Exchange Rates are stored in a simple database table, with 1 row per
rate per date.
Conversions can be done directly, or across a base currency using 2
rates.Formatting is defined byiso4217.
Exchange Rate data can be sourced from:TheEuropean ECB Reference Ratesopenexchangerates.org(requires free
registration)InstallationInstalldjango-historical-currenciesin your Python environment.Addhistorical_currenciestoINSTALLED_APPSin yoursettings.py.Import yesterday's exchange rates to get started:manage.py import_ecb_exchangerates --daily.Configure a periodic task (e.g. cron, systemd timer, celery beat) to
import daily exchange rates.SettingsMAX_EXCHANGE_RATE_AGE: How many days old can an exchange rate be
treated as current?Optional settings, only required for OpenExchangeRates.org import:OPEN_EXCHANGE_RATES_APP_ID: OpenExchangeRates App ID.OPEN_EXCHANGE_RATES_BASE_CURRENCY: Base currency.UsageIn code, amounts can be converted using thehistorical_currencies.exchange.exchange()method.In templates, this module represents financial amounts as tuple of(Decimal, str(currency-code)). The recommended approach is to add
properties to your Django models to return this tuple for amounts.In a template the amount can be displayed or converted:{% load currency_format %}

Assuming my_amount = (Decimal(10), 'USD')
Display:
{{ my_amount|currency }}
-> 10.00 USD

Exchange at the latest rate:
{{ my_amount|exchange:"EUR" }}
-> 9.06 EURLicenseThis Django app is available under the terms of the ISC license, seeLICENSE.
Package: django-historicalrecords
This is from Marty Alchin’sPro Djangobook.Setup the virtualenv$ virtualenv --no-site-packages ve
$ source ve/bin/activate
(ve)$ pip install -r requirements.pipOr install from PyPI$ pip install django-historicalrecordsImport the HistoricalRecords and attach it to your model like you would a custom Django manager.from django.db import models
from history.models import HistoricalRecords

class TestModel(models.Model):
    """A model for testing"""
    boolean = models.BooleanField(default=True)
    characters = models.CharField(blank=True, max_length=100)

    history = HistoricalRecords()

    class Admin:
        list_display = ('',)
        search_fields = ('',)

    def __unicode__(self):
        return u"TestModel"If you runmanage.py syncdbyou’ll see that it automatically creates aHistoricalversion of whatever model you’ve attached it to.(ve)$ ./manage.py syncdb
Creating table auth_permission
... // snip // ...
Creating table example_app_historicaltestmodel <- HistoricalTestModel!
Creating table example_app_testmodel
... // snip // ...TheHistoricalRecordsclone the model it is attached to and adds some extra fields that allow you to track the type of change made, the timestamp of when the change was saved and it has a descriptor that will return the original object at the time of the change.(ve)$ ./manage.py shell
>>> from example_app.models import TestModel
>>> tm = TestModel.objects.create(boolean=True,characters="abc")
>>> tm.history.count()
1
>>> most_recent = tm.history.most_recent()
>>> most_recent.boolean
True
>>> most_recent.characters
u'abc'
>>> tm.boolean = False
>>> tm.characters = "def"
>>> tm.save()
>>> tm.history.count()
2
>>> tm.history.all()
[<HistoricalTestModel: TestModel as of 2010-09-10 03:29:59.424761>, <HistoricalTestModel: TestModel as of 2010-09-10 03:28:31.358548>]
>>> from datetime import datetime
>>> timestamp = datetime(2010,9,10,3,28,31,358548)
>>> old_version = tm.history.as_of(timestamp)
>>> old_version.boolean
True
>>> tm.boolean
False
>>> old_version.characters
u'abc'
>>> tm.characters
'def'
>>>
Package: django-historicalrecords-rca
This is from Marty Alchin’sPro Djangobook.Setup the virtualenv$ virtualenv --no-site-packages ve
$ source ve/bin/activate
(ve)$ pip install -r requirements.pipOr install from PyPI$ pip install django-historicalrecordsImport the HistoricalRecords and attach it to your model like you would a custom Django manager.from django.db import models
from history.models import HistoricalRecords

class TestModel(models.Model):
    """A model for testing"""
    boolean = models.BooleanField(default=True)
    characters = models.CharField(blank=True, max_length=100)

    history = HistoricalRecords()

    class Admin:
        list_display = ('',)
        search_fields = ('',)

    def __unicode__(self):
        return u"TestModel"If you runmanage.py syncdbyou’ll see that it automatically creates aHistoricalversion of whatever model you’ve attached it to.(ve)$ ./manage.py syncdb
Creating table auth_permission
... // snip // ...
Creating table example_app_historicaltestmodel <- HistoricalTestModel!
Creating table example_app_testmodel
... // snip // ...TheHistoricalRecordsclone the model it is attached to and adds some extra fields that allow you to track the type of change made, the timestamp of when the change was saved and it has a descriptor that will return the original object at the time of the change.(ve)$ ./manage.py shell
>>> from example_app.models import TestModel
>>> tm = TestModel.objects.create(boolean=True,characters="abc")
>>> tm.history.count()
1
>>> most_recent = tm.history.most_recent()
>>> most_recent.boolean
True
>>> most_recent.characters
u'abc'
>>> tm.boolean = False
>>> tm.characters = "def"
>>> tm.save()
>>> tm.history.count()
2
>>> tm.history.all()
[<HistoricalTestModel: TestModel as of 2010-09-10 03:29:59.424761>, <HistoricalTestModel: TestModel as of 2010-09-10 03:28:31.358548>]
>>> from datetime import datetime
>>> timestamp = datetime(2010,9,10,3,28,31,358548)
>>> old_version = tm.history.as_of(timestamp)
>>> old_version.boolean
True
>>> tm.boolean
False
>>> old_version.characters
u'abc'
>>> tm.characters
'def'
>>>