kaleo Documentation Release 1.5 Eldarion

Similar documents
Building a Django Twilio Programmable Chat Application

django-sendgrid-events Documentation

django-sticky-uploads Documentation

Django PAM Documentation

django-avatar Documentation

django-avatar Documentation

django-baton Documentation

django-session-security Documentation

django-password-reset Documentation

Django Standalone Apps

Django MFA Documentation

django-gollum Documentation

django-baton Documentation

django-oauth2-provider Documentation

welcome to BOILERCAMP HOW TO WEB DEV

wagtailmenus Documentation

djangotribune Documentation

django-messages Documentation

django-inplaceedit Documentation

django-mama-cas Documentation

django-cms-search Documentation

django-teamwork Documentation

wagtailmenus Documentation

Easy-select2 Documentation

django-precise-bbcode Documentation

MIT AITI Python Software Development Lab DJ1:

Django Admin Sortable Documentation

AngularJS Fundamentals

wagtailtrans Documentation

django simple pagination Documentation

Django EL(Endless) Pagination Documentation

django-allauth-2fa Documentation

django-dajaxice Documentation

django-xross Documentation

Django Groups Manager Documentation

django-dajax Documentation

Django Test Utils Documentation

Unifer Documentation. Release V1.0. Matthew S

Standard 1 The student will author web pages using the HyperText Markup Language (HTML)

Django Groups Manager Documentation

django-renderit Documentation

Bishop Blanchet Intranet Documentation

django-image-cropping Documentation

WeChat Adobe Campaign Integration - User Guide

django-cron Documentation

django-ad-code Documentation

TailorDev Contact Documentation

django-app-metrics Documentation

Introduction to PHP. Handling Html Form With Php. Decisions and loop. Function. String. Array

django-generic-filters Documentation

django-fluent-dashboard Documentation

DJOAuth2 Documentation

Google Tag Manager. Google Tag Manager Custom Module for Magento

WEB DEVELOPER BLUEPRINT

django-sitetree Documentation

gettext.js Documentation

Django QR Code Documentation

Biocomputing II Coursework guidance

Django Forme Documentation

django-waffle Documentation

wagtail-robots Documentation

django-ratelimit-backend Documentation

Django_template3d Documentation

October 08: Introduction to Web Security

Diving into Big Data Workshop

django-embed-video Documentation

Django-CSP Documentation

AJAX and JSON. Day 8

django-telegram-login Documentation

Django urls Django Girls Tutorial

django-rest-framework-datatables Documentation

django cms Documentation

Django File Picker Documentation

Client Side JavaScript and AJAX

Alaska Airlines Developer Portal

django-embed-video Documentation

Application documentation Documentation

Agent Services. Making Tax digital for Business. March 2017

Django-frontend-notification Documentation

Technology modeling. Ralf Lämmel Software Languages Team University of Koblenz-Landau

Siteforce Pilot: Best Practices

django-report-tools Documentation

open-helpdesk Documentation

Cookiecutter Django CMS Documentation

Pixelsilk Training Manual 8/25/2011. Pixelsilk Training. Copyright Pixelsilk

Django Extra Views Documentation

Signals Documentation

Some Facts Web 2.0/Ajax Security

Django-Front Documentation

micawber Documentation

MAX 2006 Beyond Boundaries

shortcut Tap into learning NOW! Visit for a complete list of Short Cuts. Your Short Cut to Knowledge

Trunk Player Documentation

Ninja Typers Web Application Design Document By Marvin Farrell C

Customizing GeoNode. Emere Arco, Simone Balbo, Paolo Pasquali, Constantin Sandu ITHACA

django-amp-tools Documentation Release latest

Django File Picker Documentation

[SocialLogin] CED COMMERCE. ALL RIGHTS RESERVED.

django-geoip Documentation

django-photologue Documentation

Transcription:

kaleo Documentation Release 1.5 Eldarion October 06, 2014

Contents 1 Development 3 1.1 Contents................................................. 3 i

ii

Provides a site with user to user invitations, working closely with django-user-accounts and requires Django 1.4. Contents 1

2 Contents

CHAPTER 1 Development The source repository can be found at https://github.com/eldarion/kaleo 1.1 Contents 1.1.1 Installation To install kaleo: pip install kaleo Add kaleo to your INSTALLED_APPS setting: INSTALLED_APPS = ( # other apps "kaleo", ) See the list of Settings to modify kaleo s default behavior and make adjustments for your website. Lastly you will want to add kaleo.urls to your urls definition:... url(r"^invites/", include("kaleo.urls")),... Dependencies eldarion-ajax This is used to enable the markup based ajax. You can certain wire up your own AJAX handling if you prefer to use something else. However, including this script will just have things work out of the box. pinax-theme-bootstrap This is semi-optional as the only reason it is required is the included _invite_form.html renders the form through the as_bootstrap filter. If you override this template in your project, you obviously remove this requirement at least in context of this app. 3

