Skip to content

axxonback/django_web_sample_fiee-dorsale

 
 

Repository files navigation

fiëé dorsale

Rationale

In most of my projects I need some of the same features of Django models, e.g. management data like owner and change date. You don’t want to handle that for every model in every view again.

For my modular editorial and office automation system "fiëé cérébrale" everything must be site dependent - most reusable apps out there don’t care about site dependency, even if everyone has django.contrib.sites installed.

I’d like to give back to the open source community, but of course nothing customer-specific and no embarassing secrets from the git history, so it’s time to pull the generic stuff out of my projects.

I’m planning to make this a cosmos of loosely coupled data bits – attachable sticky notes (fiëé adhésive), events (fiëé témporâle), geodata (fiëé locâle, coming soon), categorized with tagging – and some useful apps on top of that: a collaboration tool with to-do list and doodle-like functions (fiëé preposale, not yet public), a party/banquet planner (fiëé festîve, not yet public), tools for publishers (fiëé édition, not public) and maybe more. Probably too much for one man’s hobby. I was also projecting some club-and-congress management app (usable e.g. for associations and churches), perhaps also LETS...

What and how

  • Use dorsale.models.DorsaleBaseModel as base for your own models, and you get for free:

    • "created by / on" and "last changed by / on"
    • "deleted" marker (no real deletion anymore)
    • "site" ID
    • "objects.all()" returns only not-deleted objects of the current site (see dorsale.models.managers.DorsaleSiteManager)
    • some metadata methods for your templates

    Functionality of DorsaleBaseModel comes from mixins that you can also use on their own:

    • AuthorMixin: created and last changed information
    • SiteMixin: site ID
    • AuthorSiteMixin: combined AuthorMixin and SiteMixin (since both override save)
    • FakeDeleteMixin: "deleted" marker
    • FieldInfoMixin: metadata methods
  • Use dorsale.models.managers.DorsaleSiteManager and dorsale.models.managers.DorsaleGroupSiteManager to restrict "objects.all()" like above or even to items that belong to a Group the current User belongs to.
  • Use siteprofile ...
    • to change your application’s view by site
    • to restrict parts of your application (modules) by site
  • Use dorsale.mptt ...
    • to get hierarchical dorsale models

See the code for more information!

Dependencies

  • Python 2.7
  • Django 1.6+ with included contributions (1.9 suggested)
  • django.contrib.sites (only if you use site dependent models)
  • django-registration (or compatible)
  • Templates and widgets use jQuery and jQuery UI
  • django-mptt for dorsale.mptt (beware, dorsale.mptt is not tested with current django-mptt!)
  • Optional fiëé colorée for color picker widget
  • Optional xlwt and odfpy if you want to export data to XLS and/or ODS
  • far too much other stuff that you only need under special circumstances

Known Issues

  • uses the deprecated user.message_set.create instead of the messages framework in situations where there’s no request object TODO: use e.g. django-async-messages
  • admin site doesn’t work completely
  • No proper permission checks (but user-group-ownership checks)
  • Still too much dependencies on internal asumptions and other non-public fiee projects (commented code)
  • No tests (must finally learn to write them)
  • lotsa...

Ideas

  • Use class based views
  • Try to extract base model stuff to mixins to ease inheritance, have a look at https://github.com/bmihelac/ (django-site-permissions and django-sites-ext)
  • Add Sphinx docs and enhance setup.py

License

BSD, see LICENSE (may not entirely be allowed, must still check licenses of used code)

Author(s)

About

base classes for fiëé’s django projects

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 86.7%
  • HTML 12.9%
  • Shell 0.4%