Saravanan666/pypi-org huggingface dataset:
Package: django-monsieur
django-monsieurmonsieur is a Django app designed to track/monitor/query arbitrary
events over periods of time.UsageOnce installed (instructions below), simply import monsieur and start
logging events.# views.py
import monsieur

def handler(request):
    try:
        handle_request(request)
    except Exception as e:
        # log exception to monsieur and add os/browser attributes
        os, browser = parse_ua(request.META.get('HTTP_USER_AGENT'))
        name = e.message or 'Unknown exception in handler()'
        monsieur.incr(name, 1, 'view errors', os=os, browser=browser)monsieur has a query system similar to Django’s querysets:>>> import monsieur
>>> q = monsieur.Q.tag('view errors')
>>> q = q.filter(os='windows')
>>> q = q.granularity('hour')
>>> q.eval()
{'integer division or modulo by zero': [{'dt': datetime.datetime(2013, 1, 7, 20, 0, 0, 0), 'count': 1}, ...]}Q constructorsQ.tag(x)        # x = TAG | [TAG1, TAG2, ...]

Q.events(x)     # x = NAME | [NAME1, NAME2, ...]Q methodsq.filter(**kwargs)   # key=value to filter by

q.start(x)           # x = datetime.datetime

q.end(x)             # x = datetime.datetime

q.granularity(x)     # x = 'minute' | 'hour' | 'day'Q evaluation methodsq.names()

q.eval()
Package: django-monthfield
IntroductionThis module provides a custom field for storing month (YYYY-MM) as a django field.This can be useful when dealing with data that relates to a whole month, for example,
the total expenditure for a given month.This module also adds some arithmetic and other functionality for dealing with months.UsageAdding a month field to a django model:from django.db import models
from month.models import MonthField#Createyourmodelshere.class ExampleModel(models.Model):
    name = models.CharField(max_length=20, blank=True)
    month = MonthField("Month Value", help_text="some help...")

    def __unicode__(self):
        return unicode(self.month)The module defines a “Month” class which is used to represent the MonthField attribute on the model.
The “Month” class can also be used standalone without any django model.Some examples of funcionality provided by the Month class:import month

m = month.Month(2017, 3)

print(m)
>"2017-03"

print(m + 2)
>"2017-05"

print(m.last_day())
>"2017-03-31"

m2 = month.Month(2017, 7)

print(m > m2)
>"False"

print(m.range(m2))
>"[2017-03, 2017-04, 2017-05, 2017-06, 2017-07]"Example projectAn example website using this module is included in the repository.username: test
password: test
Package: django-mooch
Installdjango-moochusing pip and addmoochto yourINSTALLED_APPS.Add a moochers app:from collections import OrderedDict

from django.conf import settings
from django.conf.urls import include, url

from mooch.banktransfer import BankTransferMoocher
from mooch.postfinance import PostFinanceMoocher
from mooch.stripe import StripeMoocher

from myapp.models import Thing  # Inherit mooch.models.Payment


app_name = 'mooch'  # This is the app namespace.

moochers = OrderedDict((
    ('postfinance', PostFinanceMoocher(
        model=Thing,
        pspid='thing',
        live=False,
        sha1_in=settings.POSTFINANCE_SHA1_IN,
        sha1_out=settings.POSTFINANCE_SHA1_OUT,
        app_name=app_name,
    )),
    ('stripe', StripeMoocher(
        model=Thing,
        publishable_key=settings.STRIPE_PUBLISHABLE_KEY,
        secret_key=settings.STRIPE_SECRET_KEY,
        app_name=app_name,
    )),
    ('banktransfer', BankTransferMoocher(
        model=Thing,
        autocharge=True,  # Mark all payments as successful.
        app_name=app_name,
    )),
]

urlpatterns = [
    url(r'', moocher.urls) for moocher in moochers.values()
]Include the moochers app / URLconf somewhere in your other URLconfs.Add a payment page:def pay(request, id):
    instance = get_object_or_404(Thing.objects.all(), id=id)

    return render(request, 'pay.html', {
        'thing': instance,
        'moochers': [
            moocher.payment_form(request, instance)
            for moocher in moochers.values()
        ],
    })Maybe send a confirmation mail when charges happen (an example
template for this is actually included with the project). Please note
that contrary to most other projects, django-mooch uses the moocherinstanceas sender, not the class:from mooch.mail import render_to_mail
from mooch.signals import post_charge

# The signal handler receives the moocher instance, the payment and
# the request.
def send_mail(sender, payment, request, **kwargs):
    render_to_mail('mooch/thanks_mail', {
        'payment': payment,
    }, to=[payment.email]).send(fail_silently=True)

# Connect the signal to our moocher instances (moochers may be used
more than once on the same website):
for moocher in moochers.values():
    post_charge.connect(send_mail, sender=moocher)If you want to differentiate between moochers (for example to send
a different mail for bank transfers, because the payment has not
actually happened yet) set thesenderargument when connecting
as follows:# Some stuff you'll have to imagine... sorry.
post_charge.connect(thank_you_mail, moochers['postfinance'])
post_charge.connect(thank_you_mail, moochers['stripe'])
post_charge.connect(please_pay_mail, moochers['banktransfer'])
Package: django-mootools-behavior
Utilities forhttps://github.com/anutron/behaviorintegration with django.This app provides template filters that can alter data attributes of the form
fields required for behavior. It also have a ‘behavior’ and ‘behavior-more’
libraries bundled for use with django.contrib.staticfiles.The license is MIT.Installationpip install django-mootools-behaviorConfigurationAdd ‘mootools_behavior’ to INSTALLED_APPS;(optional) runpython manage.py collectstaticin order to get ‘behavior’
javascript files;include the necessary js into html and use provided template filters
in order to set attributes for form elements.FiltersbehaveSets ‘data-behavior-…’ attribute to a form field:{% load mootools_behavior %}

