Saravanan666/pypi-org huggingface dataset:
Package: django-slug-model-mixin
Slugify model mixin to manage slugged fields in your project models.DocumentationThe full documentation is athttps://django-slug-model-mixin.readthedocs.io.QuickstartInstall Django Slug Model Mixin:pip install django-slug-model-mixinAdd it to yourINSTALLED_APPS:INSTALLED_APPS=(...'slug_model_mixin',...)Use the SlugModelMixin in your model:classExampleModel(SlugModelMixin,models.Model):slugged_field='name'# insert the name of the field you want to slugifyslug_unique=False# remove unique for your slugforce_slugify=True# force the slugify using uuslugname=models.CharField('Name',max_length=255)classMeta:verbose_name='Example Model'verbose_name_plural='Example Models'Running TestsDoes the code actually work?source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ toxDevelopment commandspip install -r requirements_dev.txt
invoke -lCreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageHistory0.1.1 (2021-10-07)First release on PyPI.0.1.2 (2021-09-07)Rework on Mixin to work only on py30.1.3 (2021-10-07)Rework configurations and README0.1.4 (2021-10-07)Rework configurations and added github actions0.1.5 (2021-10-07)Added pipy on github actions and fixed setup.py0.1.6 (2021-10-07)Changed from test.pipy.org to pipy.org0.1.7 (2021-10-07)Updated github action0.1.7 (2021-10-07)Updated github action0.1.8 (2021-10-19)Updated version for github actions and changed name to django-slug-model-mixin0.1.9 (2021-10-19)Updated version for github actions0.2.0 (2021-11-22)Fixed slug with spaces bug
Package: django-slug-preview
django-slug-previewAn advanced slug field offering live URL previews.This is inspired by the “Permalink” preview that WordPress offers.
While not looking as fancy yet, this is a good start for Django projects.
Improvements are welcome!InstallationFirst install the module, preferably in a virtual environment.
It can be installed from PyPI:pip install django-slug-previewOr the current folder can be installed for development:pip install -e .Addslug_previewto yourINSTALLED_APPS:INSTALLED_APPS+=('slug_preview',)UsageUseslug_preview.models.SlugPreviewFieldin your models instead of the standardmodels.SlugField.Addslug_preview.forms.SlugPreviewFormMixinin your forms.For example:fromdjango.dbimportmodelsfromslug_preview.modelsimportSlugPreviewFieldclassMyModel(models.Model):slug=SlugPreviewField(_("Slug"))In the admin you can use theSlugPreviewModelFormshortcut:fromdjango.contribimportadminfromdjangoimportformsfromslug_preview.formsimportSlugPreviewModelForm@admin.register(MyModel)classMyModelAdmin(admin.ModelAdmin):form=SlugPreviewModelFormIn custom forms, useSlugPreviewFormMixindirectly:fromdjangoimportformsfromslug_preview.formsimportSlugPreviewFormMixinfrom.modelsimportMyModelclassMyModelForm(SlugPreviewFormMixin,forms.ModelForm):classMeta:model=MyModelSpecial model URLSWhen a model has a custom URL layout (not just/{slug}/), you can add aget_absolute_url_format()method in the model.
For example:fromdjango.dbimportmodelsfromslug_preview.modelsimportSlugPreviewFieldclassPage(models.Model):parent=models.ForeignKey('self')slug=SlugPreviewField(_("Slug"))# ...defget_absolute_url(self):ifself.parent_id:return"{0}{1}/".format(self.parent.get_absolute_url(),self.slug)else:return"/{0}/".format(self.slug)defget_absolute_url_format(self):ifself.parent_id:return"{0}{{slug}}/".format(self.parent.get_absolute_url())else:return"/{slug}/"For a blog, you can add the/blog/{year}/{month}/format too:fromdjango.core.urlresolversimportreversefromdjango.dbimportmodelsfromdjango.utils.timezoneimportnowfromslug_preview.modelsimportSlugPreviewFieldclassArticle(models.Model):slug=SlugPreviewField(_("Slug"))pubdate=models.DateTimeField(default=now)# ...defget_absolute_url(self):root=reverse('article_list')return"{root}/{year}/{month}/{slug}/".format(root=reverse('article_list').rstrip('/'),year=self.pubdate.strftime('%Y'),monthy=self.pubdate.strftime('%M'),slug=self.slug)defget_absolute_url_format(self):root=reverse('article_list')pubdate=self.pubdateornow()return"{root}/{year}/{month}/{{slug}}/".format(root=reverse('article_list').rstrip('/'),year=pubdate.strftime('%Y'),monthy=pubdate.strftime('%M'),)Improving this packageThis module is designed to be usable for other projects too.
In case there is anything you didn’t like about it,
or think it’s not flexible enough, please let us know.
We’d love to improve it! Pull requests are welcome too. :-)
Package: django-slxauth
Consult the django-project-template on how to use it.Upgrade from 1.7 to 1.8In 1.8 there is a new username column introduced which removes unique identification responsibility from the email
column. To migrate existing users and populate the DB sucessfully add the following script to your migrations.
Fix the model name as needed and update the dependency to the last previous migration.Afterwards run makemigrations as usual to update other fields.populate username migration:import django.contrib.auth.validators
from django.db import migrations, models
from django.db.models import Count


