Saravanan666/pypi-org huggingface dataset:
Package: django-logutils
Various logging-related utilities for Django projects. For now, it provides
a LoggingMiddleware class and an EventLogger class.Documentationhttp://django-logutils.readthedocs.orgQuickstartInstall django-logutils:pip install django-logutilsLoggingMiddlewareLoggingMiddleware is middleware class for Django, that logs extra
request-related information. To use it in your Django projects, add it to
yourMIDDLEWARE_CLASSESsetting:MIDDLEWARE_CLASSES = (
    ...
    'django_logutils.middleware.LoggingMiddleware',
    ...
)The extra information consists of:event (default: ‘request’)remote ip address: the remote ip address of the user doing the request.user email: the email address of the requesting user, if availablerequest method: post or getrequest url pathresponse status codecontent length of the response bodyrequest timeN.B.: event can be overriden by using theLOGUTILS_LOGGING_MIDDLEWARE_EVENTsetting in your project.The log message itself is a string composed of the remote ip address, the user
email, the request method, the request url, the status code, the content
length of the body and the request time. Additionally, a dictionary with the
log items are added as an extra keyword argument when sending a logging
statement.If settings.DEBUG is True or the request time is more than 1 second, two
additional parameters are added to the logging dictionary:nr_queriesthat
represents the number of queries executed during the request-response cycle
andsql_timethat represents the time it took to execute those queries.
Slow requests are also raised to a loglevel ofWARNING.N.B.: the time threshold for slow requests can be overriden by using theLOGUTILS_REQUEST_TIME_THRESHOLDsetting in your project.EventLoggerThe EventLogger class makes it easy to create dictionary-based logging
statements, that can be used by log processors like Logstash. Log events can be
used to track metrics and/or to create visualisations.Here’s an example of how you can use it:>>> from django_logutils.utils import EventLogger
>>> log_event = EventLogger('my_logger')
>>> log_event('my_event', {'action': 'push_button'})DevelopmentInstall the test requirements:$ pip install -r requirements/test.txtRun the tests to check everything is fine:$ make testTo run the tests and opening the coverage html in your browser:$ make coverageTo run flake8 and pylint, do:$ make lintTo generate the documentation, do:$ make docsHistory0.4.3 (2017-05-11)Make sure that log messages are aggregable by tools like Sentry.0.4.2 (2015-10-30)Support StreamingHttpResponse that doesn’t have content length.0.4.1 (2015-08-21)Add tests for app settings.0.4.0 (2015-08-20)MakeREQUEST_TIME_THRESHOLDa setting.0.3.1 (2015-08-04)Update documentation.0.3.0 (2015-08-04)AddEventLoggerclass.0.2.5 (2015-07-31)Reach 100% test coverage.0.2.4 (2015-07-31)Improve project structure.0.2.3 (2015-07-30)Addlog_eventutility function for logging events.0.2.2 (2015-07-29)Addadd_items_to_messageutility function.0.2.1 (2015-07-29)More and better tests.0.2.0 (2015-07-28)Release replacing previous faulty dev release.0.1.0 (2015-07-28)First release on PyPI.
Package: django-log-viewer
Django Log Viewer allows you to read & download log files in the admin page by usingDataTables.
This project was modified from:https://bitbucket.org/inkalabsinc/django-log-viewerQuick startDjango Log Viewer is available directly fromPyPI:pip install django-log-viewerAdd"log_viewer"to yourINSTALLED_APPSsetting like thisINSTALLED_APPS = [
    ...
    "log_viewer",
]Include the log viewer URLconf in your projecturls.pylike thispath('logs/', include('log_viewer.urls')),In yoursettings.pyfile create the following valueLOG_VIEWER_FILES = ['logfile1', 'logfile2', ...]
LOG_VIEWER_FILES_PATTERN = '*.log*'
LOG_VIEWER_FILES_DIR = 'logs/'
LOG_VIEWER_PAGE_LENGTH = 25       # total log lines per-page
LOG_VIEWER_MAX_READ_LINES = 1000  # total log lines will be read
LOG_VIEWER_FILE_LIST_MAX_ITEMS_PER_PAGE = 25 # Max log files loaded in Datatable per page
LOG_VIEWER_PATTERNS = ['[INFO]', '[DEBUG]', '[WARNING]', '[ERROR]', '[CRITICAL]']
LOG_VIEWER_EXCLUDE_TEXT_PATTERN = None  # String regex expression to exclude the log from line

