Saravanan666/pypi-org huggingface dataset:
Package: django-user-settings
# Django User Settings## InstallationInstall using `pip`:```bashpip install django-user-settings```## Requirements**django-user-settings** requires these:- django- psycopg2## ExamplePut `user_settings` to `INSTALLED_APPS` in `settings.py` like this:```pythonINSTALLED_APPS= (...'user_settings',)```**Optional:If you don't use your User model, django-user-settings will use default django User model.```pythonfrom django.contrib.auth.models import User```Otherwise, you will need to add your User model to `AUTH_USER_MODEL` in `settings.py`:```pythonAUTH_USER_MODEL = 'myapp.MyUser'```Now, you are ready to use **django-user-settings**, start with importing:```pythonfrom user_settings.utils import get_user_setting, set_user_setting``````pythonget_user_setting(key, default_value=None, **kwargs)```Return user's setting in Python's dictionary**Arguments**`key`: setting's name`default_value`: if **django-user-settings** cannot find suitable settings, this will be set to value of this key`**kwargs`:```'request': django's request'uid': PK of user you want to get setting```If you pass both `request` and `uid`, **django-user-settings** will get settings of user with pk=`uid`.If you pass only `request`, **django-user-settings** will get settings of current authenticated user.If you pass `uid` = None, **django-user-settings** will get settings with no specific user.```pythonset_user_setting(key, value, **kwargs)```**Arguments**`key`: setting's name`value`: setting's value`**kwargs`:'request': django's request, we will use this to get current authenticated user.'uid': ID of user whose settings will be saved.If you pass both `request` and `uid`, **django-user-settings** will save settings for user with pk=`uid`.If you pass only `request`, **django-user-settings** will save settings for current authenticated user.If you pass `uid` = None, **django-user-settings** will save settings with no specific user.
Package: django-users-login
Django Users LoginDjango Users Login is a extension interface to users in django application login. It’s inspired in devise (Ruby gem for
RoR) but not so complex like it.The main task is authenticate user using django authentication:Authenticate users it’s a repetitive task to implement this although django make this easier for us;Provide graphic default template to do it.LinksDocumentationRepositoryRevisions0.1Template to login, logout, password recover;Django>=1.5.4 support;Customizable template.Usage
Package: django-userswitch
A quick ‘n’ dirty django app for switching between different users while testing.“Quick and dirty”. Just include the middleware. That’s it!Provides a select box with a list of users.User list can be defined insettingsor all users are loaded.Works only whensettings.DEBUGisTrueRequirementsDjango 1.2InstallationTo install the latest version:pip install git+git://github.com/ikraftsoft/django-userswitch#egg=django-userswitchIt can also be installed from PyPI withpiporeasy_install:pip install django-userswitch
easy_install install django-userswitchSetup & UsageAdduserswitchmiddleware to theMIDDLEWARE_CLASSESin settings.py after the default middlewares:MIDDLEWARE_CLASSES = (
  'django.middleware.common.CommonMiddleware',
  'django.contrib.sessions.middleware.SessionMiddleware',
  'django.middleware.csrf.CsrfViewMiddleware',
  'django.contrib.auth.middleware.AuthenticationMiddleware',
  'django.contrib.messages.middleware.MessageMiddleware',
  ...
  'userswitch.middleware.UserSwitchMiddleware',
)Optionally you can addUSERSWITCH_OPTIONSdict to the settings.py:USERSWITCH_OPTIONS = {
    'css_class': '',       # CSS class to be added to the switcher widget. Default='userswitch'.
    'css_inline': '',      # Inline css for the switcher widget, if any
    'content_types': (),   # a tuple of content-type for which to render switcher widget. Default = ('text/html', 'application/xhtml+xml')
    'auth_backend': '',    # Custom auth backend if any. Default = 'django.contrib.auth.backends.ModelBackend'
    'replace_text': '',    # Text to replace with the widget, default add to end "body" tag.
    'users': (),           # List of usernames(as strings) to be shown in the switcher widget. If its empty, all users are loaded.
    'force_on': False,     # Turns on USERSWITCH even if DEBUG = False
}Note: default value ofcss_inlineoption provides some basic absolute
positioning. To change those either specifycss_inlineoption
manually or overrideposition,top,rightin the class
specified incss_classwith!important.That’s All!
Package: django-userswitch-fork
A quick ‘n’ dirty django app for switching between different users while testing.“Quick and dirty”. Just include the middleware. That’s it!Provides a select box with a list of users.User list can be defined insettingsor all users are loaded.Works only whensettings.DEBUGisTrueRequirementsDjango 1.2InstallationTo install the latest version:pip install git+git://github.com/ikraftsoft/django-userswitch#egg=django-userswitchIt can also be installed from PyPI withpiporeasy_install:pip install django-userswitch
easy_install install django-userswitchSetup & UsageAdduserswitchmiddleware to theMIDDLEWARE_CLASSESin settings.py after the default middlewares:MIDDLEWARE_CLASSES = (
  'django.middleware.common.CommonMiddleware',
  'django.contrib.sessions.middleware.SessionMiddleware',
  'django.middleware.csrf.CsrfViewMiddleware',
  'django.contrib.auth.middleware.AuthenticationMiddleware',
  'django.contrib.messages.middleware.MessageMiddleware',
  ...
  'userswitch.middleware.UserSwitchMiddleware',
)Optionally you can addUSERSWITCH_OPTIONSdict to the settings.py:USERSWITCH_OPTIONS = {
    'css_class': '',       # CSS class to be added to the switcher widget. Default='userswitch'.
    'css_inline': '',      # Inline css for the switcher widget, if any
    'content_types': (),   # a tuple of content-type for which to render switcher widget. Default = ('text/html', 'application/xhtml+xml')
    'auth_backend': '',    # Custom auth backend if any. Default = 'django.contrib.auth.backends.ModelBackend'
    'replace_text': '',    # Text to replace with the widget, default add to end "body" tag.
    'users': (),           # List of usernames(as strings) to be shown in the switcher widget. If its empty, all users are loaded.
    'force_on': False,     # Turns on USERSWITCH even if DEBUG = False,
    'onchange_redirect_url': '/'    # The url to redirect the user to onchange of user selection.
}Note: default value ofcss_inlineoption provides some basic absolute
positioning. To change those either specifycss_inlineoption
manually or overrideposition,top,rightin the class
specified incss_classwith!important.That’s All!
Package: django-user-tel
django-user-telInstallation•Contributing•LicenseCustom, simple Django User model with phone number as usernameInstallationUse your preferred package manager (pip,poetry,pipenv) to install the package. For example:$poetryadddjango-user-telThen register 'user_tel', in the 'INSTALLED_APPS' section of your project's settings.# settings.py...INSTALLED_APPS=(...'user_tel',)...Set AUTH_USER_MODEL - Since it's a custom User model Django needs to know the path of the model# settings.py...AUTH_USER_MODEL='user_tel.User'...ContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.LicenseMIT License
Package: django-user-timeline
Django app for displaying a timeline of events.BackgroundThis is a very simple Django app that stores ‘events’ against a User object,
providing a timeline of user events. It’s very open, the events don’t relate
to anything concrete (this isn’t a model auditing app, although there is an
optionalGenericForeignKeyon theEventmodel that you _can_ use if you
wish) - it’s just a list of timestamped objects that can be used to track
user interactions. Each event in the timeline has acategoryand amessagefield, along with a JSON field that can be used to store
unstructured additional data. An event can optionally be related to another
model via a generic foreign key.The rendering of events is up to you - there is no default.InstallationThe project is available through PyPI asdjango-user-timeline:$ pip install django-user-timelineAnd the main package itself is justtimeline:>>>fromtimelineimportmodels,views,urls,adminUsageWhenever something interesting happens, add an event. That’s it.>>>from.modelsimportProduct,add_to_basket>>>fromtimeline.modelsimportTimelineEvent>>>defadd_product(request,product_id):..."""View function to add product to user's basket."""...product=get_object_or_404(Product,id=id)...add_to_basket(request.user,product)...event=TimelineEvent.objects.create_event(...user=request.user,...category='add_to_basket',...message='You added%sto your basket'%product,...content_object=product,...context={..."product_id":product_id,..."price_paid":10.00,..."on_sale":False...}...)...returnHttpResponse("...")How you use the timeline is up to you - display it on the site, use
it for reporting, etc. A user’s timeline is available directly via
therelated_nameproperty oftimeline:>>>fromdjango.contrib.auth.modelsimportUser>>>fromtimeline.modelsimportTimelineEvent>>>user=User.objects.get(id=1)>>>assertuser.timeline.all()==TimelineEvent.objects.filter(user=user)TestsTests are run usingtox, and are run on commit pushes through Travis-CI.ContributingStandard GH rules apply: clone the repo to your own account, create a branch, make sure you update the tests, and submit a pull request.StatusThis is currently a placeholder for an application that is in development (hence 0.0.0).
Package: django-user-trace
django-user-traceA Pythonloggingfilter forDjangouser attributesdjango-user-traceprovides a Pythonloggingfilter that
injects attributes from the currently logged inDjangouser.It uses aContextVarto store user attributes for use on
the current thread. These are then injected into all log records via a logging
filter.Visit the documentation.sequenceDiagram
    actor User
    User ->>+ django: make request
    django ->>+ django.contrib.auth: AuthenticationMiddleware
    django.contrib.auth ->>+ django: set `request.user`
    django ->>+ django_user_trace: django_user_trace_middleware
    note over django, django_user_trace: Capture relevant user attributes into a `ContextVar`
    django_user_trace ->>+ django: continue
    django --> logging: log message
    logging ->>+ django_user_trace: get user attrs
    django_user_trace -->> logging: `ContextVar` for user attrs
    django ->>+ django_user_trace: signal `request_finished`
    note over django, django_user_trace: Clear user attributes from the `ContextVar`
    django_user_trace ->>+ django: continue
    django -->> User: send responseSupportsCelery task loggingResourcesDjango — How to configure and use loggingRelated Projectsmadzak/python-json-loggersnok/django-guidInstallationInstall viapip:pipinstalldjango-user-traceOr, viapoetry:poetryadddjango-user-traceContributingThank you for considering contributing todjango-user-trace! Please see theContribution Guidelines.Security VulnerabilitiesPlease review theSecurity Policyon how to report security
