Saravanan666/pypi-org huggingface dataset:
Package: django-liar
django-liar=======================A simple django app with a ( modified ) url function that doesn't resolve invalid appsIn your ROOT_URLCONF module use liar.utils.url instead django urlfrom django.conf.urls import patterns, includefrom liar.utils import urlfrom django.contrib import adminadmin.autodiscover()urlpatterns = patterns('',url(r'^admin/', include(admin.site.urls)),url(r'^', include('invalidapp.urls')),url(r'^', include('validapp.urls')),)In your settings put:INVALID_APPS = ['invalidapp']Only works using include('app.url_file') notation.
Package: django-library
==============django-library==============A simple library app for Django 1.5, where "Library" is defined as "acollection of books", not "a place to read/borrow books".The *app* itself is ``library``.For an example project incorporating the app, see``homelibrary`` in the source.Installation of Dependencies============================In development::$ pip install -r requirements/local.txtFor production::$ pip install -r requirements.txt
Package: django-library-restful
Django Library RESTful APIproject descriptionA django app RESTful api to manage multiple libraries concurrently.Can add many libraryBook shelves can be added to any library with a specific numberLending books from libraries to one user can be managedAboutThis is a RESTful api to manage multiple libraries that borrow book to user. theadmin.pycreate good django adminstration for library that you can:Search name , author or user that borrow bookFilter author of booksSearch book and library between list of shelvesFilter shelves of specific librarySearch Library in specific cityLook for which library has a specific bookFilter borrows list with borrow date and give back dateInstallationInstall usingpip::pip install djangorestframework
pip install django-library-restfulAdd "polls" to your INSTALLED_APPS setting like this::INSTALLED_APPS = [
...
'django_library_restful',
]Include the library URLconf in your project urls.py like this::fromdjango.urlsimportpath,includefromdjango_library_restfull.routerimportbookstore_api_routerurlpatterns=[path('api/library/',include(bookstore_api_router.urls))]Runpython manage.py makemigrations django_library_restfullto create the sql.Runpython manage.py migrateto create the polls models.Use library apiLicenseUses the MIT license.Django Library RESTful api :https://github.com/MHolger77/django-librariesMIT:http://opensource.org/licenses/MIT
Package: django-libs
This project aims to provide commonly used building blocks for Django projects
and applications.Current features:TestCase mixins to ease the process of testing views viaself.client.getA JSONResponseMixinNew generic class based view DetailViewWithPostAction which is able to
handle custom post actions.Template filter to provide field’s verbose namesTemplate tag for displaying the currently selected main navigation itemCustom test_email_backend that sends emails to your own address no matter
who the recepient isFunctions to test callable or non-callable viewsDummy views to test your 404 and 500 templatesRapidPrototypingView to render any template even when it has no view hooked
up inurls.py.AjaxRedirectMiddleware for jQuery AJAX calls that return 301 redirectsAjaxResponseMixin for views that can return their normal template or a
partial template when it is an ajax callAccessMixin which allows to use views with thelogin_requireddecorator
based on a setting.A context processor to add your analytics tracking code to your template
context.A decoratorlockfilefor wrappinghandlemethods of admin commands
so that they never run twice at the same time.AgetCookiejs function that can be used to retrieve the csrf token
for AJAX POST requests.A templatetagcallwhich allows to call any method with params.Utilities for loading classes from a string likemyproject.models.Foobar.Form, which add field labels as placeholder attributes.Function to convert html code into formatted plain text.Amazon S3 storage + django-compressor support files.An AJAX View to display paginated comments for every possible object.Tools to improve django-hvadInstallationTo get the latest stable release from PyPi:$ pip install django-libsTo get the latest commit from GitHub:$ pip install -e git://github.com/bitmazk/django-libs.git#egg=django_libsUsageSee the docs folder for descriptions of the different tools this project
provides.Or read the docs here:http://django-libs.readthedocs.org/en/latest/ContributeIf you want to contribute to this project, please perform the following steps:# Fork this repository
# Clone your fork
$ mkvirtualenv -p python2.7 django-libs
$ pip install -r requirements.txt

$ git co -b feature_branch master
# Implement your feature and tests
$ git add . && git commit
$ git push -u origin feature_branch
# Send us a pull request for your feature branch
Package: django-libsass-compass-mixins
compass-mixinspackaged
as Django app under the same version number.InstallationFollowdjango-libsassinstallation instructions, then:$ pip install django-libsass-compass-mixinsand add django_libsass_compass_mixins to your INSTALLED_APPS settingINSTALLED_APPS=[...'django_libsass_compass_mixins'...]Now you can use Compass mixins in your SCSS files...@import"compass/reset";@import"compass/css3/box-shadow";...BuildingBuilding requires npm, wheel ans setuptools installed.Build Django app package from latest version ofcompass-mixins:$ makethen optionally upload the build to PyPI:$ make dist_uploadLicenseCopyright (c) 2008-2009 Christopher M. EppsteinAll Rights ReservedReleased under aslightly modified MIT License.
Package: django-libtech-emailuser
django-libtech-emailuser is a simple reusable Django app to for using emailaddress
as usernames withindjango.contrib.authin  Django 1.5 and later.There’s a number apps out there for doing authentication with emailaddresses prior to Django 1.5.
With the advent of Django 1.5 the Django core team has made it
very easy to use any model for authentication simply by settingAUTH_USER_MODEL. Unfortunately it’s not possible to create a EmailUser model by simply
subclassing the User class indjango.contrib.auth.modelsinstead if you want a model that plays
nicely with the rest ofdjango.contrib.auththe simplest way is to copy all the code indjango.contrib.auth.models.Userand substitute username for emailaddress. You also need to
edit some other minor stuff. This Django app does just that. I’m using it in production for a couple
of client sites and it works fine.Quick startInstall django-libtech-emailuserpip install django-libtech-emailuserAdd “emailuser” to your INSTALLED_APPS setting insettings.pylike this:INSTALLED_APPS = (
    ...
    'emailuser',
)Set your AUTH_USER_MODEL setting insettings.pyAUTH_USER_MODEL = “emailuser.EmailUser”Get the emailuser table created in your database./mangage.py syncdb
Package: django-licensing
Licensing provides some utilities needed in order to save and
show licensable content. As default it provides descriptions and localizations
of Creative Commons licenses, but any license could be added.The characters in thesymbolsfields of the provided Creative Commons
licenses are intended to be displayed with this Creative Commons icons font:http://pfefferle.github.io/openwebicons/#cc-iconsSupported Django versionsLicensing is tested against Django versions 1.8 and 1.9.Quick startInstall it using pip$ pip install django-licensingAdd “licensing” to yourINSTALLED_APPSsetting like this:INSTALLED_APPS = (
    ...
    'licensing',
)Create a model that subclassLicensed(an abstract base class)fromlicensing.modelsimportLicensedclassWhatever(Licensed):passThe modelWhateverwill contain aForeignKeyfield namedlicense.Runpython manage.py migrateto create the licensing models.5. Where is needed to show the symbol associated with the license you can use the tagshow_license:
it uses the openweb font to render it; it’s simple as{% load licensing_tags %}

{% block head %}

{% licensing_style %}