<!-- data-behavior:"OverText" will be added to input field -->
{{ form.title|behave:"OverText" }}set_dataSets HTML5 data attribute (http://ejohn.org/blog/html-5-data-attributes/).Example:{% load mootools_behavior %}

<!-- data-behavior:"OverText" will be added to input field -->
{{ form.title|set_data:"behavior:OverText" }}ContributingIf you’ve found a bug, implemented a feature or have a suggestion,
do not hesitate to contact me, fire an issue or send a pull request.Source code:https://bitbucket.org/kmike/django-mootools-behavior/https://github.com/kmike/django-mootools-behavior/Report bugs:https://bitbucket.org/kmike/django-mootools-behavior/issueshttps://github.com/kmike/django-mootools-behavior/issues
Package: django-moo-url
Adddjango_moo_urlin youINSTALL_APPS.Quick Startstep1.  Addautodiscover_modlesin yourapps.pyso that sure yourviews.pycould conduct successfully.fromdjango.appsimportAppConfigfromdjango.utils.module_loadingimportautodiscover_modulesclassMyappConfig(AppConfig):default_auto_field='django.db.models.BigAutoField'name='myapp'defready(self)->None:autodiscover_modules("views.py")step 2. use the decorator in function view.fromdjango.httpimportJsonResponsefromdjango_moo_urlimporturl_pattern@url_pattern("index/")defindex(request):returnJsonResponse({"hello":"world"})use the decorator in class view.fromdjango.httpimportJsonResponsefromdjango_moo_urlimporturl_patternfromdjango.viewsimportViewclassIndexView(View):@url_pattern("index/")defget(request):returnJsonResponse({"hello":"world"})OK, you learn how to use this library in yourdjangoproject. now, let us learn some more challenge thing.Other FunctionAdd prefixAdd next code in yoursettings.pylike this:DJANGO_URL={'myapp':"api/v1/pub"}so, you could visithttp://localhost:8000/api/v1/pub/indexto get your interface you write.Abouturl_patternIt could get three arguments:url_path: required,url path you like.is_regex:False, if it'sTrue, it will usere_pathto add router.name: likepathandre_pathargument, if you don't provide, it will use your function name.
Package: django-moova
django-moovaStartingThese instructions will allow you to install the library in your python project.Current featuresCreate shipment.Get tracking info.Get shipping label.Pre-requisitosPython >= 3.7Django >= 3requests >= 2InstallationTo get the latest stable release from PyPi:pip install django-moovaorFrom a buildgit clone https://gitlab.com/linets/ecommerce/oms/integrations/oms-moovacd {{project}}python setup.py sdistand, install in your project djangopip install {{path}}/django-moova/dist/{{tar.gz file}}Settings in django projectDJANGO_MOOVA = {
    'MOOVA': {
        'BASE_URL': '<MOOVA_BASE_URL>',
        'SECRET': '<MOOVA_SECRET_TOKEN>',
        'KEY': '<MOOVA_SECRET_KEY>',
        'CURRENCY': 'CLP',
        'TYPE': 'regular',
        'FLOW': 'manual',
        'INTERNALCODE': 'XX5555WWW123',
        'EXTRA': {},
        'ASSURANCE': False,
    },
    'REMITENTE': {
        'STREET': '<STREET>',
        'NUMBER': '<NUMBER>',
        'FLOOR': '<FLOOR>',
        'APARTMENT': '',
        'CITY': '<CITY>',
        'STATE': '<STATE>',
        'POSTALCODE': '<POSTAL_CODE>',
        'COUNTRY': 'CHL',
        'INSTRUCTIONS': 'Call before delivery',
        'FIRST_NAME': '<FIRST_NAME>',
        'LAST_NAME': '<LAST_NAME>',
        'EMAIL': '<EMAIL>',
        'PHONE': '<PHONE>',
    },
}UsageCreate shipment:from moova.handler import MoovaHandler

