Skip to content
This repository has been archived by the owner on Mar 17, 2020. It is now read-only.

birdsarah/django-actionitems

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-actionitems

Build Status

To use django-actionitems, add the actionitems directory to your project, and add actionitems to your INSTALLED_APPS in your project's settings.py

specifying an origin

django-actionitems can store a reference to sommething that creates the actionitem. For example, an action item may be the result of a Meeting, Event, or Decision. django-actionitems calls this the origin. If you wish to link your actionitem to an origin, you can supply the model in your project's settings.py in the form appname.Model e.g.

 ACTIONITEMS_ORIGIN_MODEL = 'publicweb.Decision'

If ACTIONITEMS_ORIGIN_MODEL is set, then django-actionitems expects an origin to be provided when adding a new actionitem. The easiest way to do this is to override the get_origin method ActionItemCreateView in views.py. The origin is the pk of the object. For example, if our origin is a "decision", we might set origin as follows:

from actionitems.views import ActionItemCreateView


class MyCustomActionItemCreateView(ActionItemCreateView):

    def get_origin(self, request, *args, **kwargs):
            origin = 'code for acquiring origin objects id' # e.g. origin = kwargs.get('decisionpk')
            return origin

get_origin() is called by the get_initial() method of ActionItemCreateVeiw, if you override get_initial() for this form, remember to supply an origin or manually call get_origin()

overriding success_urls

You will likely want to override the success urls using get_success_url() method in your views

migrating with south

A south migration script is included to setup the basic table. However, if you wish to use an origin_model you will need to manually write a second migration script to add this column to your actionitems table.

To do this in a way that brought my second migration under version control, I did the following:

  1. ./manage.py schemamigration actionitems --auto
  2. This generated 0002_auto__add_field_actionitem_origin.py, but it placed it in my actionitems directory that was not under version control
  3. I moved this migration script, to my main app's migrations directory (which is under version control)
  4. I added a dependency:
class Migration(SchemaMigration):

    depends_on = (
        ("actionitems", "0001_initial.py"),
    )

    def forwards(self, orm):

I then completed the migration, with ./manage.py migrate main

running the tests

The tests are not included as part of the actionitems app and so won't run when installed in your project and you use ./manage.py test. If you want to develop or extend the actionitems app you can run the tests with tox by running tox. (Instructions on installing tox

You can pass py.test arguments by using tox -- {your arguments}. For example, to pass the py.test argument --pastebin=all use tox -- --pastebin=all or to pass -v --tb=short tox -- -v --tb=short

About

Add tasks to your django application.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages