Saravanan666/pypi-org huggingface dataset:
Package: django-class-based-auth-views-jp
related packagesdjango-password-resethas class based views to reset
forgotten passwords by email confirmation.A reimplementation ofdjango.contrib.auth.viewsas class based views. Hopefully at some point this project or
something similar will make it into django proper.CurrentlyLoginViewandLogoutVieware implemented.Installationpip install django-class-based-auth-viewsBasic usageInstead of includingdjango.contrib.auth.logininto yoururls.py, just use the one provided by this project.urls.py:from class_based_auth_views.views import LoginView, LogoutView
urlpatterns = patterns('',
    url(r'^login/$', LoginView.as_view(form_class=EmailAsUsernameAuthenticationForm), name="login"),
    url(r'^logout/$', LogoutView.as_view(), name="logout"),
)Be aware that the logout view requires aPOSTto actually logout. So theregistration/logout.htmltemplate
should contain a form with a submit button.Extending LoginView ExampleNow that LoginView is based on generic class based views it is much easier to extend. Say you need to implement a
2 step login procedure with a one time password:from django.contrib.auth import login

class PhaseOneLoginView(LoginView):
    def form_valid(self, form):
        """
        Forces superusers to login in a 2 step process (One Time Password). Other users are logged in normally
        """
        user = form.get_user()
        if user.is_superuser:
            self.save_user(user)
            return HttpResponseRedirect(self.get_phase_two_url())
        else:
            login(self.request, user)
            return HttpResponseRedirect(self.get_success_url())

    def get_phase_two_url(self):
        return reverse('phase_two_login')

    def save_user(self, user):
        self.request.session['otp_user'] = user


class PhaseTwoLoginView(FormView):
    form_class = OTPTokenForm

    def get_user(self):
        return self.request.session.get('otp_user', None)

    def clean_user(self):
        if 'otp_user' in self.request.session:
            del self.request.session['otp_user']

    def form_valid(self, form):
        code = form.cleaned_data.get('code')
        user = self.get_user()
        login(request, user)
Package: django-classified
Django ClassifiedFeaturesItem groups, categories and areas (for ex. Cities ot Locations)Imageupload multiple images per itemgenerating preview (viasorl-thumbnail)display usingLightbox JSlibrarySearch abilitySEO optimizationSEO-friendly urlsgenerating META description and meta keywordssitemap.xmlrobots.txtRSS feedGoogle Analytics integrationOpen Graph protocolsupportCachingTranslationEnglishRussianFrench (thanks toTeolemon)Turkish (thanks toMirat Can Bayrak)Spanish (thanks to4bimcad)Help translate to other languages atTransifexRequirementsPython >=3.8Django >=3.2DesignTwitter Bootstrap JumbotronDemo projectDemo project with user registration (via Email/Facebook) availablehere.InstallationInstall apppip install django-classifiedAdddjango_classifiedto theINSTALLED_APPS:INSTALLED_APPS=[# Django applications required by Django Classified'django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.humanize','django.contrib.messages','django.contrib.sessions','django.contrib.sitemaps','django.contrib.sites','django.contrib.staticfiles',# External applications required by Django Classified'bootstrapform','sorl.thumbnail',# Django Classified'django_classified',]Addurl(r'', include('django_classified.urls', namespace='django_classified')),to the projecturls.pyfile:urlpatterns=patterns(url(r'',include('django_classified.urls',namespace='django_classified'),)Add'django_classified.context_processors.common_values'to the settingsTEMPLATEScontext_processorslist:TEMPLATES[0]['OPTIONS']['context_processors'].append('django_classified.context_processors.common_values')Customization:You can provide additional customization in settings.pyDCF_SITE_NAME- Site titleDCF_SITE_DESCRIPTION- Site descriptionDCF_ITEM_PER_USER_LIMIT- Max Items allowed per userDCF_SITEMAP_LIMIT- Sitemap items limitDCF_RSS_LIMIT- RSS feed items limitDCF_RELATED_LIMIT- Number of related items displayedDCF_ITEM_PER_PAGE- Number of items per pageDCF_LOGIN_TO_CONTACT- Hide contact information for unauthorized requestsDCF_DISPLAY_EMPTY_GROUPS- Display groups without items in the groups listCreditsThanksJetBrainsfor the awesomePyCharmIDE.
Package: django-classifier
Full documentation available onread the docsAlso avaialble two demo project:how to build user profiledjango-classifier-profileshop products with dynamic filters on elasticsearchdjango-classifier-shopAndblog postwith description how you can use this package.RequirementsPython 2.7, 3.4, 3.5Django 1.8, 1.9, 1.10InstallationInstall using pip:pip install django-classifierOr clone the repository and add to your PYTHONPATH:git clone git@github.com:django-stars/django-classifier.git
Package: django-classnames-tag
# Django Classnames TagProvides a template tag to create css classnames easily.Inspired by JedWatson/classnames## Installation```$ pip install django-classnames-tag```Add the app to INSTALLED_APPS:```INSTALLED_APPS += ['django_classnames_tag']```## Usage```{% classnames <classname>=<bool> <classname>=<value>|eq:3 <classname>=<value>|lte:2 %}```Example:```{% load classnames %}<a class="{% classnames success=obj.percentage|gte=90 danger=obj.percentage|lte:10 %}">...</a>```There are a bunch of helper filters available:```lte, lt, eq, gt, gte```
Package: django-class-registry
Allows you to create any Registry, similar to how django’s admin
has you register classes, or their template library has you register tags.Usagefrom class_registry import Registry

site = Registry()

@site.register
class MyCoolClass(object):
  """
  My class that should be registered.
  """
  key = "ABC"


>>> site["ABC"]
<class 'MyCoolClass'>Alternate useOr, if you want your own key name, specify it when you register the class.:container = Registry(key_name="other_key")

@container.register
class MyCoolClass(object):
  other_key = "POL-COOL-CLS"
Package: django-classroom
Stop right now if you think this is some awesome application to rival SchoolTool or  PowerSchool or some other school management system. This is a lowly django application designed to help put up info about individual classrooms on a school website.To that end, it lets you define staff, individual classrooms, grade levels, students (if you really want to track that on your public site). Each classroom gets it’s own blog, along with templates for the blog, subtemplates for individual posts so that attachments can be displayed in sensical ways. This blog portion draws heavily from django-articles by codekoala on Github.There’s also room for classroom photos (the most recent one goes to the top of the default template, so you can change them seasonally), galleries of photos (via django-photologue) and probably more features that will come as the app is built.That’s it for now.Install` pip installdjango-classroom`Else you could follow whatever procedure you use to install python packakges (easy_install, etc)ConfigurationCurrently there is little to configure. The important part is to wire it up in your django project:` Show how to install an app and hook up URLs `Templates (& URLs)All templates go in a ‘classroom’ directory in your TEMPLATE_DIR:### index.html (/)
An index page of all active classrooms and staff members.### room_list.html (/classrooms/)
An index page of all active classrooms. The default template throws all active classrooms into a description list grid.### room_detail.html (/classrooms/<slug>/)
Displays the details of a classroom. Also contains variables for showing the ten latest blog posts and any galleries associated with the classroom.### staff_list.html (/staff/)
An index page of active staff members. There are mug shots for these, as well as contact information.### staff_detail.html (/staff/<slug>/)
A detail page of a staff member, default template allows for inline editing via a domwindow popup.### room_blog_index.html (/<room>/blog/)
The index page for a room’s blog index.### room_blog_post.html (/<room>/blog/<year>/<slug>/)
An absolute url page for a room’s blog post
Package: django-class-settings
django-class-settingsdjango-class-settings aims to simplify complicated settings layouts by using
classes instead of modules. Some of the benefits of using classes include:Real inheritanceFoolproof settings layoutsPropertiesImplicit environment variable namesExample# .envexportDJANGO_SECRET_KEY='*2#fz@c0w5fe8f-'exportDJANGO_DEBUG=true# manage.pyimportosimportsysimportclass_settingsfromclass_settingsimportenvfromdjango.core.managementimportexecute_from_command_lineif__name__=='__main__':env.read_env()os.environ.setdefault('DJANGO_SETTINGS_MODULE','myproject.settings')os.environ.setdefault('DJANGO_SETTINGS_CLASS','MySettings')class_settings.setup()execute_from_command_line(sys.argv)# myproject/settings.pyfromclass_settingsimportSettings,envclassMySettings(Settings):SECRET_KEY=env()DEBUG=env.bool(default=False)INSTALLED_APPS=['django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles',]ROOT_URLCONF='myproject.urls'WSGI_APPLICATION='myproject.wsgi.application'InstallationInstall it fromPyPIwithpip:pipinstalldjango-class-settingsRequirementsDjango 1.11+Python 3.5+ResourcesDocumentation:https://django-class-settings.readthedocs.io/Releases:https://pypi.org/project/django-class-settings/Changelog:https://github.com/orlnub123/django-class-settings/blob/master/CHANGELOG.mdCode:https://github.com/orlnub123/django-class-settingsLicense:MIT
Package: django-classymail
Django makes it really easy to send simple e-mail messages. But e-mails
sometimes gets really complicated and un-DRY. That’s where ClassyMail
steps in.Django-ClassyMail is a library for building e-mail messages in a fashion
similar to django’s class based views.You can create mixins, override attributes with keyword arguments and
there’s a lot of builtin functionality. Just like class based views.Django-ClassyMail will handle css inlining, timezone, language and urls
for you.Read the docs for more info:https://django-classymail.readthedocs.org/en/latest/And here’s an example:class UserMixin(ClassyMail):
    """
    Sets language and timezone according to user preferences, adds "user" to
    template context and sets recipient to user's email address.
    """
    user = None

    def get_timezone(self):
        return self.user.get_profile().timezone

    def get_language(self):
        return self.user.get_profile().language

    def get_to(self):
        return [self.user.email]

    def get_context_data(self):
        data = super(UserMixin, self).get_context_data()
        data['user'] = self.user
        return data

class WelcomeEmail(UserMixin, ClassyMail):
    html_template_name = 'emails/welcome.html'
    text_template_name = 'emails/welcome.txt'

    def get_subject(self):
        return _("Welcome %s! Thanks for joining us!") % self.user.first_name
Package: django-classy-mail
django-classy-mail==================Class Based Email for Django, built on Mixins to support many common use casesAll e-mails are based on a BaseEmail class that builds the MultiPartEmail classthat django provides.  This means that you can still use any backend you want.I like [django-ses](https://github.com/hmarr/django-ses), but you may likesomething else.Get it from [pipi](https://pypi.python.org/pypi/django-classy-mail/)The simplest usage of the class is to send a one-off e-mail like this:```pythonfrom classy_mail.generic import SimpleEmail#create the emailemail = SimpleEmail(subject=u'Welcome to mycoolwebsite',to_addr=u'user@example.com', text_content=u'Hello World', from_email=u'Friendly Admin <administrator@mycoolwebsite.io>'')#Everything gets validated and templated when build_msg is called by send()email.send()#You can check things like send status on the objectprint email.status````Some other mixins to play with:### FileTemplateMixinApplies templates stored in your project templates directories### ModelTemplateMixinUsing the included TemplatedEmail model, you can store templates in the database instead### SiteContextMixinAdds the site to the context that will be used to render any template
Package: django-classy-settings
django-classy-settingsMinimalist approach to class-based settings for Djangohttps://django-classy-settings.readthedocs.io/en/latest/Quick StartIn yoursettings.pyfrom cbs import BaseSettings, env


...
# For env settings with a DJANGO_ prefix
denv = env['DJANGO_']

class Settings(BaseSettings):

    DEBUG = denv.bool(True)  # Controlled by DJANGO_DEBUG env var

    DEFAULT_DATABASE = denv.dburl('sqlite://db.sqlite')

    def DATABASES(self):
        return {
            'default': self.DEFAULT_DATABASE,
        }


class ProdSettings(Settings):
    DEBUG = False

    @env
    def STATIC_ROOT(self):
        raise ValueError("Must set STATIC_ROOT!")

__getattr__, __dir__ = BaseSettings.use()Switch betweenSettingsandProdSettingsusing theDJANGO_MODEenv var:# Run default Settings
$ ./manage.py test

# Run ProdSettings
$ DJANGO_MODE=prod ./manage.py test
Package: django-classy-start
Django Classy StartA command line utility for starting Django projects and apps in a most classy manner.SynopsisInstalldjango-classy-startwithpip(in your virtual environment).$ pip install django-classy-startStart a project$ classy-start project <project-name> .This initializes a project namedproject-namein the current working directory. In addition to the regular Django stuff, project is initialized with:anaccountsapp containing a custom auth user modela.envfile with default project secretsand moreAll of these are reflected in your settings file, so you don't have to bother yourself with wiring them up.Start your apps this way$ classy-start app <app-name>Your settings file isn't touched for this operation, though.Why?Mostly About the Auth User ModelThe Django docs on auth (customizing)recommends setting up a custom user model for every new project as it's usually a real pain to change the auth user model after the database tables have been created.And while it's easyin theoryfor everyone to remember to set up their auth user model first thing after starting a project withdjango-admin, it doesn't always pan out that way in practice.django-classy-starthandles all of that neatly withclassy-start.And Then There are SecretsYourDjangoproject'sSECRET_KEYsetting is to be kept secret in production. And things likeDEBUGandALLOWED_HOSTShave different values in different environments.And it's usually not always immediately clear to n00b1es how to keep these concerns separate in their projects.django-classy-startaddresses this problem for everyone by reading environment variables from a project-wide.envfile.That's NOT All Folks!And this may be myoh, so, slightanal retentiveness speaking, but...Apps started bydjango-admincontain some files which have nothing but a line of import (and a line of comment). The imports are unused and linters balk at such things.String literals in project and app files are delimited with single quotes. Black, the PSF-blessed Python formatterdictatesthat double quotes be used.django-classy-startencourages the good habit of housing test files in a tests directory.But Really, Why?Okay, you got me. I just wanted something relatively non-trivial to do so I can learn more about Django and improve my unit testing game.And I found that thing in building this.Statusv0.0.1 (Beta) released on PyPIFAQsQ1: Yo, @mfonism, I'm really happy for you, I'mma let you finish, but do you know you just wrote thefrugly-est django-cookiecutter ever?A1: Dude, did you read theBut Really, Why?section?
Package: django-classy-tags
The goal of this project is to create a new way of writing Django template tags
which is fully compatible with the current Django templating infrastructure.
This new way should be easy, clean and require as little boilerplate code as
possible while still staying as powerful as possible. Some features:Class based template tags.Template tag argument parser.Declarative way to define arguments.Supports (theoretically infinite) parse-until blocks.Extensible!NoteThis project is considered 3rd party (no supervision by thedjango CMS Association). Join us onSlackfor more information.Contribute to this project and win rewardsBecause this is a an open-source project, we welcome everyone toget involved in the projectandreceive a rewardfor their contribution.
Become part of a fantastic community and help us make django CMS the best CMS in the world.We’ll be delighted to receive your
feedback in the form of issues and pull requests. Before submitting your
pull request, please review ourcontribution guidelines.We’re grateful to all contributors who have helped create and maintain this package.
Contributors are listed at thecontributorssection.DocumentationSeeREQUIREMENTSin thesetup.pyfile for additional dependencies:Please refer to the documentation in the docs/ directory for more information or visit ouronline documentation.ExampleThis is how a tag looks like using django-classy-tags:fromclassytags.coreimportOptionsfromclassytags.helpersimportAsTagfromclassytags.argumentsimportArgumentfromdjangoimporttemplateregister=template.Library()classHello(AsTag):options=Options(Argument('name',required=False,default='world'),'as',Argument('varname',required=False,resolve=False))defget_value(self,context,name):return'hello%s'%nameregister.tag(Hello)That’s your standardhello worldexample. Which can be used like this:{% hello %}: Outputshello world{% hello "classytags" %}: Outputshello classytags{% hello as myvar %}: Outputs nothing but storeshello worldinto the
template variablemyvar.{% hello "my friend" as othervar %}: Outputs nothing but storeshello my friendinto the template variableothervar.Running TestsYou can run tests by executing:virtualenv env
source env/bin/activate
pip install -r tests/requirements.txt
python setup.py test
Package: django-clean
django-clean====================django-clean is a package that lets you specify files or directories that youwould like cleaned up. You can specify regular expressions to define whichfiles you would like automatically removed.Installation------------1. Add 'clean' to your installed apps in your settings.py file.INSTALLED_APPS = ['clean',...]2. Define a PROJECT_PATH in your settings.py file.import os.path, sysPROJECT_PATH = os.path.dirname(__file__)3. *OPTIONAL* Define the regular expression patterns you would like to match against inyour settings.py file. The default is a regex pattern to remove *.pyc files. (NOTE: Theregex matches against the full qualified path).CLEAN_PATTERNS = [r'^.+\.pyc$',]Usage-----From your shell, type:python manage.py cleanThis will prompt you to remove files that match the regular expression patterns.If you are confident in your regex, you can supply a --force option which will not promptyou before removing pattern matches.
Package: django-cleanup-later
django-cleanup-laterA quick, rough around the edges Django application to remember and remove temporary files.The purpose of this application is to allow the user to create a temporary file (e.g. for the purpose of streaming or to allow a time limited availability)
and automatically remove it after a given period of time.At present this can be done automatically using the provided middleware, manually by running thecleanup_latermanagement command, or by calling theCleanupFile.cleanup()function directly.It's been developed and tested on Python 3.7 and Django 2.2 .. your mileage may vary with other configurations.InstallationInstall via pip or download the repository:pip install django-cleanup-laterAdd the app to your INSTALLED_APPS setting:INSTALLED_APPS = [
        ...
        'cleanup_later',
    ]Make sure to migrate:manage.py migrateAnd optionally add the middleware if you want files to be removed automatically without the need for a cron or background process:MIDDLEWARE = [
    ...
    'cleanup_later.middleware.CleanupMiddleware',
]Note that using the middleware probably isn't the most efficient approach.  If your project is using a cron or celery for background processing, it's more efficient to run the cleanup from there.UsageTo use the app, simply register the filename you would like to later cleanup like so:from cleanup_later.models import CleanupFile

CleanupFile.register('file_to_delete.txt')By default, files will be deleted after 10 minutes, but you can override this by specifying avalidityparameter as a timedelta .. e.g.CleanupFile.register('file_to_delete.txt', timedelta(minutes=30))Simples!ContributingPull requests are welcome if you find this library useful.
Package: django-clearable-widget
django-clearable-widget is a custom widget that adds a input clearing
button on any input fields that are using it. It clears the value, and
returns focus to that field.Installationpipinstalldjango-clearable-widgetExternal dependenciesjQuery - this is not included in the package since it is expected
that in most scenarios this would already be available.SetupAddclearable_widgettoINSTALLED_APPS:INSTALLED_APPS+=('clearable_widget',)and just includeclearable_widgettemplates{%include"clearable_widget/clearable_widget_css.html"%}{# Before the closing head tag #}{%include"clearable_widget/clearable_widget_js.html"%}{# Before the closing body tag #}When deploying on production server, don’t forget to run:pythonmanage.pycollectstaticUsageAll you need now is to importClearableInputclass and override
field’s widget, for example:fromclearable_widgetimportClearableInputclassForm(forms.Form):field=forms.CharField(widget=ClearableInput)Please seeexampleapplication. This application is used to
manually test the functionalities of this package. This also serves as
a good example.You need only Django 1.4 or above to run that. It might run on older
versions but that is not tested.Licensedjango-clearable-widgetis released under the BSD license.Changes1.0.0 (2021-11-30)Added Django 3+ support.Dropped Python 2.7 support.Dropped Django 1.10 / 1.11 support.
Package: django-clearcache
Django ClearCache 🤠🧹💰Allows you to clear Django cache via admin UI or manage.py command.InstallationInstall using PIP:pip install django-clearcacheAddclearcacheto INSTALLED_APPS, make sure it's abovedjango.contrib.admin:INSTALLED_APPS += [
    ...
    'clearcache',
    'django.contrib.admin',
    ...
]Add url to the mainurls.pyright above root admin url:```
urlpatterns = [
    path('admin/clearcache/', include('clearcache.urls')),
    path('admin/', admin.site.urls),
]
```UsageVia Django adminGo to/admin/clearcache/, you should see a form with cache selectorPick a cache. Usually there's one default cache, but can be more.Click the button, you're done!Via manage.py commandRun the following command to clear the default cachepython manage.py clearcacheRun the command above with an additional parameter to clear non-default cache (if exists):python manage.py clearcache cache_nameFollow meCheck my dev blog with Python and JavaScript tutorials athttps://timonweb.comFollow me on twitter@timonweb