handler = MoovaHandler()

default_data = handler.get_default_payload(instance)
default_data["currency"] = "CLP" # eg. (Optional)
response = handler.create_shipping(default_data)Get tracking info:from moova.handler import MoovaHandler

handler = MoovaHandler()

tracking_info = handler.get_tracking(<identifier>)Get shipping label:from moova.handler import MoovaHandler

handler = MoovaHandler()

label_info = handler.get_shipping_label(<shipping_id>)

Output:
'https://moova-user-data-test.s3.amazonaws.com/etiqueta-10x15.pdf'
Package: django-more-admin-filters
DescriptionDjango-more-admin-filters is a collection of django admin filters with a focus
on filters using dropdown widgets, multiple choice filters and filters working
with annotated attributes.InstallationInstall from pypi.org:pip install django-more-admin-filtersAdd more_admin_filters to your installed apps:INSTALLED_APPS = [
    'more_admin_filters',
    ...
]Use the filter classes with your ModelAdmin:from more_admin_filters import MultiSelectDropdownFilter

class MyModelAdmin(admin.ModelAdmin):
    ...
    list_filter = [
        ('myfield', MultiSelectDropdownFilter),
        ...
    ]Since the ModelAdmin routine to initialize the list filters doesn’t work with
annotated attributes the usage for an annotation filter is a little bit special.
The filter class needs to be equipped with the attribute’s name:MyModelAdmin(admin.ModelAdmin):
list_filter = [
    BooleanAnnotationFilter.init('my_annotated_attribute'),
    ...
]Filter classesDropdownFilterDropdown filter for all kind of fields.ChoicesDropdownFilterDropdown filter for fields using choices.RelatedDropdownFilterDropdown filter for relation fields.RelatedOnlyDropdownFilterDropdown filter for relation fields using limit_choices_to.MultiSelectFilterMulti select filter for all kind of fields.MultiSelectRelatedFilterMulti select filter for relation fields.MultiSelectRelatedOnlyFilterMulti select filter for related fields with choices limited to the objects
involved in that relationMultiSelectDropdownFilterMulti select dropdown filter for all kind of fields.MultiSelectRelatedDropdownFilterMulti select dropdown filter for relation fields.BooleanAnnotationFilterFilter for annotated boolean-attributes.NoteMore kind of annotation filters will be added in future versions.
Package: django-morris
django-morrisA hexadecimal color field with a preview.InstallationRunpip install django-morrisAddmorristosettings.INSTALLED_APPSRunpython manage.py collectstaticRestart your application serverUsageModelsJust add a color field to your models like this:fromdjango.dbimportmodelsfrommorris.fieldsimportHexColorFieldclassMyModel(model.Model):color=HexColorField()CreditsHeavilyinspired fromdjango-colorfield. If you
need a color picker you should usedjango-colorfieldinstead of this package.LicenseReleased underMIT License.
Package: django-mosql
Django MoSQLDo what Django’s ORM can’t, without the danger ofraw.Why?Short versionBecause I want to use raw SQL, but am too lazy to worry about security issues.Long versionDjango’s ORM is cool. And powerful. But ORMs are destined to be leaky, and can’t do everything you wish to. That’s why Django providesrawandextraso that you can roll your own SQL commands if you need to. But with great power comes great responsibility. You lose all the SQL security measures Django provides when you use those methods, and it can be a serious problem unless you are ultra careful.EntersMoSQL. MoSQL, in a nutshell, is a tool that generates SQL commands automatically from Python function calls. And it takes care of the injection prevention for you. A perfect match with Django’sraw!All this project does is introduce a Django model manager subclass, and provide an interface to use MoSQL’s function calls instead of writing SQL strings yourself. With some syntax sugar, of course.How do I use this thing?(Examples in this section are inspired bythis blog postby Baron Schwartz.)Let’s say you have the following model:class Fruit(models.Model):
    kind = models.CharField(max_length=10)
    variety = models.CharField(max_length=10)
    price = models.FloatField()Then you only need to provide aMoManageras one of its model managers. Adddjangomosqlto yourINSTALLED_APPS, and modify the code like this:from djangomosql.models import MoManager

