Saravanan666/pypi-org huggingface dataset:
Package: djangorestversioning
# Simple versioning for [Django REST framework][docs][![pypi-version]][pypi]# OverviewDjango Rest Framework provides the ability to version an API via multiple methods, namespacing the URL, adding a version to the Accept header or query parameter, and provides this version to your code. However, it doesn't go further than this in helping split up what code is ran based on this version, leaving this a task up to the developer.This mixin allows the developer to set which class is ran depending on what version is passed to the API, without interferring with how DRF generic views work.# Requirements* Python 2.7+* Django Rest Framework 3.1+# InstallationInstall using `pip`...pip install djangorestversioning# ExampleMake sure you're using a versioning class in your `settings.py` (Rest Framework does not default to any versioning class)```pythonREST_FRAMEWORK = {'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.AcceptHeaderVersioning'}```Ensure you're using namespacing on your endpoints```pythonurlpatterns = patterns('',url(r'^api/', include(patterns('',url(r'^items/', include('items.urls')),), namespace='1.0')),)```You wire up your generic view URL's in the same way as before:```pythonfrom django.conf.urls import urlfrom items.views import ItemList# Wire up your API using generic viewsurlpatterns = [url(r'^items/$', ItemList.as_view())]```Ensure the resulting generic view has the versioning mixin, and that you provide a versions dictionary detailing where each version of the endpoint exists.```pythonfrom djangorestversioning.versioning import VersionedEndpointclass ItemList(VersionedEndpoint, APIView):"""List all items."""versions = {1.0 : 'api.v1.items.ItemList',2.0 : 'api.v2.items.ItemList'}```Each version of the endpoint can now do what it needs to do per version```python# v1class ItemList(ListAPIView):"""List all items for v1."""serializer_class = ItemSerializerqueryset = Item.objects.all()``````python# v2class ItemList(ListCreateAPIView):"""List all items for v2, enable creation on v2"""serializer_class = ItemSerializerqueryset = Item.objects.all()```# ConsiderationsIf you request a version which does not have a corresponding entry in the versions dictionary, the dispatcher will select the latest version available by running `max` on the keys of the versions. This requires that keys in the dictionary are numerical, and ordered. This could be improved upon in the future.If a module or class is not found, an `ImportError` or `AttributeError` will be raised.[pypi-version]: https://img.shields.io/pypi/v/djangorestversioning.svg[pypi]: https://pypi.python.org/pypi/djangorestversioning[docs]: http://www.django-rest-framework.org/
Package: django-restviews
django-restviews
REST-based Django CrUD-ViewsIntroductionDjango is a great framework for efficient, rapid, maintainable and scalable web applications. With the addition of REST frameworks like the Django REST Framework, an API-based approach to web development is also possible.This Django application fills one specific gap: If you have an API-based approach to your development, you don’t want to build a separate web UI, that is based on the Django view/template/model-framework and doesn’t adhere to your own API-standards.You want a UI, that specifically uses the API for data retrieval and manipulation. Having the API and not the web UI as a first class citizen is a primary goal of an API-based approach.The problem is, that you loose a whole bunch of development speed if you have to leave Django’s wonderful generic class based views behind and recreate the same functionality the AJAX/API-way.Django-Restviews helps you by offering a complete CrUD-framework (Create, Update, Delete) and a data grid that all use the API for data retrieval and manipulation and in that way offers an alternative for Django’s own class based generic views.For more information, please visithttps://github.com/dploeger/django-restviews
Package: django-rest-xauth
Welcome to django-rest-xauthDocumentationGoherefor quick-setup/start orherefor full documentation.Test runWith dockerRunmake build_image_and_run. You can then go tohttp://localhost:8000/and signin to the
default user account usingsuperuser@example.comas email anddemoprojectas password.To add extra options to the defaultdocker runcommand, usedocker_run_optionsin the make command
e.g.make run docker_run_options='-v ./:/app/'.Without dockerAfter setting up all requirements usingmake dev, start django server as you would in any project
e.g../manage.py runserver.ContributingPlease be sure to reviewcontributing guidelinesto learn how to help the project.
Package: django-results
提供django下结果页Quick startInstall:pip install django_resultsAdd “results” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'results',
]No MigrationsCreate results view:# config in urls
from results.views import ResultView
from sample import views as sample_views
urlpatterns = [
    url(r'^$', TemplateView.as_view(template_name='sample/index.html')),

    url('^result-view-class/$',
        ResultView.as_view(template_name='results/result.html',
                           title='sample出错标题',
                           message='sample出错信息',
                           type='info'),
        name='result_view_class'),

    url(r'^form-error/$', sample_views.form_error_view, name='form_error'),

    url(r'^error-result/$', ResultView.error_view, dict(title='出错标题', message='ResultView.error_view'),
        name='error_result'),
    url(r'^error-result/object-does-not-exist/$', ResultView.error_view, dict(error=ObjectDoesNotExist()),
        name='error_result_object_does_not_exist'),

    url(r'^result-view/success/$',
        ResultView.success_view,
        {"title": "success的标题", "message": "success的消息"}, name='result_view_success'),
    url(r'^result-view/danger/$',
        ResultView.error_view,
        {"title": "danger的标题", "message": "danger的消息"}, name='result_view_danger'),
    url(r'^result-view/info/$',
        ResultView.info_view,
        {"title": "info的标题", "message": "info的消息"}, name='result_view_info'),
]

