Saravanan666/pypi-org huggingface dataset:
Package: django-site-aliases
A Django App to add support for domain aliases to entries in  Django’s Site framework.The ProblemFor example, your platform might create the FQDN for your customer like this:customer.myplatform.comThey might want to use the domain name of:customersite.comThe problem with Django’s site framework is: 1 Domain = 1 Site IDThere are two ways to solve this.  The first is to create an instance per customer that manually sets the SITE_ID.  They then go to that instance running the app and it works.  The downside is that you are provisioning a server per customer, which can get inefficient at scale.What if you have multiple customers but waitn to maintain only one server?The alternate to setting a SITE_ID explicitly is to use Django’s middleware to figure out the site from the request.  This is fine, if there is only one possible domain per customer.SolutionTo try to resolve this issue we created some lite ‘wrapper’ code around the Site framework to provide an alias lookup.It’s in a seperate model that you can let your customers update if you want (via a customer admin panel for example), letting them update as they want while keeping the Site model out of their hands.SetupTo install run the following in a shell:pipinstalldjango-site-aliasthen add ‘sitealias’ to your django project’s list of apps and run migrate to get the new model.  Make sure to also include ‘django.contrib.sites’ since this is just a wraper around that code.Builtin View MixinsPassRequestToFormKwargsMixin- adds the current request to the form kwargsSetSiteFromRequestFormValidMixin- sets the current site to the self.object.site with in the form_valid of any generic editing viewSiteQuerysetMixin:- Filters model by current site found in the request using get_queryset methodBuilt-in managersfromsitalias.modelsimportRequestSiteManagerclassModel(models.Model):#......objects=RequestSiteManager()Will add the following chainable methods to the objects filter:Model.objects.from_site(site)orModel.objects.from_request(request)Included manager serves as a suggestion, feel free to build your own implementation.Roadmap[x] Middleware - sitealias.middleware.CurrentSite - mimics todjango.contrib.sites.middleware.CurrentSiteexcept that it adds currentsitetorequestobject site via Sitealias model, before checking the Site table[x] Shortcut -from sitealias.shortcuts import get_current_site- mimicsdjango.contrib.sites.shortcuts.get_current_sitebut checks sitealias table before checking the Site model[] Callables for the ALLOWED_HOSTS setting (perhaps a subclass of the AllowedSites callable indjango-allowedsites?? )[] CachedAllowedSitesAndAlias[] AllowedSitesAndAliass ??INSTALLED_APPS=[...'django.contrib.sites',...'sitealias',...]Then in your Django settings, add the following to your middleware:MIDDLEWARE=[...'sitealias.middleware.CurrentSiteMiddleware',...]This is meant to be a drop-in replacement for Django’s ‘django.contrib.sites.middleware.CurrentSiteMiddleware’.  It will look for a site that matches an alias first, then fall back to Django’s code.
Package: django-siteauth
SiteAuth--------Middleware that applies Apache-like access control.Add ``siteauth.middleware.SiteAuthenticationMiddleware`` after``django.contrib.auth.middleware.AuthenticationMiddleware`` inyour ``MIDDLEWARE_CLASSES`` tuple.Below are the settings:- ``SITEAUTH_ACCESS_ORDER`` - either ``allow/deny`` or ``deny/allow``(default)- ``SITEAUTH_ALLOW_URLS`` - a list of regexes that explicitly allowsnon-athenticated access- ``SITEAUTH_DENY_URLS`` - a list of regexes that explicitly deniesnon-authenticated access
Package: django-siteblocks
http://github.com/idlesign/django-siteblocksWhat’s thatdjango-siteblocks is a reusable application for Django to build blocks of static or dynamic data that could be used in templates.It allows you to describe data that doesn’t clearly belong to any application in your project in terms of static or dynamic blocks,
that could be rendered in certain places on site pages. These blocks are addressed in templates by their aliases.The following siteblock types are supported:StaticThose are defined using Django Admin contrib and are linked to certain URLs.This allows different siteblock contents on different URLs. Just go to admin and add some blocks.DynamicThose are ordinary Python functions registered as siteblocks returning contents.This allows complex logic to build siteblock contents. Let’s make a block with a random quote from Pratchett:fromrandomimportchoicefromsiteblocks.siteblocksappimportregister_dynamic_blockdefget_quote(**kwargs):quotes=['Early to rise, early to bed, makes a man healthy, wealthy and dead.','The duke had a mind that ticked like a clock and, like a clock, it regularly went cuckoo.','Speak softly and employ a huge man with a crowbar.',]returnchoice(quotes)register_dynamic_block('quote',get_quote)Block renderingUsesiteblockstag to render block contents where you need it.{% load siteblocks %}<divclass="quote">{% siteblock "quote" %}</div>Documentationhttp://django-siteblocks.readthedocs.org/
Package: django-site-broadcasts
The site broadcast application allows users to define short messages and
announcements that should be displayed across a site.Each broadcast message consists of a short message, an optional start time, and
a completion time, when the should be displayed across a site.InstallationUse pip:pip install django-site-broadcastsOr clone the repository and use thesetup.pyfile to install the application.python setup.py installThen addbroadcaststo yourINSTALLED_APPSandbroadcasts.context_processors.broadcast_messagetoTEMPLATE_CONTEXT_PROCESSORS.UsageIf you’ve added the context processor to your list of context processors, you
can simply refer to the current message using the context variable:{{ broadcast_message }}The message itself should be displayed with:{{ broadcast_message.message }}TO-DOHandle time zones (Django project timezone may differ from server timezone)Use caching (if available)History0.1.1Fix an installation bug0.1.0Django 1.7+ compatibility (moved South migrations module tosouth_migrationsand added native Djangomigrationsmodule - thanks to @smajda for that)0.0.1First release
Package: django-sitecats
https://github.com/idlesign/django-sitecatsDescriptionDjango reusable application for content categorization.Nay, - you say, - all that tags business lacks structuring.This application is just about structuring your data: build categories hierarchy and link your site entities to those categories.# Somewhere in views.pyfromdjango.shortcutsimportrender,get_object_or_404# Suppose Article model has sitecats.models.ModelWithCategory class mixed in.from.modelsimportArticledefarticle_details(self,request,article_id):"""See, there is nothing special in this view, yet it'll render a page with categories for the article."""returnself.render(request,'article.html',{'article':get_object_or_404(Article,pk=article_id)})defarticle_edit(self,request,article_id):"""Let's allow this view to render and handle categories editor."""article=get_object_or_404(Article,pk=article_id)# Now we enable category editor for an article, and allow users# to add subcategories to `language`, and `os` categories# (suppose we created them beforehand with Admin contrib),# and link this article to them.article.enable_category_lists_editor(request,editor_init_kwargs={'allow_new':True},additional_parents_aliases=['language','os'])form=...# Your usual Article edit handling code will be here.returnrender(request,'article.html',{'article':article,'form':form})Template coding basically boils down tositecats_categoriestemplate tags usage:<!-- The same html is just fine for demonstration purposes for both our views.
     Do not forget to load `sitecats` template tags library. -->{% extends "base.html" %}
{% load sitecats %}