class Fruit(models.Model):
    kind = models.CharField(max_length=10)
    variety = models.CharField(max_length=10)
    price = models.FloatField()

    objects = MoManager()And you’ll be able to generate queries like this:from djangomosql.functions import Min

Fruit.objects.select((Min('price'), 'minprice')).group_by('kind').order_by('-kind')Which is roughly equivalent toSELECT fruit.*, MIN(price) as minprice FROM fruit GROUP BY kind ORDER BY kind DESCOf course, this won’t be of much use if we can only do things Django’s ORM can. With Django MoSQL, you can achieve many funky things, like:m = Fruit.objects
inner = m.select((Min('price'), 'minprice')).group_by('kind')
p = m.select().as_('f').order_by('f.kind').join(
    inner, 'x', on={'f.kind': 'x.kind', 'f.price': 'x.minprice'}
)Which can be translated into (again, roughly):SELECT f.* FROM fruit AS f INNER JOIN (
    SELECT *, MIN(price) as minprice FROM fruit GROUP BY kind
) AS x ON f.kind = x.kind AND f.price = x.minpriceAnd best of all, you get all the escaping and ORM mapping for free!LICENSEBSD 3-cluse license. See the content of fileLICENSE.DevelopingTo run tests, runpython manage.py testinside the test project. You will needdjango-noseas well as the dependencies.
Package: djangomosquito
Django Mosquito ðŸ¦ŸLimit visitors to your django app by countWhats Django MosquitoMosquito middleware helps you set limit of visiting you django for each userInstallationpip install djangomosquitoImportimport it inside middleware in django settingsmiddlewares = [
  ...,
  'djangomosquito.middleware.DjangoMosquito',
  ...,
]UsageThis middleware do it job you just need to set limit number and
by setting the limit number after reaching this number user get banned from
your website for 1 dayHowsettings.py# after 100 requests user get banned
LIMIT_MOSQUITO = 100
Package: django-mothertongue
A light-weight django model translation application designed to simplify the process of creating multi-lingual websites and serving appropriate content.Some reasons for using mothertongue:In-built integration withdjango-localeurl1.4 or aboveAutomatic langauge detection and redirect based on the user’s browser settingsAutomatic redirecting, state and querystring persistence on language changeLanguage navigation menu object made available globally for easy implementation of language changing controlsExtend from django-mothertongues’ translation model to allow translation of any model you choose in as many languages as you define in your settings fileNo fiddly language template tags - django-mothertongue handles all the magic!Translate all your model fields or just one or twodjango-mothertongue is compatible with django-tinymcedjango-mothertongue can work side by side with django-rosetta or on its ownSearch engines will index all languages.You can install mothertongue with pippip install django-mothertongueSee thefull documentation.
Package: django-mpesa
Django-Mpesa is a generic python library that interfaces the safaricom
MPESA APIs to enable easy payments to your python application.Detailed documentation is in the “docs” directory.View the module from theofficial pypi siteQuick startInstall the package with pip like this:pip install django-mpesaAdd “mpesa” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'mpesa',
]Add Mpesa Config variables to your project’s settings.py fileMPESA_CONFIG = {…
‘CONSUMER_KEY’: ‘<Your consumer key from daraja>’,
‘CONSUMER_SECRET’: ‘<Your consumer secret from daraja>’,
‘HOST_NAME’: ‘<Your hostname e.ghttps://myhostname>’,
‘PASS_KEY’: ‘<Your pass key from daraja>’,
‘SAFARICOM_API’: ‘https://sandbox.safaricom.co.ke’,
‘SHORT_CODE’: ‘174379’}Check below for full setting variables descriptionInclude the polls URLconf in your project urls.py like this:from django.urls import path, include
from mpesa.urls import mpesa_urls