# handle form error in views
def form_error_view(request):
    class TestForm(forms.Form):
        required_field = forms.CharField(required=True)

        invalid_field = forms.CharField(max_length=1)

        def clean(self):
            raise forms.ValidationError('non field error happened')

    form = TestForm(data={'invalid_field': 'xxxxx'})

    return ResultView.error_view(request, title='这里有一个错误', message='不知道当讲不当讲，算了我还是讲了', error=form.errors)
Package: django-resumable
django-resumabledjango-resumableprovides django backend stuff that handlesresumable.jsxhr uploads.Installationpip installdjango-resumableAddresumableto yourINSTALLED_APPSViewsIn order to upload files asynchronous, you must define an endpoint that will deal
with uploaded file chunks:fromdjango.contrib.auth.decoratorsimportlogin_requiredfromresumable.viewsimportResumableUploadViewurlpatterns+=patterns('',url('^upload/$',login_required(ResumableUploadView.as_view()),name='upload'),)You should also consider having per user chunk upload directory:classMyResumableUploadView(ResumableUploadView):@propertydefchunks_dir(self):returnself.request.user.profile.chunks_dirFieldsIf you want to handle resumable upload within your forms, you can use theResumableFileFieldthat works like django coreFileField:fromdjango.confimportsettingsfromdjango.core.urlresolversimportreversefromresumable.fieldsimportResumableFileFieldclassResumableForm(Form):file=ResumableFileField(allowed_mimes=("audio/ogg",),upload_url=lambda:reverse('upload'),chunks_dir=getattr(settings,'FILE_UPLOAD_TEMP_DIR'))Javascriptdjango-resumablecomes with extendable frontend scripts that work out of the box:{% load staticfiles %}<!DOCTYPE html><html><body><formmethod="post"action="."><fieldset>{% csrf_token %}
                {{ form.as_p }}</fieldset><p><inputtype="submit"value="send"/></p></form><scripttype="text/javascript"src="https://raw.github.com/23/resumable.js/master/resumable.js"></script><scripttype="text/javascript"src="{% static 'resumable/js/django-resumable.js' %}"></script><scripttype="text/javascript"src="{% static 'resumable/js/init.js' %}"></script></body></html>
Package: django-resumator
=====django-resumator=====|pypi| |travis|django-resumator is a lightwight app to create web-based resumes. Please visit `theresumator`_ for a django project that uses it.installation-----------pip install django-resumatororpython setup.py installQuick start-----------1. Add "resumator" to your INSTALLED_APPS setting like this::INSTALLED_APPS = (...'resumator',)2. Add the following to your setting.py::MEDIA_ROOT = os.path.join(BASE_DIR, 'media')MEDIA_URL = '/'2. Include the resumator URLconf in your project urls.py and add MEDIA URL to urlpatterns like this::from django.conf import settingsfrom django.conf.urls.static import staticurlpatterns = [...url(r'^resume/', include('resumator.urls')),...] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)3. Run `python manage.py migrate` to create the resumator models.4. Start the development server and visit http://127.0.0.1:8000/admin/to modify your basic information model and edit your resume (you'll need the Admin app enabled).5. Visit http://127.0.0.1:8000/resume/ to see your resume.Contributing-----------1. Fork it!2. Create your feature branch: `git checkout -b my-new-feature`3. Commit your changes: `git commit -am 'Add some feature'`4. Push to the branch: `git push origin my-new-feature`5. Submit a pull request :DLicense-----------All parts of theresumator are free to use and abuse under the `open-source MIT license`_... |pypi| image:: https://badge.fury.io/py/django-resumator.svg:target: https://badge.fury.io/py/django-resumator.. |travis| image:: https://travis-ci.org/AmmsA/django-resumator.svg?branch=master:alt: Build Status - master branch:target: https://travis-ci.org/AmmsA/django-resumator.. _`theresumator`: https://github.com/AmmsA/theresumator.. _`open-source MIT license`: https://github.com/AmmsA/django-resumator/blob/master/LICENSE
Package: django-resume-griffin
PurposeSo, you’re wanting to put up a résumé on your site (being an excellent
Django developer and all, why not?). You grab your good ol’ PDF you’ve used
since 2007 and copy and paste your résumé in the WYSIWYG editor in Django.
It may look pretty; you may have to mess with it a little bit.Yeah, you could do it that way. Or you could do itthe Griffin Way!Django Résumé Griffin takes your résumé to the next level by modelling it.
You can keep track of where you worked, for how long, and who your managers
were.What’s With the Name?A lot of open source projects use a gimmick to name projects or versions. The
naming scheme for my projects is mythical creatures. This one is–obviously–a
griffin. My other projects includeToken AsenaandProject Goblin.InstallationAs with most django apps, the easiest way way is PIP:pip install -U django-resume-griffinNow addgriffinto the list of installed apps:INSTALLED_APPS = (
    # ...
    'griffin',
    # ...
)FeaturesProject Goblin PluginBecause I’m always up for a little self-promotion I included a plug-in to
Project Goblin. Note that Résumé Griffin checks to see if Project Goblin is
installed. If it is, then a model to include a Project Goblin Project is
available in the admin interface.TheGoblinProjectmodel is only a wrapper model. The real Project GoblinProjectmodel is in the models’projectattribute. So, to access the
Project Goblin project from Résumé Griffin in a template, do this:<h2>{{ project.project.name }}</h2>
<p class="description">{{ project.project.description }}</p>Convert For DownloadBecause reStructuredText is just awesome, Résumé Griffin makes it easy to
convert your resume to various formats.Simply go into the|Resume| Formatsapp and create a new format. When you
want to add a download link to the page, use the template tag like this:{% load ... resume %}