django-user-accounts Used for linking people to invitations when they confirm email addresses and sending and processing of signup codes via email. 1.1.2 Usage Integrating kaleo into your project is just a matter of using a couple of template tags and wiring up a bit of javascript. The invite form is intended to function via AJAX and as such returns JSON. Firstly, you will want to add the following blocks in your templates where you want to expose the invite form and display to the user a list of who they have invited (of course you may choose to not expose that): {% load kaleo_tags % <div class="invites"> {% invite_form request.user % <div class="sent"> <h3>invitations Sent</h3> {% invites_sent request.user % </div> </div> Then if you had an account bar somewhere at the top of your screen where you showed the user if they were logged in or note you could have: {% load kaleo_tags % {% invites_remaining user % You ll then need to include bootstrap-ajax: <script src="{% static "js/bootstrap-ajax.js" %"></script> 1.1.3 Settings KALEO_DEFAULT_EXPIRATION Default 168 (7 days) Defines the what will be the default expiration of invitations and is currently the only way to specify the expiration date of invitations. KALEO_DEFAULT_INVITE_ALLOCATION Default 0 Defines the default allocation of invites that new users get when they signup. In order to enable unlimited invitations, just set this to -1. 1.1.4 Templates kaleo comes with two templates that are minimal snippets that get rendered from the template tags. 4 Chapter 1. Development

_invite_form.html This is a snippet that renders the form as well as a div to hold the contents of the response from the form AJAX submission. _invited.html A simple unordered list of people you have invited that is linked to their profile when they join the site. _invites_remaining.html A fragment to display how many invites a particular user has. 1.1.5 Signals Both of these signals are sent from JoinInvitation and provides a single keyword argument, invitation which is the relevant instance of JoinInvitation. kaleo.signals.invite_sent This signal is sent immediately after the invitation is sent. kaleo.signals.invite_accepted This signal is sent immediately after the acceptance of the invitation has been processed. kaleo.signals.joined_independently This signal is sent when someone signs up using the same email address that exist for an invitation and they confirm that email address. 1.1.6 Management Commands add_invites Adds invites to all users with 0 invites remaining. manage.py add_invites 10 # Adds 10 new invites to all users with 0 invites remaining infinite_invites Gives all users unlimited invites manage.py infinite_invites 1.1. Contents 5

topoff_invites Makes sure all users have at least a certain number of invites. manage.py topoff_invites 10 # Makes sure that all users have at least 10 invites 1.1.7 Views There are four different views designed to handle POSTs via AJAX with a single variable, amount. These are designed to be able to help administrators manage invites from a front-end dashboard. The responses sent from these views conform to what bootstrap-ajax expects and works with. They all require the user has the permission kaleo.manage_invites which is up to the site developer to determine how to and who to grant this to or evaluate in a custom auth backend. The largest use case should already be covered in that any user with staff or superuser privileges should supercede the need for this explicit permission. topoff_all url kaleo_topoff_all Tops off all users with at least amount invites. Returns: { "inner-fragments": { ".invite-total": amount topoff_user url kaleo_topoff_user user.pk Tops off {{ user.pk with at least amount invites. Returns: { "html": amount addto_all url kaleo_addto_all Adds number invites to all users Returns: { "inner-fragments": { ".amount-added": amount 6 Chapter 1. Development

addto_user url kaleo_addto_user user.pk Adds number invites to {{ user.pk Returns: { "inner-fragments": { ".html": amount invite_stat url kaleo_invite_stat user.pk Returns a rendered kaleo/_invite_stat.html fragment to be supplied by the site developer to render an InvitationStat object for the user.pk provided to the template with the context variable stat. The intended purpose for this is to used as a data-refresh-url for bootstrap-ajax. Returns: { "html": <rendered kaleo/_invite_stat.html> # provided by site developer 1.1.8 CHANGELOG 1.2 Django 1.5 custom user model support BACKWARD INCOMPATIBILITY: removed the import of kaleo.receivers from urls.py added a joined_independently signal refactored logic that existed in signal receivers to model methods fixed bug in add invites functionality that would set everyone to have unlimited invites fixed bug in top off invites functionality that removed unlimited invites from those who had it Backward Inccompatibilities Importing things into models.py or urls.py that have nothing to do with either of those modules has been a bit of a hack for awhile. Pinax is moving to a more explicit approach where these things are hooked up at the project level. In fact, Pinax starter projects will support receivers.py getting hooked up at runtime automatically through the use of a startup.py modeule that has code that gets executed in the wsgi.py and manage.py. See how it all works in this commit: https://github.com/pinax/pinax-project-account/commit/364795cdd683574ab6a5093be34b9d47a3487bea 1.1. Contents 7

1.1 added a set of views to handle managing invites via ajax 1.0 translated templates replaced remaining_invites template tag with invites_remaining inclusion template tag invite view is now bootstrap-ajax compatible 0.4 moved away from Pinax dependencies and to require django-user-accounts moved to Django 1.4 0.3 fixed documentation bugs added stats.py for stat collection 0.2 added ability to set default invite allocation for new users added ability to enable users to have unlimited invitations 0.1 initial release 8 Chapter 1. Development