def populate_usernames(apps, schema_editor):
        User = apps.get_model('app', 'User')

        for grp in User.objects.exclude(um_id__isnull=True).values('um_id').annotate(ct=Count('um_id')):
                if grp['ct'] > 1:
                        User.objects.filter(um_id=grp['um_id']).update(um_id=None)

        for u in User.objects.all():
                if u.um_id:
                        u.username = 'um_%s' % u.um_id
                else:
                        u.username = 'user_%s' % u.id
                u.save()


class Migration(migrations.Migration):

        dependencies = [
                ('app', '0009_auto_20180208_1339'),
        ]

        operations = [
                migrations.AddField(
                        model_name='user',
                        name='username',
                        field=models.CharField(null=True,
                                                                   help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.',
                                                                   max_length=150, unique=False,
                                                                   validators=[django.contrib.auth.validators.UnicodeUsernameValidator()],
                                                                   verbose_name='username'),
                ),
                migrations.RunPython(populate_usernames),
                migrations.AlterField(
                        model_name='user',
                        name='username',
                        field=models.CharField(error_messages={'unique': 'A user with that username already exists.'},
                                                                   help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.',
                                                                   max_length=150, unique=True,
                                                                   validators=[django.contrib.auth.validators.UnicodeUsernameValidator()],
                                                                   verbose_name='username'),
                )
        ]
