decorators and generic views

2011-03-24 Thread Ian Stokes-Rees
I think with the move to class-based Generic Views it is necessary to update this documentation: Limiting access to generic views To limit access to a *generic view*, write a thin wrapper around the view, and point your URLconf to your

Configuring common site URL paths for use in templates

2011-03-23 Thread Ian Stokes-Rees
I have a bunch of regular site paths that I'd like to be able to refer to both in my Python code and in my templates, e.g. settings.py: site_root = "/portal" contact_url = site_root + "/contact" sitemap_url = site_root + "/sitemap" login_url = site_root + "/account/login" logout_url = site_root

Re: FormPreview with file upload problems

2011-02-10 Thread Ian Stokes-Rees
This problem is more subtle than I had originally appreciated. Textual data is just re-submitted via an embedded hidden form, and the security hash is used to ensure that it hasn't been modified. File data is harder to cope with. There are a few options: 1. The originally uploaded file is

FormPreview with file upload problems

2011-02-10 Thread Ian Stokes-Rees
I've followed the instructions here: http://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-preview/ to setup a form preview system. The problem is that my form includes a mandatory file upload. I modified the form template to include: however I still have problems processing the

upload_to chicken and egg problem

2011-02-10 Thread Ian Stokes-Rees
I would like to do the following: class WSMRTask(GridTask): tasktype= "wsmr" mtz_fp = FileField("MTZ file", upload_to=WSMRTask.path_gen) class GridTask(Model): tasktype= "unspec" def path_gen(instance, filename): return "%s/%s" % (WSMR_RELPATH,

FormPreview and ModelForms

2011-02-10 Thread Ian Stokes-Rees
I'm using FormPreview with a ModelForm. My done() method gets the request and the cleaned_data once form.is_valid() evaluates to True. I'm wondering if I need to do anything special to use the cleaned_data or handle the form-uploaded files. My current class definition is: class

Re: Including apps for inherited models in INSTALLED_APPS

2011-02-08 Thread Ian Stokes-Rees
I'm (reasonably) happy to include base models in INSTALLED_APPS, but this argument: On 2/8/11 4:32 AM, Tom Evans wrote: > Explicit is better than implicit. If you want models from app 'base' > installed on your system, you add the 'base' app to INSTALLED_APPS. > Otherwise, its a series of $MAGIC

Re: read-only Form.as_* views

2011-02-07 Thread Ian Stokes-Rees
On 2/7/11 5:29 PM, Ian Stokes-Rees wrote: > This sounds good. Form Preview could be useful, but right now I just > want to be able to use Generic Views (DetailView.as_view()) to render > the default context object using "as_table()", but I'm failing to do that. > > {{ o

Re: read-only Form.as_* views

2011-02-07 Thread Ian Stokes-Rees
This sounds good. Form Preview could be useful, but right now I just want to be able to use Generic Views (DetailView.as_view()) to render the default context object using "as_table()", but I'm failing to do that. {{ object.as_table }} returns nothing, whereas, {{ object.name }} etc. works

Re: Including apps for inherited models in INSTALLED_APPS

2011-02-07 Thread Ian Stokes-Rees
On 2/7/11 3:50 PM, Shawn Milochik wrote: > Because when the model isn't abstract, the fields > in the base model aren't created for the subclass -- the subclass has > a foreign key to an instance of the base model. > That last bit should explain why you need to have the base app in > installed

read-only Form.as_* views

2011-02-07 Thread Ian Stokes-Rees
fields displayed just as table entries or textareas which can't be edited. In other words, no or tags. TIA. Ian Stokes-Rees -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegr

Re: Including apps for inherited models in INSTALLED_APPS

2011-02-07 Thread Ian Stokes-Rees
On 2/7/11 3:38 PM, Shawn Milochik wrote: > Is your base model abstract? If it is not, then the ORM will want to > create it in the database. No, it isn't abstract. It has a particular content model and methods associated with it. When you say the ORM will "want" to create it in the DB, do you

Including apps for inherited models in INSTALLED_APPS

2011-02-07 Thread Ian Stokes-Rees
django.db.models.Model and consequently create the necessary tables for MyBaseModel. Or have I just misunderstood why it was necessary for me to include "base" in order to get the tables created properly by "manage.py syncdb"? TIA, Ian Stokes-Rees -- You received this mess

upload file to specific directory/id?

2008-06-25 Thread stoKes
within django is it possible to customize upload_to in order to save the file into a /folder/id/category type situation? so far it just dumps everything into one directory. thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: offline application for searching entire disks of images

2008-02-22 Thread stoKes
On Feb 22, 12:03 pm, stoKes <[EMAIL PROTECTED]> wrote: > offline application searches an entire disk for images, this is going > to be out of the scope and control of media_url. i thought about using > static serve, however, i think that will conflict with the other > existing

offline application for searching entire disks of images

2008-02-22 Thread stoKes
offline application searches an entire disk for images, this is going to be out of the scope and control of media_url. i thought about using static serve, however, i think that will conflict with the other existing views. anyone know of a way to make this work? thanks adam

Re: Problem setting up a separate media server

2007-01-05 Thread stoKes
On Dec 13 2006, 7:46 pm, "Joseph Heck" <[EMAIL PROTECTED]> wrote: Good point - done. http://code.djangoproject.com/wiki/CookBookUsingExternalMedia -joehttp://www.rhonabwy.com/wp/ On 12/13/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > On 12/13/06, Joseph Heck <[EMAIL PROTECTED]> wrote: >

python syntax highlighter style change issue

2007-01-05 Thread stoKes
hi all, using a little bit of code snippets from pygments demo app views and of course using pygments with django for syntax highlighting. im running into an issue where no matter what style ive selected i can't get it to highlight properly.. to get around this ive manually copied a stylesheet

Re: problem with inclusion_tag

2007-01-04 Thread stoKes
On Jan 4, 6:42 pm, "Jorge Gajon" <[EMAIL PROTECTED]> wrote: On 1/4/07, stoKes <[EMAIL PROTECTED]> wrote: > On Jan 4, 12:10 pm, "Jorge Gajon" <[EMAIL PROTECTED]> wrote: > > Hi Adam, > > On 1/3/07, stoKes <[EMA

Re: problem with inclusion_tag

2007-01-04 Thread stoKes
On Jan 4, 12:10 pm, "Jorge Gajon" <[EMAIL PROTECTED]> wrote: Hi Adam, On 1/3/07, stoKes <[EMAIL PROTECTED]> wrote: > base.html > {% showmenu %} > {% for service in services %} > {{ > service.name }} >

problem with inclusion_tag

2007-01-03 Thread stoKes
Running into a bit of an issue trying to load a custom tag in my base.html file. ive got /project/templates/base.html /project/templatetags/showmenu.py showmenu.py from django.template import Library, Node from django.contrib.auth.models import User from django.conf import settings register =

template inheritance problem

2006-12-28 Thread stoKes
I'm having a bit of an issue with template inheritance and using the linebreaks filter. When displaying text the linebreaks successfully get interpreted to paragraph and br tags and the source displays them as so. However, paragraph tags are not creating and extra line space, everything is being

Re: manytomany not being properly generated in db

2006-12-20 Thread stoKes
On Dec 20, 2:50 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: On 12/20/06, stoKes <[EMAIL PROTECTED]> wrote: > However, running `python manage.py syncdb` doesn't create table > `blogs_tag_blog` for the many to many relation. Am I missing a > particula

manytomany not being properly generated in db

2006-12-19 Thread stoKes
Im using django .96-pre and searched the bug page but didn't find anything relevant. Here is my code model to create a 'tag' like datamodel for my blog entries : class Blog(models.Model): title = models.CharField(maxlength=200) body = models.TextField() pub_date =