# Optionally you can set the next variables in order to customize the admin:
LOG_VIEWER_FILE_LIST_TITLE = "Custom title"
LOG_VIEWER_FILE_LIST_STYLES = "/static/css/my-custom.css"Create/register the loggingimport logging
logger = logging.getLogger('LoggerName')
logger.info('The info message')
logger.warning('The warning message')
logger.error('The error message')Deploy static files by running the commandpython manage.py collectstaticStart the development server and visithttp://127.0.0.1:8000/logs/
Package: django_lookup_dict
A django app that allows you to use a djanog model created by the app with a python dict-like operators. Useful for storing configuration variablesHello, worldSimple Demo:from django_lookup_dict import LookupDict

lookup = LookupDict()
lookup['hello'] = 'world'
print "Lookup for Hello is : {0}".format(lookup['hello'])How To:Setting a value, regular assigningment with the square bracket operator [ ]:lookup['hello'] = 'world'Retrieving a value, using square bracket operator [ ]:lookup['hello']Key count:len(lookup)Deletin, using the del and using square bracket operators:del lookup['hello']Deleting certain keys:# lookup.delete(*args)
lookup.delete('key1', 'key2', 'key3')InstallationAutomatic installation:pip install django_lookup_dictManual installation: Download the latest source fromGitHub.tar xvzf django_lookup_dict-[VERSION].tar.gz
cd django_lookup_dict-[VERSION]
python setup.py build
sudo python setup.py installAfter Instalation:Add ‘django_lookup_dict’ to INSTALLED_APPS in your django project’s settings.Run ‘python manage.py syncdb’ in order to create the data storage for the model.
Package: django-lookup-extensions
Django lookup extensionsDjango lookup extensions useNOTquery.Free software: MIT licenseDocumentation:https://django-lookup-extensions.readthedocs.io.InstallationTo install Django lookup extensions, run this command in your terminal:$pipinstalldjango-lookup-extensionsThis is the preferred method to install Django lookup extensions, as it will always install the most recent stable release.If you don’t havepipinstalled, thisPython installation guidecan guide
you through the process.UsageSetupAdd‘lookup_extensions’to yourINSTALLED_APPSsetting.:INSTALLED_APPS=[...'lookup_extensions',...]AppConfig.ready imports lookups and register them usingdjango.db.models.fields.Field.register_lookup.Making queriesUse lookup like Django standard lookups.ModelA.objects.filter(name__neexact='test name')Supported lookup typesNegaetesneexact is negate exact, neiexact is negate iexact, others are similar.neexactneiexactnecontainsneicontainsnestartswithneendswithneistartswithneiendswithneregexneiregexComplementcomplementExtra regexesThese regex lookups support metacharacters\d,\D,w,\W,\s,\S.MySQL, PostgreSQL and Redshift also support\<,\>.Prefix follows the previous section.exregexexiregexneexregexneexiregexSupported vendor typesMySQLPostgreSQLsqlitelookups usingLIKEaren’t case sensitive.necontainsnestartswithneendswithRedshiftCreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.2.1Support relatedcomplementlookups0.2.0Add support for Django 2.1Add support for Python 3.7Migrate tocomplementfromexistsandneexists0.1.0Migrate installation to backend settingsSupportexistsandneexistslookups0.0.1 - 0.0.2Support extra regex lookupsSupport negaete lookups
Package: django-lookup-property
Django Lookup Propertypipinstalldjango-lookup-propertyDocumentation:https://mrthearman.github.io/django-lookup-property/Source Code:https://github.com/MrThearMan/django-lookup-property/Contributing:https://github.com/MrThearMan/django-lookup-property/blob/main/CONTRIBUTING.mdDjango model properties that are also lookup expressions.fromlookup_propertyimportlookup_propertyfromdjango.dbimportmodelsfromdjango.db.modelsimportValuefromdjango.db.models.functionsimportConcatclassStudent(models.Model):first_name=models.CharField(max_length=50)last_name=models.CharField(max_length=50)@lookup_propertydeffull_name():returnConcat("first_name",Value(" "),"last_name")>>>frommyapp.modelsimportStudent>>>fromlookup_propertyimportL>>>>>>Student.objects.create(first_name="John",last_name="Doe")>>>student=Student.objects.filter(L(full_name="John Doe")).first()>>>>>>student.full_name'John Doe'
Package: django-lookups
django_lookups: Lookup Models for Django Applicationsdjango_lookups provides a LookupModel that many of us have written some variation 100's of times. Most of the applications we write have lookup tables (or should!) and we have boilerplate everywhere to manage constants. The aim of this library is to make working with lookup data in django easier.You might have a constants repo / package / library that you share between your apps or services. Most of the time, instead of constants, those values really belong in lookup tables. Things like status int fields. If you have a django model with a field likestatus = models.PositiveIntegerFieldthis library is probably for you!A trivial example showing how you might interact with an Order Status.classOrderStatusTypes(django_lookups.LookupModel):classMeta:app_label="my_app"db_tabel="my_table"classOrder(models.Model):status=models.ForeignKey(OrderStatusTypes)address=models.ForeignKey(...)created=models.TimestampField()changed=models.TimestampField()@classmethoddefnew_order(cls):returncls.objects.create(status=OrderStatusTypes.members.INITIATED.model,...)Once you add this library as a dependency, and have created your first lookup model, you'll need to run adata migrationto add the lookup values to your table, or add data to your lookup tables manually. Once the data is there, your code can work with this data by name. No more need to keep constants libraries in sync when you add a new type/status etc!This library is on pypi so you can runpip install django_lookupsto get started or add it with the package manager of your choice.
Package: django-lookup-table-rating-widget
django-lookup-table-rating-widgetA django rating widget with a lookup-table for score-making rules.Installpipinstalldjango-lookup-table-rating-widgetUsagepro/settings.pyNote:We used template of django-lookup-table-rating-widget, so we NEED add django_lookup_table_rating_widget in INSTALLED_APPS.INSTALLED_APPS=[...'django_lookup_table_rating_widget',...]app/admin.pyfromdjango.contribimportadminfromdjango.utils.lorem_ipsumimportsentencefromdjango_lookup_table_rating_widget.widgetsimportDjangoLookupTableRatingWidgetfromdjangoimportformsfrom.modelsimportBooks1_scores=[{"scores":[1,2],"rule":"<b>Bad</b>. "+sentence(),},{"scores":[3,4],"rule":"<b>Not bad</b>. "+sentence(),},{"scores":[5,6],"rule":"<b>Good</b>. "+sentence(),},{"scores":[7,8],"rule":"<b>Very Good</b>."+sentence(),},{"scores":[9,10],"rule":"<b>Excellent</b>."+sentence(),}]classBookForm(forms.ModelForm):classMeta:model=Bookexclude=[]widgets={"s1":DjangoLookupTableRatingWidget(s1_scores,field_label_in_table=False,weight=15),"s2":DjangoLookupTableRatingWidget(s1_scores,allow_input=True),"s3":DjangoLookupTableRatingWidget(s1_scores),"s4":DjangoLookupTableRatingWidget(s1_scores),}classBookAdmin(admin.ModelAdmin):form=BookFormlist_display=["title"]fieldsets=[(None,{"fields":["title"]}),("Score 1 & 2",{"fields":["s1","s2"],}),("Score 3 & 4",{"fields":["s3","s4"],})]admin.site.register(Book,BookAdmin)Widget Init Parametersscores: required.It's a list of map. The map always containsscoresandruleitem.scoresis a list of rating buttons, and theruleis a string of rule description. HTMLruleis accepted.allow_input: optional, default to False.If allow_input=True, the final score input is allowed to input.If allow_input=False, the final score input is readonly.field_label_in_table: optional, default True.If field_label_in_table=True, we use jquery to move field's label and help into the table.If field_label_in_table=False, we keep the field's label and help at thire original position.weight: optional, default None.weight means the field weight in full rating form.If not provides, we will remove the weight column.field_label: optional, default to _("Item").final_score_label: optional, default to _("Score").scores_label: optional, default to _("Rating Buttons").rules_label: optional, default to _("Rule").weight_label: _("Weight").All lables are used to render the rating table header.Releasesv0.1.1 2020/09/25No depends on django_static_jquery3.Add license file.v0.1.0 2020/03/18First release.
Package: django-loose-fk
Version:1.0.3Source:https://github.com/maykinmedia/django-loose-fkKeywords:ForeignKey,URL reference,decentralization,integrityDjango Loose FK handles local or remote “ForeignKey” references.In a decentralized API landscape various providers can offer the same type of
data, while your own API also provides this. The django model field allows
you to handle this transparently and present a unified, clean Python API.Contents1Features2Installation2.1Requirements2.2Install3Usage3.1Loaders1FeaturesAlways work with Django model instancesAutomatically added check constraintsPluggable interface to fetch remote objectsAutomatically supports DRF Hyperlinked serializers and serializer fields2Installation2.1RequirementsPython 3.7 or abovesetuptools 30.3.0 or aboveDjango 3.2 or newer2.2Installpipinstalldjango-loose-fkWarningYou must also make sureALLOWED_HOSTSis a list of actual domains, and not
a wildcard. When loose-fk gets a URL to load, it first looks up if the domain
is a local domain and if so, will load the actual local database record.3UsageAt the core sits a (virtual) django model field.fromdjango_loose_fk.fieldsimportFkOrURLFieldclassSomeModel(models.Model):name=models.CharField(max_length=100)classOtherModel(models.Model):local=models.ForeignKey(SomeModel,on_delete=models.CASCADE,blank=True,null=True)remote=models.URLField(blank=True)relation=FkOrURLField(fk_field="local",url_field="remote")You can now create objects with either local instances or URLs:some_local=SomeModel.objects.get()OtherModel.objects.create(relation=some_local)OtherModel.objects.create(relation="https://example.com/remote.json")Accessing the attribute will always yield an instance:>>>other=OtherModel.objects.get(id=1)# local FK>>>other.relation<SomeModel(pk:1)>>>>other=OtherModel.objects.get(id=2)# remote URL>>>other.relation<SomeModel(pk:None)>In the case of a remote URL, the URL will be fetched and the JSON response used
as init kwargs for a model instance. The.save()method is blocked for
remote instances to prevent mistakes.3.1LoadersLoaders are pluggable interfaces to load data. The default loader isdjango_loose_fk.loaders.RequestsLoader, which depends on therequestslibrary to fetch the data.You can specify a global default loader with the settingDEFAULT_LOOSE_FK_LOADERDEFAULT_LOOSE_FK_LOADER="django_loose_fk.loaders.RequestsLoader"or override the loader on a per-field basis:fromdjango_loose_fk.loadersimportRequestsLoaderclassMyModel(models.Model):...relation=FkOrURLField(fk_field="local",url_field="remote",loader=RequestsLoader())
Package: django-lot
Django Login over Token easy the creation of token based logins. Can be
one-time-logins, temporary valid logins or permanent logins, always based on
your settings.How to installYou can also install it with:pip installdjango-lotConfigurationAdd the lot app to your installed apps and define your settingsLOTvariable as a dictionary andLOT_MIDDLEWARE_PARAM_NAMEif you use the
lot middleware.Example:LOT = {
  'fast-login': {
      'name': _(u'Fast login'),
      'duration': 60,
      'one-time': True,
  },
  'slow-login': {
      'name': _(u'Slow login'),
      'duration': 60*60*24,
      'one-time': True,
  },
  'always-login': {
      'name': _(u'Always login'),
      'one-time': False,
      'duration': None,
  },
  'morning-login': {
      'name': _(u'Morning login'),
      'one-time': False,
      'duration': None,
      'verify-func': lambda x: datetime.now().hour < 12,
      'delete-on-fail': False
  },
}