path('mpesa/', include(mpesa_urls)),Runpython manage.py migrateto create the mpesa models.Start the development server and visithttp://127.0.0.1:8000/admin/Visithttp://127.0.0.1:8000/mpesa/to checkout the library features.API ENDPONTSThis module exposes some API endpoints that enable you work with MPESA APImpesa/submit/This endpoint allows you to submit a post request to initiate an STK pushmpesa/confirm/This endpoint is used as the callback endpoint on which MPESA will return a transaction response/statusmpesa/check-transaction/This endpoint allows you to manually check for the status of an mpesa transactionCheck out thetest modulefor more elaborate examples
Package: django-mpesa-pay
django-mpesaThis is a django package that provides access to all safaricom plc mpesa endpoints.
It has all mpesa endpoint that has the latest changes to the mpesa api endpoint in compliance to kenya data protection act.InstallationType the command below to install the package in your environemnt variablepython-mpipinstalldjango-mpesa-payIn your django project in yourINSTALLED_APPSadd the followingINSTALLED_APPS=[#your apps"django-mpesa",]The go tosafaricomand create your account so that you can have access to mpesa sandbox for testing your mpesa credential.From safaricom you will get the following credentials
passkey= **************#settings.pyPASS_KEY=*********#your passkey from safaricomACCOUNT_REFERENCE="name of your app"BUSINESS_SHORT_CODE=#your till numberNB: Remember to save your PASS_KEY and ACCESS TOKENS in an environment variables in production.
Package: django-mpesapy
Mpesapy is a simple Django app that has been integrated with M-Pesa API.Detailed documentation is in the “docs” directory.Quick startAdd “mpesapy” to your INSTALLED_APPS setting like this:INSTALLED_APPS = (
    ...
    'mpesapy',
)Include the mpesapy URLconf in your project urls.py like this:url(r'^mpesapy/', include('mpesapy.urls')),Runpython manage.py migrateto create the mpesapy models.Start the development server and visithttp://127.0.0.1:8000/admin/to see some of the M-Pesa transactions that have been pushed to you by Safaricom (you’ll need the Admin app enabled).
Package: django-mpesa-tek
.django-mpesa.DescriptionDocumentationRead the DocsDependenciesHow to InstallBuilding from Source for Developersgitclonehttps://github.com/TralahM/django-mpesa.gitcddjango-mpesaContributingSee the Contributing FileSee the Pull Request FileSupportLICENCERead the license hereAcknowledgements
Package: django-mp-gallery
# MP-GalleryDjango gallery app.### InstallationInstall with pip:```sh$ pip install django-mp-gallery```### Gallery.photosAdd photos to settings.py:```INSTALLED_APPS = ['gallery.photos',]```Add photos to urls.py:```urlpatterns = [url(r'^photos/', include('gallery.photos.urls', namespace='photos')),]```### Gallery.videosAdd videos to settings.py:```INSTALLED_APPS = ['gallery.videos',]```Run migrations:```$ python manage.py migrate```### RequirementsApp require this packages:* django-modeltranslation* django-multiupload* django-cleanup* sorl-thumbnail* awesome-slugify* django-ordered-model* django-pure-pagination
Package: django-mp-poll
# MP-PollDjango poll app.### InstallationInstall with pip:```$ pip install django-mp-poll```Add poll to settings.py:```INSTALLED_APPS = [...'poll',]```Add poll to urls.py:```urlpatterns = [...url(r'^poll/', include('poll.urls', namespace='poll')),]```Add static components:```poll/poll.csspoll/poll.js```Sync DB:```$ python manage.py migrate$ python manage.py sync_translation_fields```## Template```{% load poll %}<div>{% render_latest_poll %}</div>```### RequirementsApp require this packages:* django-modeltranslation* django-ordered-model
Package: django-mp-shop-comparison
# MP-Shop | Comparison### Installation:1) Install using PIP:` pip installdjango-mp-shop-comparison`Add‘comparison’toINSTALLED_APPS.Add‘comparison.middleware.ComparisonMiddleware’toMIDDLEWARE.Addpath(‘comparison/’, include(‘comparison.urls’))tourlpatterns.### Public methods:Products count:` len(request.comparison) `Add to comparison:` request.comparison.add(product) `Remove from comparison:` request.comparison.remove(product_id) `Clear comparison list:` request.comparison.clear() `Check is comparison list empty:` request.comparison.is_empty() `Get products from comparison:` request.comparison.get_products(category_id) `Check is product in comparison:` request.comparison.has_product(product_id) `Get categories of compare products` request.comparison.get_categories() `### Requirements:
* django >= 2.0.6
* python >= 3.5.2
Package: django-mp-trans
# Translation appThis app helps translate admin fields using `django-modeltranslation` and `googletrans`## Installation`$ pip install mp-trans`## Setup1. Add `trans` and `modeltranslation` to the `INSTALLED_APPS` variable of your project’s `settings.py`2. Set `IS_ADMIN_FIELDS_TRANSLATION_ENABLED` option to `True` in your `settings.py`3. Add `url(r'^trans/', include('trans.urls')),` to your `urls.py`## Admin usage1. Import `TranslationAdmin` class.```from trans.admin import `TranslationAdmin````2. Extend your admin class with `TranslationAdmin````class MyModelAdmin(TranslationAdmin):pass```