vulnerabilities.Licencedjango-user-traceis open-sourced software licenced under theMIT licence.
Package: django-user-unique-email
Reusable User model with required unique email field and mid-project support.It defines custom User model reusing of the original table (auth_user) if exists.
If needed (when added to existing project),
it recreates history of applied migrations in the correct order.Adding to existing projectBackup the databaseEnsure that any reference to User model (in your project and all third-party apps) uses ‘AUTH_USER_MODEL’ setting or ‘get_user_model’.Ensure that there are no duplicit or empty emails in table ‘auth_user’.Test it on a clone of your project, before you try to deploy it to production server.Installationpipinstalldjango-user-unique-emailConfigurationAdd ‘user_unique_email’ to INSTALLED_APPS and set AUTH_USER_MODEL in settings:# Add user_unique_email to INSTALLED_APPSINSTALLED_APPS.append('user_unique_email')# Custom User modelAUTH_USER_MODEL='user_unique_email.User'
Package: django-user-visit
django-user-visitDjango app for recording daily user visitsCompatibilityThis package supports Python 3.8 and above and Django 3.2 and above.Upgrading from v1 to v2v2 added three new denormalised fields extracted from the User Agent
string - device, os, browser - to make it easier to analyse directly
in the database.If you want to backfill historical data you will need to run the
management commandupdate_user_visit_user_agent_dataafter the
upgrade.This app consists of middleware to record user visits, and a singleUserVisitmodel to capture that data.The principal behind this isnotto record every single request made
by a user. It is to record each daily visit to a site.The one additional factor is that it will record a single daily visit
per session / device / ip combination. This means that if a user visits
a site multiple times from the same location / same device, without
logging out, then they will be recorded once. If the same user logs in
from a different device, IP address, then they will be recorded again.The goal is to record unique daily visits per user 'context' ( where
context is the location / device combo).Admin list view:Admin edit view:
Package: django-usuario
Usuario es una extensión al modelo User de Django que permite el usar una instancia de User (manejo de permisos, pertenencia a grupos) y además poder usar desde esa instancia campos agregados por el usuario. Por defecto ya vienen agregados 4 campos: nombre, apellido paterno, apellido materno y foto (una simple imagen).Quick startAgregue “usuario” a su INSTALLED_APPS en el archivo settings de la siquiente forma:INSTALLED_APPS = (
    ...
    'usuario',
    ...
)Al interior de la carpeta /MEDIA/usuarios/ (crearla si no existe) agregar una imagen llamada “Anonimo.png” que servirá de imagen por defecto para un usuarioEjecutarpython manage.py makemigrationsypython manage.py migratepara crear el modelo Usuario.OPCIONALSi quiere extender más la clase Usuario simplemente debe crear otro modelo que se herede de esa clase tal como se muestra a continuación:from usuario.models import Usuario
class NuevoUsuario(Usuario):
    campo_nuevo = models.CharField(max_length=50, null=True)
    def get_campo_nuevo(self):
        return self.campo_nuevoEjecutarpython manage.py makemigrationsypython manage.py migratepara crear el modelo NuevoUsuario.Podrá crear nuevas instancias de su modelo (recordar que los campos obligatorios de User deben ser llenados):>>> u = NuevoUsuario.objects.create(username="a", password="b", nombre="c", campo_nuevo="d")Podrá acceder a los diferentes campos de la siguiente forma:>>> u = User.objects.get(username="a")
>>> u.nombre
<<< 'c'
>>> u.nuevo_campo
<<< 'd'
>>> u.get_nuevo_campo()
<<< 'd'CHANGELOGv0.4Creado formulario que crea y edita usuariosv0.3Permitida la guardar la instancia de User cuando se guarda la instancia de Usuariov0.2Creación de claves de usuario con el método ‘set_password’v0.1Proyecto inicial
Package: djangout
This package offersDjango-specificBuildoutrecipes, such as:One that makes available the path to the Django Admin media in the Buildout
parts, so it can be referenced from other recipes (e.g., to generate an
Apache virtual host configuration that serves these media).The end-user manual is available at:http://packages.python.org/djangout/DjangoutreleasesVersion 1.0 Alpha 1 (2010-02-18)Implemented theadmin_mediarecipe.Version 1.0 (2011-07-04)Updated package information.Version 1.1 (2013-03-08)Updated recipe to work with Django 1.4 (specifically new staticfiles app).WarningThis is a backward incompatible change. For versions of Django <1.4, use
version 1.0 of djangout.
Package: django-uta
The idea is simple.When you have a template wich is of known type you render it correctly.Currently Jinja2, Mako and HamlPy are recognized by extensions respectively:- .jinja2.html- .mako.html- .hamlpyThat said, if you have few apps using different templates in one project or want to use specific templates in part of project, it can be achieved easily.To use this simply install required templates libraries and add 'uta' to INSTALLED_APPS.
Package: django-utf8field
This package was created because at my work,Language and Translation Technology Teamat the University of Ghent, we often create demos on the web that allow the user to input and process text or files. These texts are then processed by other scripts that expect clean UTF-8-texts.
This library extends the Django FileField, CharField and TextField by checking if the content of a submitted file or text is clean. If not, it generates an error. Checks are executed for four byte long characters and NULL characters.RequirementsDjango >= 1.8Installationpip install django-utf8fieldUsageAdd the app to your settings:INSTALLED_APPS = (
    ...
    'utf8field',
    ...FileFieldCreate a model like you would do normally, but instead of using FileField you use UTF8FileField:from django.db import models
from utf8field.fields import UTF8FileField

class YourModel(models.Model):
    title = models.CharField(max_length=255)
    created_on = models.DateTimeField(auto_add_on=True)
    text = models.UTF8FileField()You also have the option to provide the optionmax_content_lengthto limit the number of characters in the file. If the content is longer an error will be displayed. If you want to enablefour_byte_detectionset the parameter to True.text = models.UTF8FileField(max_content_length=1000, four_byte_detection=True)CharFieldCreate a model like you would do normally, but instead of using CharField you use UTF8CharField. If you want to enablefour_byte_detectionset the parameter to True.from django.db import models
from utf8field.fields import UTF8CharField

class YourModel(models.Model):
    title = models.CharField(max_length=255, four_byte_detection=True)
    created_on = models.DateTimeField(auto_add_on=True)
    text = models.UTF8CharField(max_length=1000)TextFieldCreate a model like you would do normally, but instead of using TextField you use UTF8TextField. If you want to enablefour_byte_detectionset the parameter to True.from django.db import models
from utf8field.fields import UTF8TextField

class YourModel(models.Model):
    title = models.CharField(max_length=255)
    created_on = models.DateTimeField(auto_add_on=True)
    text = models.UTF8TextField(four_byte_detection=True)Django Rest FrameworkThe necessary serializers and automatic mapping of fields is provided so you should not be doing anything yourself to get the texts or files validated when using a ModelSerializer.DevelopmentTo run the tests make sure Django, Django Rest Framework and coverage are installed (pip install django djangorestframework coverage) and executepython manage.py testTo create extra translations, executepm makemessages --locale=nl --extension=py --ignore=dev_example --ignore=build… and modify the resultingdjango.pofile inutf8field/locale/nl/LC_MESSAGES.
Package: djangoutillib
Django Utility Library is a small collection of generic functions and classes
for use with Django. Other than django there are no external dependencies.Working with CHOICES tuplesDjango provides no easy way for doing lookup in CHOICES tuples other thanget_FIELD_display()in a database context. For using CHOICES tuples without
a database and for doing reverse lookup this library has two functions:get_choice_nameandget_choice_value. Furthermore there is a function
to ‘translate’ a CHOICES tuple with groups to a ‘flat’ tuple.
For the following examples, these CHOICES tuples are used:SIMPLE_CHOICES = (
        (0, 'zero'),
        (1, 'one'),
        (2, 'two'),
        (3, 'three'),
)
GROUPED_CHOICES = (
        ('group1', (
                (0, 'zero'),
                (1, 'one'),
        )),
        ('group2', (
            (2, 'two'),
            (3, 'three'),
        )),
        ('nogroup', 'four'),
)get_choice_name()Returns the human readable name of the specified (database) value, which works
on a flat CHOICES tuple as well as one with groups:>>> import djangoutillib.utils as du
>>> du.get_choice_name(SIMPLE_CHOICES, 2)
two
>>> du.get_choice_name(SIMPLE_CHOICES, 5)
KeyError: 5
>>> du.get_choice_name(GROUPED_CHOICES, 3)
three
>>> du.get_choice_name(GROUPED_CHOICES, 'nogroup')
fourget_choice_value()Returns the (database) value of the specified human readable name, which works
on a flat CHOICES tuple as well as one with groups:>>> import djangoutillib.utils as du
>>> du.get_choice_value(SIMPLE_CHOICES, 'two')
2
>>> du.get_choice_value(GROUPED_CHOICES, 'three')
3
>>> du.get_choice_value(GROUPED_CHOICES, 'four')
nogroup
>>> du.get_choice_value(GROUPED_CHOICES, 'five')
KeyError: 'five'degroup_choices()Returns a version of grouped_choices with its groups removed:>>> import djangoutillib.utils as du
>>> du.degroup_choices(GROUPED_CHOICES)
[(0, 'zero'), (1, 'one'), (2, 'two'), (3, 'three'), ('nogroup', 'four')]
Package: django-utils2
Build status:Coverage:Django Utils is a collection of small Django helper functions, utilities and
classes which make common patterns shorter and easier. It is by no means a
complete collection but it has served me quite a bit in the past and I will
keep extending it.Examples are:Admin Select (Dropdown) filtersAdmin Select2 (Autocomplete dropdown) filtersAdmin JSON sub-field filtersEnum based choicefieldsModels with automatic__str__,__unicode__and__repr__functions
based on names and/or slugs using simple mixins.Models with automaticupdated_atandcreated_atfieldsModels with automatic slugs based on thenameproperty.Iterating through querysets in predefined chunks to prevent out of memory
errorsThe library depends on the Python Utils library.Documentation is available at:http://django-utils-2.readthedocs.io/en/latest/InstallTo install:Runpip installdjango-utils2or executepython setup.py installin the source directoryAdddjango_utilsto yourINSTALLED_APPSIf you want to run the tests, runpy.test(requirements intests/requirements.txt)Admin Select / Dropdown / Autocomplete (JSON) FiltersAll of the standard admin list filters are available throughdjango_utils .admin.filtersas:The original filter (e.g.SimpleListFilter)A basic select/dropdown filter:SimpleListFilterDropdownA select2 based autocompleting dropdown filter:SimpleListFilterSelect2On PostgreSQL you can additionally filter on JSON fields as well given paths:classSomeModelAdmin(admin.ModelAdmin):list_filter=(JSONFieldFilterSelect2.create('some_json_field__some__sub_path'),)That will filter a JSON field namedsome_json_fieldand look for values
like this:{"some":{"sub_path":"some value"}}By default the results for the JSON filters are cached for 10 minutes but can
be changed through thecreateparameters.Choices usageTo enable easy to use choices which are more convenient than the Django 3.0 choices system you can use this:fromdjango_utilsimportchoices# For manually specifying the value (automatically detects ``str``, ``int`` and ``float``):classHuman(models.Model):classGender(choices.Choices):MALE='m'FEMALE='f'OTHER='o'gender=models.CharField(max_length=1,choices=Gender)# To define the values as ``male`` implicitly:classHuman(models.Model):classGender(choices.Choices):MALE=choices.Choice()FEMALE=choices.Choice()OTHER=choices.Choice()gender=models.CharField(max_length=1,choices=Gender)# Or explicitly define themclassHuman(models.Model):classGender(choices.Choices):MALE=choices.Choice('m','male')FEMALE=choices.Choice('f','female')OTHER=choices.Choice('o','other')gender=models.CharField(max_length=1,choices=Gender)A PostgreSQL ENUM field will be coming soon to automatically facilitate the creation of the enum if needed.LinksDocumentationhttp://django-utils-2.readthedocs.org/en/latest/Sourcehttps://github.com/WoLpH/django-utilsBug reportshttps://github.com/WoLpH/django-utils/issuesPackage homepagehttps://pypi.python.org/pypi/django-utils2My bloghttp://w.wol.ph/