LOT_MIDDLEWARE_PARAM_NAME = 'uuid-login'GET keyAdd the lot authentication backend to theAUTHENTICATION_BACKENDSsettings variable.Example:AUTHENTICATION_BACKENDS = (
    "django.contrib.auth.backends.ModelBackend",
    "lot.auth_backend.LOTBackend",
)Header KeyAdd the lot authentication middleware to theMIDDLEWARE_CLASSESsettings variable.  Ensure it is __after__ Django’s AuthenticationMiddleware.Example:MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'lot.middleware.LOTAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
)warning:This method should ONLY be used over HTTPS.UsageYou have to create the LOT instances with a user and a type (the uuid and the
created date are auto-generated). Then you can use the lot login view, or the
the lot login middleware. You can set the session_data attribute to add data
to the user session when login with LOT.If you use the lot middleware you can login in any url that have the param
defined in theLOT_MIDDLEWARE_PARAM_NAMEand have a valid LOT instance
related to it.If you use the view you can add the next param to redirect the user to an url
after the login. By default will redirect you to the “/” url.
Package: django-loupe
django-loupe is a simple image/screenshot review application to add to your django project to allow collaborative discussions about about a projects design processes.Installation:Putloupeto yourINSTALLED_APPSin yoursettings.pywithin your django project.Add the following to your settings.py or local_settings.py and adjust it to your likingLOUPE_RESIZE_THUMB_WIDTH = 100 # Width in pixels of the thumbnail
LOUPE_RESIZE_THUMB_HEIGHT  = 75 # Height in pixels of the thumbnail
LOUPE_RESIZE_THUMB_CROP = True # Crop thubmnails? True or False
LOUPE_RESIZE_DISPLAY_WIDTH = 800 # Width in pixels of the display size (not full size image)
LOUPE_PRE_CACHE_IMAGES = True # Pre-cache images on upload? True or False
LOUPE_INCREMENT_COUNT = True # Increment the view count on images? True or FalseFeatures:Roadmap:
Package: django-lteadmin
###############################Django-AdminLTE###############################Change the default Django templates to the `LTE <https://almsaeedstudio.com/themes/AdminLTE/index2.html>`_This is my first open source project done in Django, I hope it will be useful for you and look forward to suggestions, bugs and collaborations.###############################How do I get set up?###############################Instale usando PyPI:pip install django-lteadminAdd the app ``adminlte`` to ``settings.py``INSTALLED_APPS = ('adminlte',...)###############################What will you see in your admin?###############################Menu Icons###############################Menu icons are set in the Model:class MyModel(models.Model):Name = models.CharField(...def get_icon_menu_model_class(self):return 'fa-user'def get_icon_menu_add_model_class(self):return 'fa-plus'def get_icon_menu_change_model_class(self):return 'fa-edit'###############################To Do###############################* Create tests* Maintain menu status after selecting an item* Organize the code according to the `PEP 8 <http://www.python.org/dev/peps/pep-0008/>`_
Package: django-lti
django-ltiADjango reusable appproviding support for LTI Advantage.InstallationInstall using pip.pip install django-ltiSetupStart by addinglti_toolto your project'sINSTALLED_APPS.INSTALLED_APPS=[..."lti_tool",]Then, addlti_tool.middleware.LtiLaunchMiddlewareto theMIDDLEWAREsetting.
It's important to list theLtiLaunchMiddlewareafterSessionMiddleware.MIDDLEWARE=[...'django.contrib.sessions.middleware.SessionMiddleware','lti_tool.middleware.LtiLaunchMiddleware',]Finally, run migrations to initialize the needed database tables.python manage.py migrate lti_toolUsageAdding JWKS and OIDC initiation URLsTo allow LTI platforms to retrieve a JWKS and initiate a launch, add paths forlti_tool.views.jwksandlti_tool.views.OIDCLoginInitViewtourls.py...fromlti_tool.viewsimportjwks,OIDCLoginInitViewurlpatterns=[path(".well-known/jwks.json",jwks,name="jwks"),path("init/<uuid:registration_uuid>/",OIDCLoginInitView.as_view(),name="init"),]Generating and rotating keysKeys for the JWKS can be generated using therotate_keysmanagement command.python manage.py rotate_keysRegistering an LTI platformAn LTI platform can be registered through the Django admin, or using a custom
interface.Handling an LTI launchTo handle the LTI launch, inherit fromLtiLaunchBaseViewand implement the handler
methods for the types of LTI message types that the application supports.classApplicationLaunchView(LtiLaunchBaseView):defhandle_resource_launch(self,request,lti_launch):...# Required. Typically redirects the users to the appropriate page.defhandle_deep_linking_launch(self,request,lti_launch):...# Optional.defhandle_submission_review_launch(self,request,lti_launch):...# Optional.defhandle_data_privacy_launch(self,request,lti_launch):...# Optional.Each handler method receives the request, as well as aLtiLaunchobject.When a session is initiated by an LTI launch, data about the launch is available from
the request atrequest.lti_launchas anLtiLaunchobject. During a non-LTI sessionrequest.lti_launchwill refer to anAbsentLtiLaunchobject.It is possible to distinguish betweenLtiLaunchandAbsentLtiLaunchobjects using
the.is_presentand.is_absentproperties.
Package: django-lti-auth
This project aims to provide a dead simple way to integrate LTI Authentication into your Django powered app. Try it now, and get rid of the complicated configuration of LTI.UsageSet up the app as an LTI tool on Moodle. You need to specify the following:Secure Tool URL:Consumer key and Shared secret:Import the views module in your rooturls.py# this is main urls.py for the projectfromdjango.conf.urlsimporturl,includeurlpatterns+=[url(r'^lti/',include('django_lti_auth.urls')),...]In settings.py, add the LTI related configuration.PYLTI_CONFIG={"consumers":{"<djangoConsumerKey>":{"secret":"<djangoSecret>"}},"method_hooks":{"valid_lti_request":"<Specify method to call after validation of a valid LTI payload>","invalid_lti_request":"<Specify method to call after validation of an invalid LTI payload>"},"next_url":"<Default home page>"}You also need to add the following settings into your settings.py file.X_FRAME_OPTIONS='ALLOW-FROM https://moodle.telt.unsw.edu.au/'SECURE_PROXY_SSL_HEADER=('HTTP_X_FORWARDED_PROTO','https')SECURE_SSL_REDIRECT=FalseSESSION_COOKIE_SECURE=TrueCSRF_COOKIE_SECURE=TrueAdd ‘django_lti_auth’ to INSTALLED_APPSINSTALLED_APPS=['...','django_lti_auth',]Explanationvalid_lti_request- The module calls the method you specify here after validating the LTI payload if the payload is valid. The method passes the LTI payload values extracted into a python dictionary as an argument to this method. You can use this payload to bind the user variables to the session.defvalid_lti_request(user_payload,request):...request.session['userid']=user_payload['user_id']request.session['roles']=user_payload['roles']request.session['context_id']=user_payload['context_id']...You can return a URL value in case you want to redirect the LTI authenticated user to a new URL after the LTI Authentication.defvalid_lti_request(user_payload,request):...url=reverse('<intented URL string>',kwargs={'context':user_payload['context_id'],'userid':user_payload['user_id']})returnurlinvalid_lti_request-  This method is called after validation when the LTI payload is invalid. You can use this method to redirect the user back to the login page (or an access denied page).InstallationTo install the package run the following command:pipinstalldjango-lti-authRequirementsPyLTI==0.5.1LicenceMIT licenseAuthorsdjango_lti_authwas written byRohit Jose.