{% resume_download_links resume [ formats ... ] %}resumeis the resume passed in to the context for the template. Theformatsare optional and will default to all résumé formats available
for the given résumé. For example:{% resume_download_links resume "pdf" "odt" %}Will render links to download the résumé in pdf and odt format.The reStructuredText TemplateRésumé Griffin uses a reStructuredText template to convert to various formats.To override the template, simply copy thedownload.rstfile from the$GRIFFIN_SOURCE/griffin/tempaltes/resume/directory (or roll your own) and
place it in your project’stemplates/resume/directory.If you do override the template, just be careful that you respect the syntax
and structure of reStructuredText (e.g. spaces, new lines, etc.)Pandoc SupportDuring installation or configuration you may have run into an error with
PanDoc. Unfortunately, some servers may not have PanDoc support.Someconversion support is made possible with thedocutilspackage, but it won’t
have as near the amount of support as PanDoc.Résumé Griffin will automatically detect in PanDoc is installed. If it’s not,
then Résumé Griffin will try to convert usingdocutilsor…If you find you don’t have PanDoc and you need a super-awesome file format, you
can provide it when you add Résumé Downloads.
Package: django-resumes
Resume is a Django app to conduct web-based Resume.Detailed documentation is in the “docs” directory.Quick startAdd “resumes” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...,
    "resumes",
]Include the polls URLconf in your project urls.py like this:path("resumes/", include("resumes.urls")),Runpython manage.py migrateto create the resumes models.Start the development server and visithttp://localhost:8000/admin/to create a resume (you’ll need the Admin app enabled).Visithttp://localhost:8000/resumes/to participate in the resume.
Package: django-retention-policy
django-retention-policyDeletes Django database records according to a retention policy of your choice.InstallationFirst of all you need your Django application setup withCelery.
With both a worker process and aCelery beatprocess.Then proceed to install the package.pipinstalldjango-retention-policyAnd setup the periodic Celery task, in yoursettings.py:fromdatetimeimporttimedeltaEIGHT_WEEKS_IN_SECS=86400*7*8CELERY_BEAT_SCHEDULE={'periodic-task_delete_expired_db_records':{'task':'django_retention_policy.task_delete_expired_db_records','schedule':timedelta(hours=12),'kwargs':{'app_name':'django_app_name_here','model_name':'YourDjangoModelNameHere','time_based_column_name':'timestamp','data_retention_num_seconds':EIGHT_WEEKS_IN_SECS,},},}CELERY_IMPORTS=('django_retention_policy',)That's it. Start up your Celery worker, and Celery beat processes and the automatic deletion will take place according to your configuration.Release History0.1.1 (2022-08-10)Documentation fixes.0.1.0 (2022-08-10)Initial release.
Package: django-rethinkdb-sessions
Django session backend for rethinkdb.Installationinstall the package by pypipip install django-rethinkdb-sessionsin django settings, switch the session over to rethinkdb-sessionsSESSION_ENGINE = ‘rethinkdb_sessions.main’configure the following settings to adjust the rethinkdb enviorment“SESSION_RETHINK_HOST” – host that rethinkdb is currently running on.“SESSION_RETHINK_PORT” – current rethinkdb port“SESSION_RETHINK_DB”   – rethinkdb database“SESSION_RETHINK_TABLE” – rethinkdb table“SESSION_RETHINK_AUTH”  – rethinkdb auth key (if exists)Running TestsTests are included, invoke tests by running“python tests/tests.py”
Package: django-returnfields
adding restriction of your api’s return fields, in restframework.what is this?The api is defined, such as below.request: GET /users/1/?format=json
status code: 200
response: {
  "id": 1,
  "url": "http://testserver/users/1/?format=json",
  "username": "foo",
  "email": "",
  "is_staff": false,
  "skills": [
    {
      "id": 1,
      "user": 1,
      "name": "magic"
    },
    {
      "id": 2,
      "user": 1,
      "name": "magik"
    }
  ]
}If you passingreturn_fieldsoption, api’s response is filtered.request: GET /users/1/?format=json&return_fields=username,id
status code: 200
response: {
  "id": 1,
  "username": "foo"
}And addingskip__fieldsoption, treated as ignored fields.request: GET /users/1/?format=json&return_fields=username,skills&skip_fields=skills__id,skills__user
status code: 200
response: {
  "username": "foo",
  "skills": [
    {
      "name": "magic"
    },
    {
      "name": "magik"
    }
  ]
}how to use it?usingdjango_returnfields.serializer_factoryfromrest_frameworkimportviewsetsfromdjango_returnfieldsimportserializer_factoryclassUserViewSet(viewsets.ModelViewSet):queryset=User.objects.all()serializer_class=serializer_factory(UserSerializer)appendixif you requesting withaggressiveoption, then, django_returnfields tries to useQuery.defer()orQuery.only().
e.g.GET /users/1/?format=json&return_fields=username,skills&skip_fields=skills__id,skills__user&aggressive=1aggressiveoption is not only using defer and only, but also semi-automatic join or prefetching (TODO: introduction)example## modelsfromdjango.dbimportmodelsfromdjango.contrib.auth.modelsimportUserclassSkill(models.Model):name=models.CharField(max_length=255,default="",null=False)user=models.ForeignKey(User,null=False,related_name="skills")## serializersfromrest_frameworkimportserializersclassSkillSerializer(serializers.ModelSerializer):classMeta:model=Skillfields=('id','user','name')classUserSerializer(serializers.ModelSerializer):skills=SkillSerializer(many=True,read_only=True)classMeta:model=Userfields=('id','url','username','email','is_staff','skills')## viewsetsfromrest_frameworkimportviewsetsfromdjango_returnfieldsimportserializer_factoryclassUserViewSet(viewsets.ModelViewSet):queryset=User.objects.all()serializer_class=serializer_factory(UserSerializer)classSkillViewSet(viewsets.ModelViewSet):queryset=Skill.objects.all()serializer_class=serializer_factory(SkillSerializer)## routesrouter=routers.DefaultRouter()router.register(r'users',viewsets.UserViewSet)router.register(r'skills',viewsets.SkillViewSet)urlpatterns=[url(r'^api/',include(router.urls)),]0.3.2simplifybug fix, a optimization is not worked with a serializer has many=False option.0.3.1supporting source option of django restframework’s field0.3rewriting aggressive implementation.
Package: django-reusable
django-reusabledjango-reusableis a collection of common functionality needed in most Django projects.Pre-requisitesDjango >= 2.2django-tables2 >= 1.21.2django-crispy-forms >= 1.7.2pypugjs >= 5.6.0InstallationInstall this package using pippip install django-reusableAdd thedjango_reusabletoINSTALLED_APPSINSTALLED_APPS += ("django_reusable", )
Package: django-revcanonical
This is an implementation of rev=canonicalurl shorteningin the form of
Django application. Basically rev=canonical is nice idea about that site should
give you two links to actual page: one is human-readable, and another is short
version, intented to use in limited conditions.This implementation is modelled after Simon Willison’spostand returns 301
permanent redirect for your short urls.ConfigurationInstallation is simple - use it like any another Django application, basically:
put it where other application of your project are residing and add'revcanonical'toINSTALLED_APPSinsettings.py. Then edit yoururls.pyand add inclusion of revcanonical’s urls to urlpatterns:url(r'', include('revcanonical.urls')),User'^someprefix/'instead of first argument if you’d like to see prefixed
urls.By default revcanonical uses internal Django’s Site model to determine your site
domain, but you can set it manually insettings.pyasREVCANONICAL_SITEvariable.UsageInclude such code in your template between<head>and</head>tags:{% load revcanontags %}
{% revcanonical object %}Of course, you should replaceobjectwith your own object variable. And,
naturally, it should haveget_absolute_url()method.Additionally you can set your<a href>links to short urls:{% load revcanontags %}
<a href="{% shorturl object %}">...</a>
Package: django-reverse-admin
Django Reverse AdminModule that makes django admin handle OneToOneFields in a better way. A common use case for one-to-one relationships is to "embed" a model inside another one. For example, a Person may have multiple foreign keys pointing to an Address entity, one home address, one business address and so on. Django admin displays those relations using select boxes, letting the user choose which address entity to connect to a person. A more natural way to handle the relationship is using inlines. However, since the foreign key is placed on the owning entity, django admins standard inline classes can't be used. Which is why I created this module that implements "reverse inlines" for this use case.Fix/extension of:adminreversereverseadminRequirementsPython: 3.4, 3.5, 3.6, 3.7Django: 2.0+From version 2.0 onwards Django Reverse Admin is Python 3 only. If you need to support Python 2.7 use the version 1.0 release.InstallationInstall using pip:pipinstalldjango_reverse_adminTestingUsetoxfor testing.toxTesting Manually Using Django AdminRun the following commands to make sure that db.sqlite3 has all the data that you needcdtests
pythonmanage.pymakemigrations
pythonmanage.pymakemigrationspolls
pythonmanage.pymigrate
pythonmanage.pyloaddatafixtures/init_data.json
pythonmanage.pyrunserverAdmin user username isreverseand password isreverseadminUsagemodels.pyfilefromdjango.dbimportmodelsclassAddress(models.Model):street=models.CharField(max_length=255)zipcode=models.CharField(max_length=10)city=models.CharField(max_length=255)state=models.CharField(max_length=2)classPerson(models.Model):name=models.CharField(max_length=255)business_addr=models.ForeignKey(Address,related_name='business_addr')home_addr=models.OneToOneField(Address,related_name='home_addr')other_addr=models.OneToOneField(Address,related_name='other_addr')admin.pyfilefromdjango.contribimportadminfromdjango.dbimportmodelsfrommodelsimportPersonfromdjango_reverse_adminimportReverseModelAdminclassPersonAdmin(ReverseModelAdmin):inline_type='tabular'inline_reverse=['business_addr',('home_addr',{'fields':['street','city','state','zipcode']}),]admin.site.register(Person,PersonAdmin)inline_type can be either "tabular" or "stacked" for tabular and stacked inlines respectively.The module is designed to work with Django 2+ Since it hooks into the internals of the admin package, it may not work with later Django versions.DemoBelow is what an admin change_view with reverse inline looks likeBelow is what the same change_view would look like WITHOUT reverse inlineContribtionMake sure that the tests are passing before opening up the PRCreate a PR for feature enhancementsOnce a PR is merged, update version with the following commands:bumpversion patch
git push origin master --tagsPackagingtoxcreates a package in.tox/dist. Use twine to upload it to pypi:twineupload.tox/dist/django_reverse_admin-*.zip
Package: django-reversion
django-reversionis an extension to the Django web framework that provides
version control for model instances.RequirementsPython 3.7 or laterDjango 3.2 or laterFeaturesRoll back to any point in a model instance’s history.Recover deleted model instances.Simple admin integration.DocumentationCheck out the latestdjango-reversiondocumentation atGetting StartedIssue tracking and source code can be found at themain project website.You can keep up to date with the latest announcements by joining thedjango-reversion discussion group.UpgradingPlease check theChangelogbefore upgrading
your installation of django-reversion.ContributingBug reports, bug fixes, and new features are always welcome. Please raise issues on thedjango-reversion project site, and submit
pull requests for any new code.Fork therepositoryon GitHub.Make a branch off of master and commit your changes to it.Install requirements.$pipinstalldjangopsycopg2mysqlclient-e.Run the tests$tests/manage.pytesttestsCreate a Pull Request with your contributionContributorsThe django-reversion project was developed byDave Halland contributed
to bymany other people.