On 20/07/10 20:04, Andreas Pfrengle wrote:
> I've tried it with and without installing in settings.INSTALLED_APPS,
> didn't work, table wasn't created vis syncdb.
> 


> David, nevertheless the link you've posted gave me the clue how to
> solve the problem. I've defined my external module's class as an
> abstract base class:
> <http://docs.djangoproject.com/en/dev/topics/db/models/#abstract-base-
> classes>



Well, now I'm worried I led you astray:

Bear in mind that a django "application" can be written to be
_reusable_. (beware django-conventional terminology
here - django says "project" where a lot of people would say "[web]app"
and "app" where some people might say "plugin" or "component")

I don't know what exactly you're doing, but so far I haven't seen stuff
that suggests creating a "django_timer" reusable app and adding it to
the INSTALLED_APPS for any projects you want to use it in isn't what you
really wanted to do, and you've just sorta missed that "app" is a unit
of reusability in django terms.

That's what other responses to you were getting at, but were somewhat
terse (or I'm rather verbose).

So you might make;

django_timer/
    __init__.py # empty, probably
    models.py
    ...


with models.py containing a _concrete_ class Tim(models.Model).

Then when you add your "django_timer" to settings.INSTALLED_APPS of a
django project, it will include your Tim model along with other models.


There are large lists of such reusable django "apps" on the web, like
http://djangozen.com/app/


A larger reusable app structure might look like:

django_timer/
    __init__.py
    admin.py # django admin registration of stuff.
    models.py # models you want to be able to use in different projects
    views.py  # possibly some associated reusable views.
    urls.py # possibly a reusuable url subtree structure.
    templates/  # some default/example templates used by views.
        django_timer/  # some informal namespace for them
            something.html # I prefer .html.djt, but never mind.
    templatetags/
        django_timer_tags.py # some custom templatetags...
    management/
        __init__.py
        commands/
             __init__.py
             timerfrob.py # custom command "./manage.py timerfrob"


Consider the structure of, say, the django bundled django.contrib apps,
or studying the structure of "pinax", say, might be useful:

http://github.com/pinax/pinax/tree/master/pinax/apps/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to