Package: django-sm8-jobs
Jobs is an add-on for ServiceM8. Allow customers to easily schedule jobs from a “customer portal”.Detailed documentation is in the “docs” directory.Quick startAdd “jobs” and “bootstrap3” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'jobs',
    'bootstrap3',
]Include the polls URLconf in your project urls.py like this:url(r'^jobs/', include('jobs.urls')),Runpython manage.py migrateto create the polls models.Start the development server and visithttp://127.0.0.1:8000/admin/to create a poll (you’ll need the Admin app enabled).Visithttp://127.0.0.1:8000/polls/to participate in the poll.
Package: django-smalluuid
InstallationInstallation using pip:pip install django-smalluuidTested on:Django >= 2.2 <= 4.0Python 3.7, 3.8, 3.9, 3.10Basic UsageTo get started use theSmallUUIDFieldfield in your model definitions:fromdjango.dbimportmodelsfromdjango_smalluuid.modelsimportSmallUUIDField,uuid_defaultclassExampleModel(models.Model):uuid=SmallUUIDField(default=uuid_default())The field provides values as instances ofSmallUUID(seesmalluuid):>>>obj=ExampleModel.objects.create()# The initial UUID has been auto-generated by uuid_default()>>>obj.uuidSmallUUID('T1q_P6HcQNSyW6tpqJTxww')# It is still available in the groupex hex form (if needed)>>>obj.hex_grouped'4f5abf3f-a1dc-40d4-b25b-ab69a894f1c3'# Filtering is done on the shortened UUIDs>>>ExampleModel.objects.filter(uuid='T1q_P6HcQNSyW6tpqJTxww')[<ExampleModel:ExampleModelobject>]Typed Usagedjango-smalluuidalso supports the Typed UUID’s as provided bysmalluuid. This
allows for the object’s type to be stored within the UUID.Updating the above example:fromdjango.dbimportmodelsfromdjango_smalluuid.modelsimportSmallUUIDField,uuid_typed_defaultclassTypedExampleModel(models.Model):uuid=SmallUUIDField(default=uuid_typed_default(type=42))Which can be interacted with as follows:>>>obj=TypedExampleModel.objects.create()>>>obj.uuidTypedSmallUUID('qvyk8nzbQfu8zAnTPQweyw')>>>obj.uuid.type42Creditsdjango-smalluuid is packaged usingseedand relies uponsmalluuid.
Package: django-smartadmin
Django’s defaultModelAdminis kinda dull. It only displays the__unicode__column and that’s it.SmartAdminattempts to create some
more useful defaults forlist_display,list_filter, etc., based on the
model. (You can still manually specify whatever you want of course.)This may be useful to you if you create new models often and want to have a
usable admin for them without much work.Installationpip install django-smartadminUsageJust usesmartadmin.SmartAdmininstead ofdjango.contrib.admin.ModelAdmin:fromsmartadminimportSmartAdminclassMyModelAdmin(SmartAdmin):pass# or override somethingadmin.site.register(MyModel,MyModelAdmin)# or just:admin.site.register(MyModel,SmartAdmin)
Package: django-smart-admin
django-smart-adminSmartAdmin is a set of small Django Admin utilities that aims to remove some of the common annoying configuration
issues:It is not intended to be a fully replacement of the official Admin, but only offers a set of mixin/utilities the often (
at least for me)
need to be copied/pasted in each project.Bonuseasily group models by context instead by appdisplay admin logentry for any userdisplay group membersdisplay user permissionsdisplay permission ownersDisplay all columns ModelAdmin mixinlog added/removed permissions for User/Grouplog added/removed groups for Userability to setreadonly_fields = ('__all__',)(ReadOnlyMixin)display all model fields inchangelist(DisplayAllMixin)automatically creates filter for each indexed field (SmartAutoFilterMixin)improved fieldset allows the use of__others__to include any field not included in others fieldsets (FieldsetMixin)ability to customise Autocomplete labelsuser defined "site panels"Demo is available athttps://django-smart-admin.herokuapp.com/.
(Any user/password combination is accepted)ComponentsLinkedObjectsMixinReadOnlyMixinFieldsetMixinDisplayAllMixinInstallpip install django-smart-adminor (if you want to install extra admin features)pip install django-smart-admin[full]In yoursettings.pyINSTALLED_APPS=[# "django.contrib.admin",  # removes standard django admin'django_sysinfo',# optional'adminactions',# optional'adminfilters',# optional'admin_extra_buttons',# optional'smart_admin.apps.SmartTemplateConfig',# templates'smart_admin',# use this instead of 'django.contrib.admin''smart_admin.apps.SmartLogsConfig',# optional:  log application'smart_admin.apps.SmartAuthConfig',# optional: django.contrib.auth enhancements]SMART_ADMIN_SECTIONS={'Demo':['demo',],'Security':['auth','auth.User',],'Logs':['admin.LogEntry',],'Other':[],'_hidden_':["sites"]}# add some bookmarkSMART_ADMIN_BOOKMARKS=[('GitHub','https://github.com/saxix/django-smart-admin')]# no special permissions to see bookmarksSMART_ADMIN_BOOKMARKS_PERMISSION=None# add 'profile' link on the headerSMART_ADMIN_PROFILE_LINK=True# display all users action log, not only logged userSMART_ADMIN_ANYUSER_LOG=TrueIn yoururls.pyfromdjango.contribimportadminfromdjango.urlsimportinclude,pathimportadminactions.actionsasactionsfromdjango.contrib.adminimportsiteadmin.autodiscover()actions.add_to_site(site)urlpatterns=[path('',admin.site.urls),path('adminactions/',include('adminactions.urls')),]Project LinksCode:https://github.com/saxix/django-smart-adminPyPi:https://pypi.org/project/django-smart-admin/
Package: django-smartcc
# django-smartccSet some cache-related headers automatically, defining not-authenticatedrequests as public and authenticated requests as private. You can also customize these values for specific URLs. This middleware class will also setup these HTTP headers:* Vary* Cache-Control* ExpiresThis middleware works and is designed to integrate Django with CloudFlare Cache (or similar services). Used in production on MinbilDinbil.dk servers.## InstallationAdd django-smartcc on your requirements.txt file or just launch:pip install -U django-smartccThen add django-smartcc in the installed apps and in the middleware, so add these line in your settings.py file.# settings.pyINSTALLED_APPS += ['smart_cache_control',]MIDDLEWARE_CLASSES += ['smart_cache_control.middleware.SmartCacheControlMiddleware']**Note**: Remember that this middleware requires authentication, so it should be loaded after the *django.contrib.auth.middleware.AuthenticationMiddleware*!## Customization and SettingsYou can customize a specific Cache-control value on each URL. For exampleif we want to avoid cache on */hello/* , but always have it on */api/search* for 5 minutes, we should write this in our settings file:# settings.pySCC_CUSTOM_URL_CACHE = ((r'/hello/$', 'private', 0),(r'/api/search$', 'public', 300),)Other options are available to customize the behaviour of the middleware:**SCC_SET_VARY_HEADER**: Define if the middleware have to set the Vary header.Default value: *True***SCC_SET_EXPIRE_HEADER**: Define if the middleware should set the Expiresheader. Default value: *True***SCC_MAX_AGE_PUBLIC**: Define the default max-age value in seconds for publicrequests. Default value: *86400***SCC_MAX_AGE_PRIVATE**: Define the default max-age value in seconds forprivate requests. Default value: *0*
Package: django-smart-collectstatic
Author:Pahaz BlinovRepo:https://github.com/pahaz/django-smart-collectstatic/Micro fix Django manage.py collectstatic command.This fix uses COPY and LINK strategy for collecting static files.If the static file insettings.BASE_DIRit will be linked.
In other case it will be coppied.It tested only on Django 1.9, 1.10 and Python 3.4, 3.5Installationdjango-smart-collectstaticis on PyPI, so simply run:pip install django-smart-collectstaticoreasy_install django-smart-collectstaticto have it installed in your environment.For installing from source, clone therepoand run:python setup.py installIf you don`t havepipyou caninstall itTypical use caseI use it inside a Docker container. For callectiong Django static.Dockerfile:...
RUN python3 manage.py smartcollectstatic --noinput --link
...
Package: django_smartdbstorage
SmartDBStorage is a File Storage for Django that stores files in the database using Django Models.When the attachments or images are as important as the other data, you may want to store them in the database for better integrity and consistency.For example, this is specially useful to store original pictures which are displayed usingsorl thumbnail.Advantages : everything at the same place, no more broken links, better flexibility.
Disadvantages : performance, overall data usage.FeaturesMinimal configuration : just a pluggable Django app.Django model based : No database to create and setup manually. UsesSouth.Files are saved in chunks in order to limit memory usage.Original file names are preserved : no more logo_1.jpg, logo_2.jpg, logo_3.jpg “behind the scene” renames. (Files are renamed to /some_unique_id/original_file_name.ext)Files can be extracted to another File Storage when accessed from the web or be served directly from the database. (not recommended, but useful for debugging purposes)Basic admin for inspection purposes.CaveatsDjango doesn’t support blobs yet (planned in 1.6) so file chunks are saved in base64, which increases the overall storage requirements.InstallIn yoursettings.py, add'south'(if you don’t use it already) and'smartdbstorage'to yourINSTALLED_APPS:INSTALLED_APPS = (
    ...
    'south',
    'smartdbstorage'
)Insettings.py, it’s a good idea to set global defaults:SMARTDBSTORAGE_SERVE_DIRECTLY = False  # when accessed from the web files are either served directly or extracted to another file storage
SMARTDBSTORAGE_EXTRACTION_STORAGE = DEFAULT_FILE_STORAGEIn yoururls.py, add the following:(r'^some_prefix/', include('smartdbstorage.urls', namespace='smart_db_storage')),This allows to serve files directly from the database if needed.Example usageSimply specify a SmartDBStorage instance where you want to use it:class Article(models.Model):
    text = models.TextField()
    image = ImageField(upload_to='articles_images', storage=SmartDBStorage())You can override defaults like this:class Article(models.Model):
    text = models.TextField()
    image = ImageField(upload_to='articles_images', storage=SmartDBStorage(option=dict(extraction_storage=FileSystemStorage())))
Package: django-smart-extends
Contentsdjango-smart-extendsDependenciesHow to installHow to usePatcheReported0.7.0 (2013-10-05)0.6 (2012-11-07)0.5.1 (2011-12-03)0.5.0 (2011-01-11)django-smart-extendsdjango-smart-extends is a Django application that allows improve the extension system of Django templates.It is distributed under the terms of the license write in the same directory,
in the file COPYING.LGPLv3DependenciesDjango>= 1.5 (master branch)There are specific branches forDjango 1.5.X and 1.4.X,1.3.X and 1.2.X, and1.1.X(Also there is an old and unmaintained branch ofDjango 1.1.0without the last changes)How to installIn your settings.pyINSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.admin',

    ...

    'smartextends',

)And if you want:OVERWRITE_EXTENDS = TrueHow to useThis application is useful when you want to overwrite a template of a application in your project.
Currently this in Django produce infinite recursionThis is an example with django.contrib.admin app, but django-smart-extends works with any application,this is not only to the admin site. This is very useful if you use reusable django apps or any CMS implemented in django.If you set OVERWRITE_EXTENDS = Truefile:admin/change_list.html{% extends "admin/change_list.html" %}

{% block extrastyle %}
    {{ block.super }}
    <link rel="stylesheet" type="text/css" href="XXX" />
{% endblock %}Else:file:admin/change_list.html{% smart_extends "admin/change_list.html" %}

{% block extrastyle %}
    {{ block.super }}
    <link rel="stylesheet" type="text/css" href="XXX" />
{% endblock %}PatcheIf you set TEMPLATE_DEBUG = False in settings.py you must patch the django code. You can find the patch in the patches directoy:patch -p2 -N -d my/path/of/django/ < ./patches/patch.diffReportedTicket in Django tracPull request to Django repository0.7.0 (2013-10-05)Move the repository to githubAdd example projectAdd unit testsImprovements in the code (for each branch)Improvements in the patches (for each branchIntegration withTravisDetails0.6 (2012-11-07)Compatible with Django 1.4 (need Django patches when DEBUG_TEMPLATE is False)0.5.1 (2011-12-03)Compatible with Django 1.2 and Django 1.3 (need Django patches when DEBUG_TEMPLATE is False)0.5.0 (2011-01-11)Initial version
Package: django-smart-logging
django-smart-loggingPlugin for django-smart-admin that allows changing python logging configuration (level/handlers/propagate) without the need to restart the appConfigurationSMART_LOG_INSPECT = False
SMART_LOG_HANDLERS = 2  # 1 show handlers / 2 change handlers
SMART_LOG_MAXSIZE = 100
SMART_LOG_FORMAT = "%(levelname)s %(asctime)s %(module)s: %(message)s"
SMART_LOG_PREFIX = "smart-log"
SMART_LOG_REDIS = ""
SMART_LOG_DEBUG = False
Package: django-smart-media
A suit of tools to use a FileField to upload image with light SVG support, include
thumbnail preview in field and a template tag aroundsorl-thumbnaillibrary.DependanciesPython>=3.8;Django>=3.2,<4.2;sorl-thumbnail>=12.9.0;OverviewConcretely this contains:Form widgets to build HTML for aFileFieldeither with or without clearable
mode. Both mode have a version to include needed layout assets (CSS and Javascript)
and another one without assets;Form fields which already set a “smart” widget;Templates to build the widgets HTML;CSS and Javascript for the widget layout;Field validator;Model signals to purge stale files;Model field with all “smart” features;A template tag to make thumbnail safely with SVG image (original SVG is just used
without Sorl raising issue for a non bitmap image);Some helpers to ease some specific implementations;Although this can work withImageField, SVG support will only work withFileFieldsinceImageFieldrely on PIL that does not support SVG format.LinksRead the documentation onRead the docs;Download itsPyPi package;Clone it on itsGithub repository;
Package: django-smartmenus
A Django app that provides template tags to easily incorporate smartmenus (http://www.smartmenus.org/).InstallationTo get started usingdjango-smartmenus:install it withpip:$ pip install django-smartmenusadd the app toINSTALLED_APPS. If you are using Django CMS, make sure it’s beforemenus:INSTALLED_APPS = (
    ...
    'django_smartmenus',
    'menus', #Only if you are using Django CMS
    ...
)UsageThe best way to see how it works is exploring the example project. But for the impatient, all you need to do is:load smartmenus tags in the templates:{% load smartmenus_tags %}Call smartmenus template tags where css and js files should show:{% smartmenus_css theme %}
<script src="path/to/jquery"></script>
{% smartmenus_js %}themeis a string based parameter. Out of box,themecan be one of ‘sm-blue’, ‘sm-clean’, ‘sm-mint’ and ‘sm-simple’. If you create a custom theme of your own, please put the theme file under static folder following smartmenus theme folder structure convention, ie. smartmenus/css/theme/theme.css.Render menu html in the templates. Please refer to smartmenus tutorial to see what the html should be.This app also supports Django CMS:load smartmenus and menu tags in the templates:{% load menu_tags smartmenus_tags %}Call Django CMS specific template tags anywhere in the templates:{% addtoblock "js" %}<script src="path/to/jquery"></script>{% endaddtoblock %}
{% smartmenu_bootstrap_cms theme %}theme’s usage is the same as above.Render Django CMS menu:<ul class="sm theme-class-name">
    {% show_menu 0 100 100 100 %}
</ul>theme-class-nameis a string based parameter. Please refer to smartmenus doc regarding possible values. Usually it’s the same as theme name unless it’s a custom theme with different naming conventions.