{% endblock %}
{% block foobar %}
    {% show_license license %}
{% endblock %}wherelicenseis an instance of theLicensemodel.Thelicensing_styletag simply renders a<style>block with all the necessary
to use the correct font, like the code below:/* http://pfefferle.github.io/openwebicons/usage/ */@importurl("http://weloveiconfonts.com/api/?family=openwebicons");/* openwebicons */i.openwebicons{font-family:'OpenWeb Icons',sans-serif;font-style:normal;}It’s possible to customize the css class and template used in these tags, read the source
code for more details.TestsIf you want to modify this app, there are available several tests that you can launch to check
that nothing is broken:$ python runtests.pyIt’s also available atoxconfiguration file to test it on multiple Django versions.
Package: django-lifecycle
Django Lifecycle HooksThis project provides a@hookdecorator as well as a base model and mixin to add lifecycle hooks to your Django models. Django's built-in approach to offering lifecycle hooks isSignals. However, my team often finds that Signals introduce unnecessary indirection and are at odds with Django's "fat models" approach.Django Lifecycle Hookssupports:Python 3.7, 3.8, 3.9, 3.10, 3.11, and 3.12Django 2.2, 3.2, 4.0, 4.1, 4.2, and 5.0In short, you can write model code like this:fromdjango_lifecycleimportLifecycleModel,hook,BEFORE_UPDATE,AFTER_UPDATEclassArticle(LifecycleModel):contents=models.TextField()updated_at=models.DateTimeField(null=True)status=models.ChoiceField(choices=['draft','published'])editor=models.ForeignKey(AuthUser)@hook(BEFORE_UPDATE,when='contents',has_changed=True)defon_content_change(self):self.updated_at=timezone.now()@hook(AFTER_UPDATE,when="status",was="draft",is_now="published")defon_publish(self):send_email(self.editor.email,"An article has published!")Instead of overridingsaveand__init__in a clunky way that hurts readability:# same class and field declarations as above ...def__init__(self,*args,**kwargs):super().__init__(*args,**kwargs)self._orig_contents=self.contentsself._orig_status=self.statusdefsave(self,*args,**kwargs):ifself.pkisnotNoneandself.contents!=self._orig_contents:self.updated_at=timezone.now()super().save(*args,**kwargs)ifself.status!=self._orig_status:send_email(self.editor.email,"An article has published!")Documentation:https://rsinger86.github.io/django-lifecycleSource Code:https://github.com/rsinger86/django-lifecycleChangelogSeeChangelogTestingTests are found in a simplified Django project in the/testsfolder. Install the project requirements and do./manage.py testto run them.LicenseSeeLicense.
Package: django-lifestreams
django-lifestreamsis a lifestream application for django. Based on django-lifestream, it allows
you to create a lifestream on your site from any source you want.A lifestream is compound of feeds, a feed has a source and from that source the application fetch the items.PluginsAdd plugins to INSTALLED_APPS, and LIFESTREAMS_PLUGIN_CHOICESIncluded pluginsTwitter:lifestreams.plugins.lifestream_twitterMust install tweepy>=2.1Instagram:lifestreams.plugins.instagramMust install python-instagram>=0.8.0RSS:lifestreams.plugins.rssMust install feedparser>=5.0 & python-dateutil>=2.1LIFESTREAMS_PLUGIN_CHOICES exampleLIFESTREAMS_PLUGIN_CHOICES = (
    ('lifestreams.plugins.lifestream_twitter.plugin.TwitterPlugin', 'Twitter'),
    ('lifestreams.plugins.lifestream_instagram.plugin.InstagramPlugin', 'Instagram'),
    ('lifestreams.plugins.lifestream_rss.plugin.RSSPlugin', 'RSS'),
)Management Commandpython manage.py update_lifestreams <lifestream_name>
Package: django-light
django-lightDisable dark mode in Django admin UI.Installationpip install django-lightAdd'django_light',toINSTALLED_APPSbeforedjango.contrib.adminImplementationThis is a pure CSS tweak. The CSS file is injected viabase.htmlin theextrastyleblock. If you are using Jinja2
or overridebase.htmlin a way that doesn't call{{ block.super }}on that block, YMMV. But in the end all that is
needed is for the browser to load<STATIC_URL>/django_light/django_light.cssstylesheet.Please report any problems via GitHub issues. PRs welcome.
Package: django-light-auth
django-light-authDjango Lightweight Authentication without models and databases, only depend on the Django's SessionMiddleware.Installpip3install-Udjango-light-authBasic Usagesettings.pyINSTALLED_APPS=[# ...# 'django.contrib.auth','django_light_auth',# ...]MIDDLEWARE=[# ...'django.contrib.sessions.middleware.SessionMiddleware',# 'django.contrib.auth.middleware.AuthenticationMiddleware','django_light_auth.LightAuthMiddleware'# ...]# SessionSESSION_ENGINE='django.contrib.sessions.backends.signed_cookies'# django-light-authLIGHT_AUTH_VALIDATE_FUNC='your_app.auth.validate_func'urls.pyfromdjango.urlsimportpathfromdjango_light_authimportLoginView,LogoutViewurlpatterns=[# ...path('login',LoginView.as_view(),name='login'),path('logout',LogoutView.as_view(),name='logout'),]your_app/auth/validate_func.py## example at django_light_auth.light_auth_validate_func#fromtypingimportDict,Anyfromyour_app.configimportconfigdeflight_auth_validate_func(data:Dict[str,Any])->bool:ifdata.get('username',None)==config.Auth.usernameanddata.get('password',None)==config.Auth.password:returnTruereturnFalseCustom Login Viewyour_login_view.pyfromdjango_light_authimportLoginViewasLoginViewAbsclassLoginView(LoginViewAbs):template_name='your_app/login.html'Historyv0.2.2 - 20220809Compatible Django 4.1+
Package: django-light-draft
Preview model changes without saving them into the database.Watch a demoon YouTube.Requirements:Django >= 1.8.xPython >= 2.7.xQuickstartInstal the package viapip:pipinstalldjango-light-draftAdd next lines to thesettings.pyof your project:INSTALLED_APPS=(...,'light_draft',)# Default settings. If you are happy with them - you can omit them.DRAFT_SETTINGS={'cache_name':'default',# or any other cache you may have'ttl':60*5,}To make it work, you need to have at leastdefaultcache defined. If you are not familiar with this term check outdocumentation. In simpliest case you can enable in memory like this:CACHES={'default':{'BACKEND':'django.core.cache.backends.locmem.LocMemCache','LOCATION':'just-an-example',}}Then, in order to enable the feature for a particular model you need to make sure:The admin model has been inherited fromlight_draft.admin.DraftAdmin:fromlight_draft.adminimportDraftAdminclassMyModelAdmin(DraftAdmin):...The detail view of your model has been inherited fromlight_draft.views.BaseDraftView:fromlight_draft.viewsimportBaseDraftViewclassMyModelDetailView(BaseDraftView):...The model has.get_absolute_url()method defined.Seeexample/blogapp for more details.ContributingSeeCONTRIBUTING.mdfile for information how you can contribute to the project. Cheers!Licence & AuthorsThe MIT License (MIT)Copyright (c) 2014 Vladimir Savin.
Package: django-lightpdf
# django-lightpdf[![Build Status](https://travis-ci.org/claudiutopriceanu/django-lightpdf.svg?branch=master)](https://travis-ci.org/claudiutopriceanu/django-lightpdf)Installation------------``django-lightpdf`` depends on pdfkit and wkthmltopdf (v0.12.2.1 recommended).sudo apt-get updatesudo apt-get install -y xorg xfonts-75dpiwget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-wheezy-amd64.debsudo dpkg -i wkhtmltox-0.12.2.1_linux-wheezy-amd64.debpip install django-lightpdfConfiguration-------------We need to hook ``django-lightpdf`` into our project.1. Put ``lightpdf`` into your ``INSTALLED_APPS`` in settings module::```INSTALLED_APPS = (...'lightpdf',)```2. To control logging behaviour, add a ``LIGHTPDF_LOGGING_CONFIG`` dictionary to your settings file following ``logging.config.dictConfig`` schema.3. Put a ``lightpdf`` formatter into your LOGGING['formatters'] or the default value will be used.```DEFAULT_LOGGING_FORMATTER = {'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'}```4. Put a ``lightpdf`` handler into your LOGGING['handlers'] or the default value will be used.```DEFAULT_LOGGING_HANDLER = {'level': 'INFO','class': 'logging.StreamHandler','formatter': 'lightpdf'}```5. Put a ``lightpdf`` handler into your LOGGING['loggers'] or the default value will be used.```DEFAULT_LOGGER = {'handlers': ['lightpdf'],'level': 'INFO',}```6. Add a ``LIGHTPDF_PDFKIT_OPTIONS`` dictionary that will be used as kwargs for ``pdfkit.from_string()`` or the default values will be used.```PDFKIT_OPTIONS = {'page-size': 'Letter','margin-top': '1.2in','margin-right': '0.75in','margin-bottom': '1.2in','margin-left': '0.75in','encoding': "UTF-8",'no-outline': None,'quiet': '',}```Usage-----```from django.views.generic import TemplateViewfrom lightpdf.mixins import PdfGeneratorMixinclass PdfView(PdfGeneratorMixin, TemplateView):template_name = 'blah.html'pdf_name = 'superblah'def get(self, request, *args, **kwargs):return self.render_to_pdf_response()```
Package: django-lighttpd-middleware
Django Lighttpd MiddlewareDjangois one of the most popular Python web frameworks today.Lighttpdis, while less popular http server (with that patchy beastApache, and that slick new superperformernginxdominating the market), the best choice for a web server sometimes.In a nutshell, Apache is bloated, dated, slow and resource hungry, nginx is slick, lean, fast, scales well. It outperfoms Apache on every relevant measure, and as a consequence has been the rising star in http servers for good reason. Almost everywhere I look web focussed FOSS today comes with instructions on how to run it under Apache (just because) and nginx (because that's what everyone does). Go nginx.So when is lighttpd the server of choice?I'll leave you to search the reports on-line, they are easy to find,  but lighttpd performs on par with nginx on allmeasures. Sometimes a litle better, sometimes a little worse. Like nginx it is written from the godun up to be light, slick, fast and scaleable.The key differences between lighttpd and nginx for me are:lighttpd is free (as in free beer, as the saying goes), nginx is freemium (free - and open source - but you can pay for more). Freemium and I have love hate relationship. It's a fatastic business model and I love it. But I don't like running into limits behind paywalls either.It is the server of choice in the OpenWRT project. OK, so if you're managing a network with OpenWRT routers (and I do, as a gateway, on WAPS, as DHCP server, DNS server, and more) then you have lighttpd to manage there already. In particular the NAT and reverse Proxy configurations you need for serving from behind a firewall and gateway. And if I'm invested in lighttpd there why not stick with it? Why learn another one. Not least when it's just as good, and free, not freemium.The black sheepThat said, lighttpd is the black sheep in the family and while the world of web services is falling over itself to provide Apache and nginx compatibility and guides and installers and more, lighttpd is mostly ignored and does a few things a little differently.One of those is how it delivers SCRIPT_NAME and PATH_INFO. It's not wrong, it's different to Apache and nginx. And Django is one of those projects where development has presumed Apache or nginx and hence a particular SCRIPT_NAME and PATH_INFO convention (which is not a standardised convention alas and up to the http server).And so this is middleware for Django (or a wsgi_handler replacement) that mapps lighttpds SCRIPT_NAME and PATH_INFO to Django's expectations.Just add "django_lighttpd_middleware.LighttpdMiddleware" as the first entry in you MIDDLEWARE tuple and you're good to go.__init__.pycontains more notes in its header for the technically oriented.
Package: django-lightweight-tests
django-lightweight-testsRun Django tests with optimization options to decrease runtime while keeping them trustable.In our tests using SQL Server, a 30 minutes runtime was reduced by 90%.Most of these ideas were based on the article7 Ways to Speed Up Your Django Test Suiteby Tobin Brown.How it worksThis package removes the following functionalities from Django, which greatly reduces tests runtime:MigrationsUnless you test your migration files, there is no need to run all migrations everytime you run your test suite. So this option creates all necessary database structure without looking at your migration files.WarningsSupress warnings to reduce print statements and make your test output cleaner.Password hasherIf your tests create a lot of users, it may be useful to use a simple password hasher.MiddlewaresAdds only necessary middlewares to the request object.DEBUG = FalseDecreases Django overhead when debugging is activated.SQLiteRun tests using SQLite.How to installAdd this line to yourrequirements.txt:-e git+https://github.com/luisccf/django-lightweight-tests.git#egg=django-lightweight-testsThen simply runpip install -r requirements.txtHow to useAdd the following code to yourmanage.py:importsysfromdjango_lightweight_testsimportLightweightTest...is_testing='test'insys.argvifis_testing:LightweightTest()...execute_from_command_line(sys.argv)How you check if you are running your tests depends on your test runner. We run our tests usingpython manage.py test, so this check works for us.When you run your tests, pass the option--light:pythonmanage.pytest--lightYou can change the arg name when instantiating the class:LightweightTest(cmd_option='--opt')pythonmanage.pytest--opt
Package: django-likeable
Adds “liking” functionality which aims to be scale-friendly
(seedjango-nonrel)
by favouring abstract classes instead of direct class inheritance when
facilitating liking. Allows liking of any model registered with thecontenttypesframework.Note that this app is not yet tested at scale, but will be at some point in the
near future. In the meantime, it simply adds “liking” functionality to your models.Quick InstallationAdd thedjango-likeableapp to your Python path.Addlikeableto your list ofINSTALLED_APPSin your project settings.Create your likeable model:from likeable import Likeable
from django.contrib.auth.models import User

class BlogEntry(Likeable):

    author = models.ForeignKey(User)
    content = models.TextField()
    created = models.DateTimeField(auto_now_add=True)

class BlogEntryComment(Likeable):

    entry = models.ForeignKey(BlogEntry)
    author = models.ForeignKey(User)
    content = models.TextField()
    created = models.DateTimeField(auto_now_add=True)Liking Content ManuallyYou can use the providedLikeable.likefunction to automatically like a particular
object by a given user, such as:from likeable import Like
from models import BlogEntry, BlogEntryComment
from django.contrib.auth.models import User

...

# harry posts a blog entry
harry = User.objects.create(username='harry')
blog_entry = BlogEntry.objects.create(author=harry, content="This is my first post.")

...

# sally likes the blog entry
sally = User.objects.create(username='sally')
blog_entry.like(sally)Liking Content Via Provided ViewsMake sure your project’surls.pyfile looks something like this:from django.conf.urls.defaults import patterns, include, url

urlpatterns = patterns('',

    # ...

    # add django-likeable's urls
    url(r'^like/', include('likeable.urls')),

    # ...
)Enabled URLslike/<content_type_id>/<object_id>Auto-detects whether a request comes in via
a plain GET request or an AJAX request, and handles it according to the following two
views.like/noajax/<content_type_id>/<object_id>Attempts to like the object whose
content type ID is<content_type_id>and primary key is<object_id>(both
positive integers). This function automatically attempts to redirect the user to the
referring URL after liking the given object. If no object matching the given criteria is
found, an HTTP 404 error will be generated.like/ajax/<content_type_id>/<object_id>Attempts to like the object whose
content type ID is<content_type_id>and primary key is<object_id>(both
positive integers). This function returns a JSON object of the format{'success': true}upon success. If no object matching the given criteria is
found, an HTTP 404 error will be generated.Other Batteries Includedlikeable.views.get_like_view_params(obj)objmust be any object registered with thecontenttypesframework.
On success, this shortcut function will return a tuple containing first the
content type ID primary key as well as the object’s primary key, which can
then simply be passed to one of thedjango-likeableviews.