{% block contents %}<!-- Some additional functionality (e.g. categories cloud rendering,
         editor enhancements) will require JS. --><scriptsrc="{{ STATIC_URL }}js/sitecats/sitecats.min.js"></script><h1>{{ article.title }}</h1><divid="article_categories">{% sitecats_categories from article %}<!-- And that's it. --></div><!-- Form code goes somewhere here. -->{% endblock %}Read the docs,sitecatscan do more.Documentationhttps://django-sitecats.readthedocs.org/
Package: django-sitecats-helpers
Django admin helper classes fordjango-sitecatscategories.Authored byBasil Shubin, inspired bydjango-taggit-helpersInstallationFirst install the module, preferably in a virtual environment. It can be installed from PyPI:pipinstalldjango-sitecats-helpersSetupFirst make sure the project is configured fordjango-sitecats.Then add the following settings:INSTALLED_APPS+=('sitecats_helpers',)UsageCategoryCounterDisplay (and sort by) number of categories associated with objects.fromsitecats_helpers.adminimportCategoryCounterclassMyModelAdmin(CategoryCounter,admin.ModelAdmin):# CategoryCounter before ModelAdminlist_display=(...'category_counter',)CategoryListFilterFilter records by categories for the current model only.fromsitecats_helpers.adminimportCategoryListFilterclassMyModelAdmin(admin.ModelAdmin):list_filter=[CategoryListFilter]CategoryStackedInlineAdd stacked inline for categories to admin.fromsitecats_helpers.adminimportCategoryStackedInlineclassMyModelAdmin(admin.ModelAdmin):inlines=[CategoryStackedInline]CategoryTabularInlineAdd tabular inline for categorise to admin.fromsitecats_helpers.adminimportCategoryTabularInlineclassMyModelAdmin(admin.ModelAdmin):inlines=[CategoryTabularInline]ContributingIf you like this module, forked it, or would like to improve it, please let us know!
Pull requests are welcome too. :-)Licensedjango-sitecats-helpersis released under the MIT license.Changes1.0.1 (2021-11-30)Add missing mo files.1.0.0 (2021-11-29)Added Django 3+ support.Dropped Python 2.7 support.Dropped Django 1.10 / 1.11 support.
Package: django-siteflags
https://github.com/idlesign/django-siteflagsDescriptionReusable application for Django allowing users to flag/bookmark site objectsSo you want a user to be able to put some flags on certain site entities.Let’s say you need a kind of bookmark powered service, or a site where content is flagged and moderated,
or a simplified rating system, or something similar.Inherit you model fromsiteflags.models.ModelWithFlagand you’re almost done.Like that:# myapp/models.pyfromsiteflags.modelsimportModelWithFlagclassArticle(ModelWithFlag):...# Some model fields here.And like so:# myapp/views.pyfromdjango.shortcutsimportget_object_or_404from.modelsimportArticledefarticle_details(request,article_id):article=get_object_or_404(Article,pk=article_id)user=request.userarticle.set_flag(user)article.is_flagged(user)article.remove_flag(user)...Quite simple. Quite generic. Read the documentation.Documentationhttp://django-siteflags.readthedocs.org/
Package: django-siteforms
https://github.com/idlesign/django-siteformsDescriptionDjango reusable app to simplify form constructionFor those who consider maintaining templates-based forms solutions for Django a burden.Features:Full form rendering support, including prolog and submit buttonSubforms support (represent entire other form as a form field): JSON, Foreign Key, Many-to-ManyField groupsDeclarative attributes for elementsSimplified declarative forms layout, allowing fields orderingSimple ways to make fields hidden, disabled, readonlySupport for fields from model’s propertiesAria-friendly (Accessible Rich Internet Applications)Complex widgets (e.g. using values from multiple fields) supportFilter-forms (use form for queryset filtering)Supported styling:No CSSBootstrap 4Bootstrap 5UsageTo render a form in templates just address a variable, e.g.<div>{{form}}</div>.NoteBy default there’s no need to add a submit button and wrap it all into<form>.BasicLet’s show how to build a simple form.fromdjango.shortcutsimportrenderfromsiteforms.composers.bootstrap5importBootstrap5fromsiteforms.toolboximportModelFormclassMyForm(ModelForm):"""This form will show us how siteforms works."""disabled_fields={'somefield'}# Declarative way of disabling fields.hidden_fields={'otherfield'}# Declarative way of hiding fields.readonly_fields={'anotherfield'}# Declarative way of making fields readonly.classComposer(Bootstrap5):"""This will instruct siteforms to compose this
        form using Bootstrap 5 styling.

        """classMeta:model=MyModel# Suppose you have a model class already.fields='__all__'defmy_view(request):# Initialize form using data from POST.my_form=MyForm(request=request,src='POST')is_valid=form.is_valid()returnrender(request,'mytemplate.html',{'form':my_form})Composer optionsNow let’s see how to tune our form.fromsiteforms.composers.bootstrap5importBootstrap5,FORM,ALL_FIELDSclassComposer(Bootstrap5):opt_size='sm'# Bootstrap 5 has sizes, so let's make our form small.# Element (fields, groups, form, etc.) attributes are ruled by `attrs`.# Let's add rows=2 to our `contents` model field.attrs={'contents':{'rows':2}}# To group fields into named groups describe them in `groups`.groups={'basic':'Basic attributes','other':'Other fields',}# We apply custom layout to our form.layout={FORM:{'basic':[# First we place `basic` group.# The following three fields are in the same row -# two fields in the right column are stacked.['title',['date_created','date_updated']],'contents',# This one field goes into a separate row.],# We place all the rest fields into `other` group.'other':ALL_FIELDS,}}Documentationhttps://django-siteforms.readthedocs.org/
Package: django-sitegate
http://github.com/idlesign/django-sitegateWhat’s thatdjango-sitegate is a reusable application for Django to ease sign up & sign in processes.This application will handle most common user registration and log in flows for you.Sign inusername/e-mail + passwordusername + passwordYandexGoogleSign upusername/e-mail + passwordinvitation code + username/e-mail + passwordusername + passwordusername + e-mail + passwordusername + password + password confirmationusername + e-mail + password + password confirmationQuick exampleHere follows the most straightforward way possible withdjango-sitegateto have both sign up & sign in
functionality on your page.Usesitegate_viewdecorator to mark your view as the one handling both signups and signins:fromdjango.shortcutsimportrenderfromsitegate.toolboximportsitegate_view@sitegate_view# This also prevents logged in users from accessing our sign in/sign up page.defentrance(request):returnrender(request,'entrance.html',{'title':'Sign in & Sign up'})Then in your template loadsitegatetag library and putsitegate_signup_form&sitegate_signin_formtags
in place where you want a registration and sign in forms to be.{% extends "_base.html" %}
{% load sitegate %}

{% block page_contents %}<divclass="my_signin_block">{% sitegate_signin_form %}</div><divclass="my_signup_block">{% sitegate_signup_form %}</div>{% endblock %}You’re done. Now your site visitors have an e-mail + password form to register and username/e-mail + password form to log in.And mind that we’ve barely made a scratch ofsitegate. Read the docs.Documentationhttp://django-sitegate.readthedocs.org/
Package: django-site-local-middleware
Installation$[sudo]pipinstalldjango-site-local-middlewareExamplessettings.pyDEBUG=TrueMIDDLEWARE=[...'django_site_local_middleware.middleware.SiteLocalMiddleware'...]/etc/hosts127.0.0.1   site.com.local$pythonmanage.pyrunserver0.0.0.0:8000beforeafter<a href="http://site.com/"><a href="http://site.com.local:8000/">readme42.com
Package: django-site-maintenance
Maintenance mode utilities that allows you to put your django project into offline mode via command line.The main difference from other implementation is than DSM completly disconnect your django so you can:upgrade your code ( i.e. pip install –upgrade )update/alter database schemaupdate/modify your virtualenvLinksCode:http://github.com/saxix/django-site-maintenanceDocs:http://readthedocs.org/docs/django-site-maintenance/en/latest/index.html
Package: django-sitemaps
sitemap.xmlgeneration usinglxmlwith support foralternates. It
uses Python 3’s keyword-only arguments for self-documenting code.InstallationSimplypip installdjango-sitemaps. The package consists of a single
python module,django_sitemaps, containing the single class; there’s no
additional configuration necessary.UsageView:from app.pages.sitemaps import PagesSitemap

def sitemap(request):
    sitemap = Sitemap(
        # All URLs are passed through build_absolute_uri.
        build_absolute_uri=request.build_absolute_uri,
    )

    # URLs can be added one-by-one. The only required argument
    # is the URL. All other arguments are keyword-only arguments.
    for p in Page.objects.active():
        url = p.get_absolute_url()
        sitemap.add(
            url,
            changefreq='weekly',
            priority=0.5,
            lastmod=p.modification_date,
            alternates={
                code: urljoin(domain, url)
                for code, domain in PAGE_DOMAINS[p.language].items()
            },
        )

    # Adding conventional Django sitemaps is supported. The
    # request argument is necessary because Django's sitemaps
    # depend on django.contrib.sites, resp. RequestSite.
    sitemap.add_django_sitemap(PagesSitemap, request=request)

    # You can also specify the site and protocol manually should you wish
    # to do so:
    sitemap.add_django_sitemap(
        PagesSitemap, site=...site..., protocol=request.scheme
    )
    # Note! If you're omitting the request you *have* to specify site and
    # protocol yourself.

    # You could get the serialized XML...
    # ... = sitemap.serialize([pretty_print=False])
    # ... or use the ``response`` helper to return a
    # ready-made ``HttpResponse``:
    return sitemap.response(
        # pretty_print is False by default
        pretty_print=settings.DEBUG,
    )URLconf:from django_sitemaps import robots_txt
from app.views import sitemap

urlpatterns = [
    url(r'^sitemap\.xml$', sitemap),
    url(r'^robots\.txt$', robots_txt(timeout=86400)),
    ...
]Therobots_txtfunction returns a view which can be used to generate
arobots.txtfile containing sitemap URLs. The default sitemap only
contains:User-agent: *
Sitemap: <protocol>://<host>/sitemap.xmlThe list of sitemap URLs may be overridden by settingsitemaps:from django.urls import reverse_lazy

urlpatterns = [
    url(r'^robots\.txt$', robots_txt(
        timeout=86400,
        sitemaps=[
            '/sitemap.xml',
            reverse_lazy('articles-sitemap'),
            ...,
        ],
    )),
]
Package: django-sitemessage
https://github.com/idlesign/django-sitemessageDescriptionReusable application for Django introducing a message delivery framework.Features:Message Types- message classes exposing message composition logic (plain text, html, etc.).Messengers- clients for various protocols (smtp, jabber, twitter, telegram, facebook, vkontakte, etc.);Support for user defined message types.Support for user defined messenger types.Message prioritization.Message subscription/unsubscription system.Message grouping to prevent flooding.Message ‘read’ indication.Means for background message delivery and cleanup.Means to debug integration: test requisites, delivery log.Django Admin integration.Configure messengers for your project (createsitemessages.pyin one of your apps):fromsitemessage.toolboximportregister_messenger_objects,register_message_typesfromsitemessage.messengers.smtpimportSMTPMessengerregister_messenger_objects(# Here we register one messenger to deliver emails.# By default it uses mailing related settings from Django settings file.SMTPMessenger())Schedule messages for delivery when and where needed (e.g. in a view):fromsitemessage.shortcutsimportschedule_emaildefsend_mail_view(request):...# Suppose `user_model` is a recipient Django User model instance.user1_model=...# We pass `request.user` into `sender` to keep track of senders.schedule_email('Message from sitemessage.',[user1_model,'user2@host.com'],sender=request.user)...Periodically run Django management command from wherever you like (cli, cron, Celery, uWSGI, etc.):./manage.py sitemessage_send_scheduledAnd that’s only the tip ofsitemessageiceberg, read the docs %)Documentationhttp://django-sitemessage.readthedocs.org/
Package: django-sitemetrics
http://github.com/idlesign/django-sitemetricsWhat’s thatReusable application for Django providing easy means to integrate site metrics counters into your sitesBuilt-in site metrics providersYandex Metrika-http://metrika.yandex.ru/Provider alias:yandexGoogle Analytics-http://www.google.com/analytics/Provider alias:googleOpenstat-https://www.openstat.com/Provider alias:openstatHow to useAdd thesitemetricsapplication toINSTALLED_APPSin your settings file (usuallysettings.py)Add{% load sitemetrics %}tag to the top of a template (usually base template, e.g._base.html)Then you have two options to add metrics counter code to your page:Usefour argumentssitemetrics tag notation:{%sitemetricsbygooglefor"UA-000000-0"%}Here:googleis a metrics provider alias;UA-000000-0- metrics counter keycode.That is how you put Google Analytics counter code (withUA-000000-0keycode) into page.Useno argumentssitemetrics tag notation:{%sitemetrics%}That is how you put all counter codes registered and active for the current site.Client codes are registered with sites through Django Admin site interface.Admin siteandSitesfrom Django contribsare requiredfor this approach to work.Use./manage.py migrateto install sitemetrics tables into your database.Documentationhttp://django-sitemetrics.readthedocs.org/
Package: django-site-metrics
Home-page:https://github.com/rsalmaso/django-site-metrics.gitAuthor: Raffaele Salmaso
Author-email:raffaele@salmaso.orgLicense: UNKNOWN
Download-URL:https://pypi.org/project/django-site-metrics/Description: .. include:: description.rstAs well as a site statistics module, with the active_users template tag and manager method you can also use django-site-metrics to show who is online in a certain time.django-site-metrics is a “fork” ofdjango-request, which focus only on postgresql support and is able to use a separate database.Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 2.2
Classifier: Framework :: Django :: 3.0
Classifier: Framework :: Django :: 3.1
Classifier: Framework :: Django :: 3.2
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Description-Content-Type: text/x-rst