render_to_response failed to render media files in base.html

2008-10-19 Thread Chuck Bai2

Here is my view code:

def contact(request):
form = ContactForm() # An unbound form
return render_to_response('contact.html', {
'form': form,
})

My contact form page rendered but without all the media files(CSS files, 
Javascripts files, images). The text part of the page is OK and I can 
see my contact form displayed OK.

If I left the form out, just render the page using direct_to_template 
like below, the page is working fine. All the media files are rendered.

def contact(request):
return direct_to_template(request, template='contact.html')

My contact.html extends base.html and all the media file references are 
in the base.html. It seems render_to_response failed to render media 
files while direct_to_template delivered successfully. I am using 
development trunk (revision 9236). Anyone knows why?

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom Template Tag with {% end... %} tag

2008-10-19 Thread James Bennett

On Sun, Oct 19, 2008 at 4:20 PM, Erik Allik <[EMAIL PROTECTED]> wrote:
> In the compilation function of your template tag, you can force the
> parser to parse until tag named "endyourcustomtag" by calling nodelist
> = parser.parse(("endyourcustomtag", ). This will return the contents
> of your block tag as a list of nodes. Finally you can "drop off" the
> end tag by calling parser.delete_first_token() because parser.parse
> left the parser in a state where "endyourcustomtag" is still unparsed.

And there's even documentation on how to do this, based on the example
of the built-in comment/endcomment:

http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#parsing-until-another-block-tag


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: separate users from django admin'able users

2008-10-19 Thread tvaughan

On Oct 19, 12:32 am, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
> Wiadomość napisana w dniu 2008-10-19, o godz. 00:02, przez tvaughan:
>
> > I'm definitely ok with admins having to create another account to use
> > the site. The two pools of users seems to me to be totally unique, and
> > shouldn't overlap in anyway.
>
> Just do not set is_staff for "ordinary" users that are not allowed to  
> log in to admin interface.

Yes. I am aware of that. This is what prompted my question in the
first place. How do I create two unique sets of users where the first
set doesn't have such a field and could never be mistaken for admins,
and the other are admins with various levels of permission within the
admin interface? If people really just do mix the two and use this
field to separate them, then I suppose that's what I'll do. It just
seems like bad practice to me. Thanks.

-Tom


--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom Template Tag with {% end... %} tag

2008-10-19 Thread Siah

Thank you!
Sia

On Oct 19, 5:20 pm, Erik Allik <[EMAIL PROTECTED]> wrote:
> In the compilation function of your template tag, you can force the  
> parser to parse until tag named "endyourcustomtag" by calling nodelist  
> = parser.parse(("endyourcustomtag", ). This will return the contents  
> of your block tag as a list of nodes. Finally you can "drop off" the  
> end tag by calling parser.delete_first_token() because parser.parse  
> left the parser in a state where "endyourcustomtag" is still unparsed.
>
> Find a find on "def do_if(parser, token):" -- check out how the if tag  
> has been written.
>
> Erik
>
> On 19.10.2008, at 23:24, Siah wrote:
>
>
>
> > Hi,
>
> > I can't understand how template tags such as if, for and ifequal
> > manage to have an accompanying endif, endfor and endifequal, and I
> > can't have it. Or I can't manage to find out how to do it. So, I
> > basically want to do something like:
>
> > {% customTag %} hello {% endcustomTag %}
>
> > and within my customTag implementation, have 'hello' as a parameter.
>
> > Thanks for all the help in advance,
> > Sia
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django crashes Python without traceback on Mac OS X (Release 1.0)

2008-10-19 Thread Graham Dumpleton



On Oct 20, 11:34 am, "jd.strickler" <[EMAIL PROTECTED]> wrote:
> Just as a heads up: if you have a 64-bit Intel chip running OS X
>
> The cross-compiling/Universal Binary issue may come up to bite you (it
> did me).  Apache runs in 64-bit mode while most of the system runs in
> 32-bit mode, meaning that every part of your Django stack has to be
> compiled for both into a UB.
>
> Specifically, I had to hack around with mod_python, Postgresql,
> psycopg2, and python-ldap (for an LDAPBackend I wrote; not needed for
> a vanilla Django setup).  Ccompiling this stuff correctly usually
> means adding a few tags in the right file.
>
> (Because I'm an idiot) this took me ~2 months to get right.  So, if
> you solve your stack overflow issue and run into any of these, email
> me and I'll send over the documentation I have.

Or you force Apache to run in 32 bit more.

For details see:

http://code.google.com/p/modwsgi/wiki/InstallationOnMacOSX#Thinning_The_Apache_Executable

Plus comment to same document which explains easier way by changing
plist file.

Graham
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django crashes Python without traceback on Mac OS X (Release 1.0)

2008-10-19 Thread jd.strickler

Just as a heads up: if you have a 64-bit Intel chip running OS X

The cross-compiling/Universal Binary issue may come up to bite you (it
did me).  Apache runs in 64-bit mode while most of the system runs in
32-bit mode, meaning that every part of your Django stack has to be
compiled for both into a UB.

Specifically, I had to hack around with mod_python, Postgresql,
psycopg2, and python-ldap (for an LDAPBackend I wrote; not needed for
a vanilla Django setup).  Ccompiling this stuff correctly usually
means adding a few tags in the right file.

(Because I'm an idiot) this took me ~2 months to get right.  So, if
you solve your stack overflow issue and run into any of these, email
me and I'll send over the documentation I have.

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login_required for imported apps

2008-10-19 Thread James Bennett

On Sun, Oct 19, 2008 at 2:10 PM, bruno desthuilliers
<[EMAIL PROTECTED]> wrote:
> Indeed. But , OTHO, having to copy/paste a whole urls.py just to a add
> a simple decorator on the view functions is not really DRY.

Personally, I don't agree; writing code to do what you want, even if
it starts with copy/pasting someone else's code, isn't really
"repetition". Far too often on this list, people confuse "DRY" with
"never write any code at all".


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: is it possible to run 0.96 and 1.0 in parallel?

2008-10-19 Thread James Bennett

On Sun, Oct 19, 2008 at 4:55 PM, Rachel Willmer <[EMAIL PROTECTED]> wrote:
> It doesn't seem possible to run Django 1.0 and 0.96 concurrently on the same
> machine AFAICS - am I going to have to set up another machine to work on the
> 1.0 upgrade while I maintain the 0.96 release?

It's actually pretty easy; just set up two directories of code, one
with each version of Django, and point the Python path of each site to
the appropriate location. There are also Python tools like virtualenv
which make this even simpler to do.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: missing template for admin

2008-10-19 Thread Steve Holden

DanJ wrote:
> Hi,
> 
> I'm new to Django so please pardon my ignorance.
> I've just installed Django 1.0 from SVN. I'm trying to follow the
> tutorial, while at the same time use Apache and mod_python.
> 
> When I point my browser to the admin site I get a simple text version,
> as if it missing the template.
> - Are there any logs to check in order to verify if the template was
> not found?
> - What could be causing this error?

The issue here is that the CSS files aren't being served by Apache. Take
a look at

http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#serving-media-files

to see how to configure Apache to serve the files.

regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



missing template for admin

2008-10-19 Thread DanJ

Hi,

I'm new to Django so please pardon my ignorance.
I've just installed Django 1.0 from SVN. I'm trying to follow the
tutorial, while at the same time use Apache and mod_python.

When I point my browser to the admin site I get a simple text version,
as if it missing the template.
- Are there any logs to check in order to verify if the template was
not found?
- What could be causing this error?

Thanks,
Dan

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: filter OR for results...

2008-10-19 Thread Erik Allik

CollegeTeam.objects.filter(team=game.team1) |  
CollegeTeam.objects.filter(team=game.team2)

But I would instead recommend:
CollegeTeam.objects.filter(team__in=[game.team1, game.team2])

Erik

On 20.10.2008, at 1:22, [EMAIL PROTECTED] wrote:

>
> I have a model that is tracking all of the college football games,
> there's an entry for each game, with the two teams represented in the
> fields 'team1' and 'team2'. These are foreign keys to the model
> 'CollegeTeams'. I'm trying to run a query so that it'll get the
> results from the Game for each team and display it on the team page.
>
> So I have Game.objects.all() to get all of the games, then what I know
> to do would be CollegeTeam.objects.filter(team=game.team1), but what I
> want is to get the team if they're team1 or team2. I looked through
> the docs and say how do to a lot of variations on the queries, but
> didn't see a way to use the objects.filter() with the OR statement.
> Any help? Quick example of the query I'm trying to run below.
>
> SELECT from CollegeTeam WHERE team1 = CollegeTeam.id OR team2 =
> CollegeTeam.id
> >


--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



filter OR for results...

2008-10-19 Thread mccomas . chris

I have a model that is tracking all of the college football games,
there's an entry for each game, with the two teams represented in the
fields 'team1' and 'team2'. These are foreign keys to the model
'CollegeTeams'. I'm trying to run a query so that it'll get the
results from the Game for each team and display it on the team page.

So I have Game.objects.all() to get all of the games, then what I know
to do would be CollegeTeam.objects.filter(team=game.team1), but what I
want is to get the team if they're team1 or team2. I looked through
the docs and say how do to a lot of variations on the queries, but
didn't see a way to use the objects.filter() with the OR statement.
Any help? Quick example of the query I'm trying to run below.

SELECT from CollegeTeam WHERE team1 = CollegeTeam.id OR team2 =
CollegeTeam.id
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Console output

2008-10-19 Thread Ned Batchelder
There's no global switch to turn off the console output.  Your Django 
code is simply Python code running in a process, and if you use the 
print statement, it will print to the stdout of the process.  You will 
have to conditionalize the print statements if you don't want to see 
them.  Your other option is to change where sys.stdout points, but that 
will change it for the entire process, which may not be what you want.

--Ned.
http://nedbatchelder.com

Bob Cowdery wrote:
> I didn't say I was using it in production. This is development and I
> would prefer not to have streams of stuff coming out on the console.
> So how do I turn it off.
>
> Bob
>
> On Sun, 2008-10-19 at 11:08 -0700, Daniel Roseman wrote:
>   
>> On Oct 19, 7:05 pm, Bob Cowdery <[EMAIL PROTECTED]> wrote:
>> 
>>> This is probably staring me in the face but I can't figure out how to
>>> turn off the HTTP console output on the built-in server. I have an Ajax
>>> poll running and this output is slowing things down.
>>>
>>> Thanks
>>> Bob
>>>   
>> Quite simply, you shouldn't be using the built-in server in
>> production. That's why it's called the development server.
>> --
>> DR.
>> 
>
>
> >
>
>
>   

-- 
Ned Batchelder, http://nedbatchelder.com


--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



is it possible to run 0.96 and 1.0 in parallel?

2008-10-19 Thread Rachel Willmer
This might be a FAQ but I've googled and can't find the answer...

I'm considering upgrading some websites from 0.96 to 1.0 but I need to be
able to upgrade the current site while I work through the migration process.

It doesn't seem possible to run Django 1.0 and 0.96 concurrently on the same
machine AFAICS - am I going to have to set up another machine to work on the
1.0 upgrade while I maintain the 0.96 release?

Any pointers welcome
Rachel

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: save_model and how to ignore any changes to an object

2008-10-19 Thread TiNo
In django admin, there is a save_as option.

see http://docs.djangoproject.com/en/dev/ref/contrib/admin/#save-as

You could also save revisions of objects. Check:
http://code.djangoproject.com/wiki/FullHistory
http://code.google.com/p/django-reversion/
http://code.google.com/p/django-history/

Good luck

On Sun, Oct 19, 2008 at 7:21 PM, Markos Gogoulos <[EMAIL PROTECTED]>wrote:

>
> hi all. When I edit an object on django admin and press save, I want
> the object NOT to be saved, but instead create another object that
> contains any changes (I want to be able to review it later). So the
> original object has to be unchanged. I tried with this:
>
> def save_model(self, request, obj, form, change):
>if form.changed_data:
>#create the other object
># bla bla
>
>
> Now when I save an item, the other object is created, but m2m changes
> are saved in my object as well. That is attributes like Charfield,
> Integer field etc are not saved in the original object, but m2m
> relationships are saved!
>
>
> Any ideas on why this is happening and how I can achieve the original
> object not be changed?
> Also any link that already implements this would just be great for me!
>
> Thanks
>
>
>
> >
>

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom Template Tag with {% end... %} tag

2008-10-19 Thread Erik Allik

In the compilation function of your template tag, you can force the  
parser to parse until tag named "endyourcustomtag" by calling nodelist  
= parser.parse(("endyourcustomtag", ). This will return the contents  
of your block tag as a list of nodes. Finally you can "drop off" the  
end tag by calling parser.delete_first_token() because parser.parse  
left the parser in a state where "endyourcustomtag" is still unparsed.

Find a find on "def do_if(parser, token):" -- check out how the if tag  
has been written.

Erik

On 19.10.2008, at 23:24, Siah wrote:

>
> Hi,
>
> I can't understand how template tags such as if, for and ifequal
> manage to have an accompanying endif, endfor and endifequal, and I
> can't have it. Or I can't manage to find out how to do it. So, I
> basically want to do something like:
>
> {% customTag %} hello {% endcustomTag %}
>
> and within my customTag implementation, have 'hello' as a parameter.
>
> Thanks for all the help in advance,
> Sia
> >


--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Console output

2008-10-19 Thread Bob Cowdery

I didn't say I was using it in production. This is development and I
would prefer not to have streams of stuff coming out on the console.
So how do I turn it off.

Bob

On Sun, 2008-10-19 at 11:08 -0700, Daniel Roseman wrote:
> On Oct 19, 7:05 pm, Bob Cowdery <[EMAIL PROTECTED]> wrote:
> > This is probably staring me in the face but I can't figure out how to
> > turn off the HTTP console output on the built-in server. I have an Ajax
> > poll running and this output is slowing things down.
> >
> > Thanks
> > Bob
> 
> Quite simply, you shouldn't be using the built-in server in
> production. That's why it's called the development server.
> --
> DR.
> > 


--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Cache and upload handlers .. fun times!

2008-10-19 Thread truebosko

Hi there,

So I spent the last few hours trying to get a ProgressBar Upload
handler working

What it does: User uploads a file, when they hit the submit button,
javascript is called and begins polling the server (a django view) for
progress. Progress is stored in a cache_key, very simple idea.

The Problem: The cache key is not being written to the database until
AFTER the upload is complete. I watched the database and the key did
not show up in it until the upload was complete. Which makes it
totally useless.

I am using a db backend cache for now, as it's easiest to test with as
I can't test this on dev server so I am using my mediatemple hosting
account (gs) which is where I plan to have the site

Anyone know how I can fix this issue of the cache key being written
AFTER the file is uploaded? No point of a progress bar that can't
move ;)


For reference, the core of my upload handler is derived from this
script:
http://74.125.95.104/search?q=cache:CYUWj0umZWMJ:www.djangosnippets.org/snippets/678/+django+snippet+ajax+upload&hl=en&client=firefox-a&gl=ca&strip=1

Thanks all in advance .. this has been a long battle but I hope to get
it working soon
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Custom Template Tag with {% end... %} tag

2008-10-19 Thread Siah

Hi,

I can't understand how template tags such as if, for and ifequal
manage to have an accompanying endif, endfor and endifequal, and I
can't have it. Or I can't manage to find out how to do it. So, I
basically want to do something like:

{% customTag %} hello {% endcustomTag %}

and within my customTag implementation, have 'hello' as a parameter.

Thanks for all the help in advance,
Sia
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: dynamic upcast

2008-10-19 Thread Carl Meyer



On Sep 12, 2:57 pm, dadapapa <[EMAIL PROTECTED]> wrote:
>     class BaseClass(models.Model) :
>         final_type = models.ForeignKey(ContentType)
>
>         def save(self,*args) :
>             self.final_type =
> ContentType.objects.get_for_model(type(self))
>             super(BaseClass,self)save(*args)
>
>         def cast(self) :
>             return
> self.final_type.get_object_for_this_type(id=self.id)
>
>     class DerivedClass(ParentClass) :
>         pass

Just ran into this issue myself (first time using non-abstract
inheritance).  The catch with this recipe is that you can never save a
derived object from a parent instance, or you break the final_type
field (it will then contain the parent class content type).

Carl
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Admin uses sessions/auth middleware but don't need those in the main part of the site

2008-10-19 Thread danlester

I've added the admin app, along with necessary middleware. The
sessions and authentication middleware required for admin are not
needed for the main part of my site, so the vast majority of traffic
will be given session identifiers etc that are never used.

I haven't benchmarked in detail, but it seems sensible to separate
into two different sites using the same database. I'd have one
settings file with all the overhead required for the admin part, plus
a lightweight version without it. The sites would run in separate
mod_python instances (or whatever - I'm sure I can play around with
that).

Has anyone else tried this approach, or is there something better?
Maybe a way to wrap the middleware to exclude it in most cases, etc?

On the other hand, I can imagine having separate sites will bring
about other problems...

Thanks in advance for any advice.

Dan

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Inherited classes and generic views - curiosity.

2008-10-19 Thread Scott SA

When passing a QuerySet of objects which inherit part of their model
from another class, generic views only seems to respond to the parent
class:

Here's a simplified example:

class ParentClass(models.Model):
name_last = models.CharField(max_length=64)
name_first = models.CharField(max_length=64)

class ChildClass(ParentClass):
likes_spam = BooleanField(default=False)

Then, in the urls.py, I pass:
{
"queryset": ChildClass.objects.all()

}

Without specifying the template, generic views looks for
"parentclass_list.html", not "childclass_list.html". After specifying
which template to use, the ChildClass attributes are available via the
1:1 relationship so {{ object.childclass.likes_spam }} will retrieve
the desired attribute.

Where I've been caught with this is I'm inheriting from a generic
application that is not in my project directory. So not only was
django looking for parentclass_list.html and paentclass_detial.html,
it was looking for base_app/parentclass.html, etc.

I expected it to look in derived_app/childclass_list.html, etc.

Is this how this _should_ work, or should I post this to the developer
list and see what shakes?

Thanks,

Scott
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Migration problems (old svn version to 1.0 and new server)

2008-10-19 Thread AdamC
2008/10/19 Jarek Zgoda <[EMAIL PROTECTED]>:
>
> Wiadomość napisana w dniu 2008-10-19, o godz. 20:25, przez AdamC:
>
>> Template error
>>
>> In template /home/adam/apps/films/templates/includes/nav.html, error
>> at line 1
>> Caught an exception while rendering: Reverse for
>> 'films.films.views.edit_film_list' with arguments '()' and keyword
>> arguments '{}' not found.
>> 1 | Film list | > href="{%url films.views.add_film %}">Add a film | Edit | Search | Logout
>>
>> The part that is red in this error report is the {%url - has this
>> changed since version 1?
>>
>> Any other advice on how to fix this error?
>
>
> Double check your urlconf - all views used there have to be
> importable. The error pobably means you have some error in your views
> (or some url pattern pointing to view that does not exist).
>
> --
> We read Knuth so you don't have to. - Tim Peters

My urls.py


from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
(r'^apps/login/.?$', 'django.contrib.auth.views.login'),
(r'^apps/admin/(.*)', admin.site.root),
(r'^apps/films/$', 'films.views.film_list'),
(r'^apps/films/(?P\d+)/$', 'films.views.detail'),
(r'^apps/films/search/$', 'films.views.search'),
(r'^apps/films/addfilm/$', 'films.views.add_film'),
(r'^apps/films/addfilm/thanks/$', 'films.views.add_film_thanks'),
(r'^apps/films/editfilm/(?P\d+)/$', 'films.views.edit_film'),
(r'^apps/films/editfilm/$', 'films.views.film_list'),
(r'^apps/films/deletefilm/$', 'films.views.film_list'),
(r'^apps/films/deletefilm/(?P\d+)$', 'films.views.delete_film'),
(r'^apps/films/logout/$', 'films.views.logout_view'),

)

Anything untoward here?
--
You back your data up on the same planet?
http://www.monkeez.org
PGP key: 0x7111B833

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: login_required for imported apps

2008-10-19 Thread bruno desthuilliers

On 18 oct, 18:12, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Sat, Oct 18, 2008 at 10:22 AM, Heather <[EMAIL PROTECTED]> wrote:
> > Well, after trying to work this out a bit more, it looks like a nice
> > solution is to make a middleware class and use the process_views() but
> > I'm not quite at the answer yet.
>
> Generally, I don't consider the URLs for an application to be set in
> stone; especially with views which are meant to be configurable
> through arguments passed in the URLConf, wiring up a few patterns of
> your own is something to be actively encouraged. So if you want
> login_required, set up the URLs so you'll have it.

Indeed. But , OTHO, having to copy/paste a whole urls.py just to a add
a simple decorator on the view functions is not really DRY.

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Migration problems (old svn version to 1.0 and new server)

2008-10-19 Thread Jarek Zgoda

Wiadomość napisana w dniu 2008-10-19, o godz. 20:25, przez AdamC:

> Template error
>
> In template /home/adam/apps/films/templates/includes/nav.html, error  
> at line 1
> Caught an exception while rendering: Reverse for
> 'films.films.views.edit_film_list' with arguments '()' and keyword
> arguments '{}' not found.
> 1 | Film list |  href="{%url films.views.add_film %}">Add a film | Edit | Search | Logout
>
> The part that is red in this error report is the {%url - has this
> changed since version 1?
>
> Any other advice on how to fix this error?


Double check your urlconf - all views used there have to be  
importable. The error pobably means you have some error in your views  
(or some url pattern pointing to view that does not exist).

-- 
We read Knuth so you don't have to. - Tim Peters

Jarek Zgoda, R&D, Redefine
[EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Migration problems (old svn version to 1.0 and new server)

2008-10-19 Thread Karen Tracey
On Sun, Oct 19, 2008 at 2:25 PM, AdamC <[EMAIL PROTECTED]> wrote:

>
> I'm migrating my application (a simple film database) to another server.
>
> I installed version 1.0 of django on the new server and set up apache
> with mod_python (which was the same setup on my old server).
>
> However, I seem to be having some problems. When I try and login to my
> application (which seems to work well, I get the error:
>
> TemplateSyntaxError at /apps/films/
> Caught an exception while rendering: Reverse for
> 'films.films.views.edit_film_list' with arguments '()' and keyword
> arguments '{}' not found.
>
> [snip details]


It's possible you are hitting a bug that's been fixed (there have been a
couple of fixes made in this area).  You could try running with current
trunk or the 1.0.X branch (only bug fixes, no new features) and see if this
error Goes Away.  If not, I think some specifics on your url patterns will
be needed to debug what's going on.

Karen

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



variables in forms.py?

2008-10-19 Thread Jorge Romo

Hell guys, I have this little doubt:

I want to validate a form, but it has several different options. It
has to take a value_a and the see if it is bigger, smaller or equal to
another value_b. The issue (or maybe not :p) is that the value_b is
entered by the user, so it is always different, it would be perfect if
i can call that from my views.py but i just don't know how to come
with that.

here is my code:

def clean_value(self):
value_a = self.cleaned_data.get('value_a')
if value_a > value_b:   <- i dunno how to call this if this
value b is on my views.py
raise forms.ValidationError('value_a bigger than
value_b' )
return value_a

Thank you
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django crashes Python without traceback on Mac OS X (Release 1.0)

2008-10-19 Thread vivek

alternatively you can also try to reduce recursion limit by using
sys.setrecursionlimit() to  lower setting which might help you  to
debug the offending secton of code.

vp
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Migration problems (old svn version to 1.0 and new server)

2008-10-19 Thread AdamC

I'm migrating my application (a simple film database) to another server.

I installed version 1.0 of django on the new server and set up apache
with mod_python (which was the same setup on my old server).

However, I seem to be having some problems. When I try and login to my
application (which seems to work well, I get the error:

TemplateSyntaxError at /apps/films/
Caught an exception while rendering: Reverse for
'films.films.views.edit_film_list' with arguments '()' and keyword
arguments '{}' not found.

Original Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/django/template/debug.py",
line 71, in render_node
result = node.render(context)
  File "/usr/lib/python2.5/site-packages/django/template/defaulttags.py",
line 378, in render
args=args, kwargs=kwargs)
  File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
line 254, in reverse
*args, **kwargs)))
  File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
line 243, in reverse
"arguments '%s' not found." % (lookup_view, args, kwargs))
NoReverseMatch: Reverse for 'films.films.views.edit_film_list' with
arguments '()' and keyword arguments '{}' not found.

Request Method: GET
Request URL:http://192.168.1.10/apps/films/
Exception Type: TemplateSyntaxError
Exception Value:

Caught an exception while rendering: Reverse for
'films.films.views.edit_film_list' with arguments '()' and keyword
arguments '{}' not found.

Original Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/django/template/debug.py",
line 71, in render_node
result = node.render(context)
  File "/usr/lib/python2.5/site-packages/django/template/defaulttags.py",
line 378, in render
args=args, kwargs=kwargs)
  File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
line 254, in reverse
*args, **kwargs)))
  File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py",
line 243, in reverse
"arguments '%s' not found." % (lookup_view, args, kwargs))
NoReverseMatch: Reverse for 'films.films.views.edit_film_list' with
arguments '()' and keyword arguments '{}' not found.

Exception Location:
/usr/lib/python2.5/site-packages/django/template/debug.py in
render_node, line 81
Python Executable:  /usr/bin/python
Python Version: 2.5.2
Python Path:['/home/adam/apps', '/usr/lib/python25.zip',
'/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2',
'/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload',
'/usr/local/lib/python2.5/site-packages',
'/usr/lib/python2.5/site-packages',
'/usr/lib/python2.5/site-packages/Numeric',
'/usr/lib/python2.5/site-packages/PIL',
'/usr/lib/python2.5/site-packages/gst-0.10',
'/var/lib/python-support/python2.5',
'/usr/lib/python2.5/site-packages/gtk-2.0',
'/var/lib/python-support/python2.5/gtk-2.0']
Server time:Sun, 19 Oct 2008 19:21:07 +0100

Template error

In template /home/adam/apps/films/templates/includes/nav.html, error at line 1
Caught an exception while rendering: Reverse for
'films.films.views.edit_film_list' with arguments '()' and keyword
arguments '{}' not found.
1   | Film list | Add a film | Edit | Search | Logout

The part that is red in this error report is the {%url - has this
changed since version 1?

Any other advice on how to fix this error?

TIA
Adam
--
You back your data up on the same planet?
http://www.monkeez.org
PGP key: 0x7111B833

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Console output

2008-10-19 Thread Bob Cowdery

This is probably staring me in the face but I can't figure out how to
turn off the HTTP console output on the built-in server. I have an Ajax
poll running and this output is slowing things down.

Thanks
Bob


--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Console output

2008-10-19 Thread Daniel Roseman

On Oct 19, 7:05 pm, Bob Cowdery <[EMAIL PROTECTED]> wrote:
> This is probably staring me in the face but I can't figure out how to
> turn off the HTTP console output on the built-in server. I have an Ajax
> poll running and this output is slowing things down.
>
> Thanks
> Bob

Quite simply, you shouldn't be using the built-in server in
production. That's why it's called the development server.
--
DR.
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: alternative for foreignkey fieldset

2008-10-19 Thread Low Kian Seong
Just curious but has anyone done this is a production environment?

On Sun, Oct 19, 2008 at 1:05 PM, Russell Keith-Magee <[EMAIL PROTECTED]
> wrote:

>
> On Sun, Oct 19, 2008 at 2:40 AM, Low Kian Seong <[EMAIL PROTECTED]>
> wrote:
> > Dear all,
> >
> > Is there another form the foreignkey field can take besides the dropdown?
> I
> > mean if there are 10,000 enteries for a particular foreign key and I am
> not
> > using the admin interface won't it slow things down?
>
> The simple option is to use the raw_id_fields option on the ModelAdmin
> object for the model concerned.
>
> http://docs.djangoproject.com/en/dev/ref/contrib/admin/#raw-id-fields
>
> The advanced option is to define a custom AJAX widget, and tell the
> ModelAdmin to use that widget for the foreign key in question. For
> details on how to do this, read the forms and ModelAdmin documentation
> and search the Django-users archives.
>
> Yours,
> Russ Magee %-)
>
> >
>

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



save_model and how to ignore any changes to an object

2008-10-19 Thread Markos Gogoulos

hi all. When I edit an object on django admin and press save, I want
the object NOT to be saved, but instead create another object that
contains any changes (I want to be able to review it later). So the
original object has to be unchanged. I tried with this:

def save_model(self, request, obj, form, change):
if form.changed_data:
#create the other object
# bla bla


Now when I save an item, the other object is created, but m2m changes
are saved in my object as well. That is attributes like Charfield,
Integer field etc are not saved in the original object, but m2m
relationships are saved!


Any ideas on why this is happening and how I can achieve the original
object not be changed?
Also any link that already implements this would just be great for me!

Thanks



--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Simplest unit testing of models fail ...

2008-10-19 Thread Karen Tracey
On Sun, Oct 19, 2008 at 8:38 AM, zobbo <[EMAIL PROTECTED]> wrote:

>
> After some conversation on irc, it appears that you can only validate
> Django objects by using Django forms.
>
> I do find that odd but I won't get into that conversation at the
> moment.
>
> Instead let me describe my problem to the world and see if anybody has
> any suggestions.
>
> [snip]
> Am I barking up the wrong tree completely?
>

No.  Model validation is being developed, it's just not there yet.  The
ticket to watch in #6845:

http://code.djangoproject.com/ticket/6845

It's got a recent patch if you're feeling adventurous and want to help out
with getting it tested and integrated into the code base.  If not, here's a
blog post from Malcolm about an approach to using forms to do your own model
validation now:

http://www.pointy-stick.com/blog/2008/10/15/django-tip-poor-mans-model-validation/

Karen

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Simplest unit testing of models fail ...

2008-10-19 Thread zobbo

After some conversation on irc, it appears that you can only validate
Django objects by using Django forms.

I do find that odd but I won't get into that conversation at the
moment.

Instead let me describe my problem to the world and see if anybody has
any suggestions.

I have a number of applications which are 50% web frontend and 50%
python backend. Historically the frontends have been either zope or
Ruby on Rails. Historically the two sides have communicated using
xmlrpc. That's fine for small pieces of data but we doesn't scale
particularly well. I'll outline one issue.

We have, in the python backend, logic for scanning. Users have
scanners. When all 20 parts on a stillage are scanned, that stillage
is closed. When all four stillages on a stillage cycle are scanned,
that stillage cycle is closed. There are special rules for allowing
rescanning etc and that all sits within the python/twisted code. If
the scanners go down we have to use frontends to do the same thing. So
now they're clicking on parts and completing stillages. etc. etc. It's
the same rules but this time they're inputting through the web
frontend, not over scanners going into a ip socket. I want that logic
in ONE place.

My plan was to use the Django ORM to handle this but now I have to
cope with the fact that (for example) although Django has been told
the input can't be more than 5 chars for a certain input, it will only
use that logic if I am using the models with the Django frontend. So
on the backend I've got to sanitise the data before tyring to write it
and that's just duplication.

Why am I using Django? Because 90% of the web stuff is provided by the
admin site in Django and it does a damn fine job. But should I
consider moving elsewhere?

Am I barking up the wrong tree completely?

Ian

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to send emails when after an event happened?

2008-10-19 Thread reyjexter

I think you need to be more specific with what you want to do.

On Oct 19, 2:04 pm, Net_Boy <[EMAIL PROTECTED]> wrote:
> Hi,
>
>    I am doing a new project and  (doing a function that checks  for a
> specific event, if it happened then the system should send email to
> the user? so how can I do that?
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Template variables in forms

2008-10-19 Thread Martin

Hello,

i'm trying to use formwizard for my project, but i can't seem to solve
the problem. I have two step formwizard, and i need a variable from
first step to show up in the next.
Second step is a queryset of "available texts" - and there is a
"name" ( lets say {{ name }}) variable in it, that needs to be filled
up according to the name you enter in the first step.

Available texts look something like: Hello, {{ name }} or Wassup,
{{ name }}, etc. Since this available text are selected through
queryset i cannot put a template variable in them.
Does anyone have a solution to this kind of problem?

Thanks in advance,
Martin

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: middleware or view ?

2008-10-19 Thread PonasNiekas

Thanks Russ for the replay. Your idea would certainly work and I agree
that
doing calculations outside django/web server makes sense. I will
probably
and up doing the way you described.

On the other hand, having the whole thing in django without any
external
components would kinda be nice.. Would it help if calculations doing
class
would be threaded ?

--
PonasNiekas
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Simplest unit testing of models fail ...

2008-10-19 Thread zobbo

Russell

Many thanks for taking the time to reply.

On Oct 19, 6:13 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:

> On Sun, Oct 19, 2008 at 4:00 AM, Ian J Cottee <[EMAIL PROTECTED]> wrote:
> As far as I can make out, the error you are getting is unrelated to
> the problem you are describing. Your error is telling you that you
> can't flush the database. If you're getting that error, Django hasn't
> started to run the test yet, so the issue isn't with your test code.
> If your test case contained nothing but "self.assertEquals(1,1)", you
> would get the same error. The problem lies with the test database
> itself.

I did as you said. The issue is actually one that I now recall I
reported last January

http://tinyurl.com/5r6jm6

When a test fails and another test then runs, it dies because the
transaction is in error.  The field with too many chars fails and that
causes the next test to raise an error. If you switch the backend to
SQLLite for example you don't get any errors.

Funnily enough, I can stop that happening by using the solution given
at::

   http://www.stereoplex.com/two-voices/django-unit-tests-and-transactions

Although the comments to that article imply that Django's own unit
test framework should be doing this?

I think I have two questions now:

1. Is this a bug? Surely one test failing shouldn't affect the other
tests? And surely running your unit tests against different backends
should give the same result.

and perhaps much more simply ...

2. How DO you test if an object is going to fail to be saved, before
trying to save it? The validates method appears to have been removed
now.

For the record this is Django from svn using postgres 8.3 and
psycopg2, running on Hardy,

Ian
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Python on Windows re-using old .pyc files?

2008-10-19 Thread Ulf Kronman

Hi all,
I've been coding database development with Django for about a year in
a Mac OS X and Linux environment using a Postgres database.

Now I have moved to a new organisation and is trying to use Django for
development against a big bibliometric legacy database in MS SQL
Server in a Windows environment.

With the help of the good guys over at Django-pyodbc (http://
code.google.com/p/django-pyodbc/) and a bit of struggling and some
tweaks, I have managed to get Django working against the database.

I am primarily working on a web interface towards the database, so I'm
doing my development work using Apache 2.2 and mod_python
(3.3.1.16113)

When I had set up my development environment in Windows I started to
notice a peculiar behaviour that I hadn't seen before in the Mac/Linux
environment; it seems as if the Python interpreter only creates
new .pyc files every second time I reload a web page.

I'm using Eclipse (3.4.1) and PyDev (1.3.22) as my editing
environment, and in the error reporting on the web pages I get
updated .py code reported, but the error from the previous code is
still reported as the cause for the error, which leads me to suspect
that old .pyc files are reused.

I'm using Django trunk and I have set the MaxRequestsPerChild 1
directive in httpd.conf. I'm running on Windows XP (sp3?).

Has anyone here seen this behaviour and know what may be causing it?
Can It be some kind of setting in Eclipse on Windows that makes the
source code files not being flagged as changed or is this a behaviour
specific for Python/Windows?

Thanks for any clues on this,
Ulf
--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: separate users from django admin'able users

2008-10-19 Thread Jarek Zgoda

Wiadomość napisana w dniu 2008-10-19, o godz. 00:02, przez tvaughan:

> I'm definitely ok with admins having to create another account to use
> the site. The two pools of users seems to me to be totally unique, and
> shouldn't overlap in anyway.


Just do not set is_staff for "ordinary" users that are not allowed to  
log in to admin interface.

-- 
We read Knuth so you don't have to. - Tim Peters

Jarek Zgoda, R&D, Redefine
[EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: middleware or view ?

2008-10-19 Thread Russell Keith-Magee

On Sun, Oct 19, 2008 at 5:19 AM, PonasNiekas <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm about to write an app, which is going to do long running (~1 to
> ~60 minutes) calculations (meanwhile, the user who triggered the
> calculation will get message like "calculation in progress" or smth).
>
> I'm wondering what is the right place or best practice to do such
> calculations, custom middleware or view ?

Neither.

A view isn't really the right place to be performing long-lived
calculations. While the calculation is being performed, the user won't
have any feedback; on top of that, it will hold open a connection on
your webserver and lock out any other possible connections to the
webserver. It doesn't really matter where in the response chain the
calculation occurs (view, middleware, or otherwise) - the outcome will
be the same.

This isn't really a problem that can be solved with a single view. You
need to look at breaking up the problem a little bit:
1) The user visits a view that registers that a long lived job needs
to be performed and adds the job to a queue
2) A process that runs in the background, independent of the
webserver, processing jobs that have been queued
3) A view that can poll the queue to inspect the status of a given job
4) A view that shows the queue status to the user.

When the user visits view 1, the job is queued, and the user is
redirected to view 4. View 4 uses AJAX style requests to poll view 3
to provide status updates until the job has been completed. The main
work is done by task 2, which runs independent of the webserver. This
keeps all http connections short lived (which frees up web server
resources) and provides the ability for continuous feedback on job
progress.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Questions on packaging a project and naming conventions

2008-10-19 Thread James Bennett

On Sun, Oct 19, 2008 at 1:55 AM, Russell Keith-Magee
<[EMAIL PROTECTED]> wrote:
> However, it's important to note that this doesn't preclude the use of
> deeper namespaces - it just says that namespacing for an application
> shouldn't be tied to the project. One obvious way to satisfy this
> would be to create namespaces for the company, rather than the
> project. For example, if you work for WhizCorp, create a
> whizcorp.story application, and then create a whizcorp.foobar project
> that imports whizcorp.story.

(this is the part where James points out that the slides from the
"reusable Django apps" talks he's given include examples of doing
this)


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Questions on packaging a project and naming conventions

2008-10-19 Thread Russell Keith-Magee

On Sun, Oct 19, 2008 at 5:53 AM, Dana <[EMAIL PROTECTED]> wrote:
>
> Hello everyone,
>
> I am working on a CMS that includes a bunch of applications (like
> Story, Event, etc...) with some being propriatary and some being third
> party. When it comes to our naming conventions, we've had a bit of
> discussion over namespace issues. Now I have been referencing James
> Bennett's post on Projects (http://www.b-list.org/weblog/2007/nov/09/
> projects/) to make the argument that we should be putting our
> application directory under the Python path and then importing our
> apps like:
>
> from story.models import Story
>
> But the other side of the discussion is instead doing something like:
>
> from foobar.story.models import Story
>
> ... where foobar is our Python package name (the name of our CMS
> basically) so that we can avoid possible namespace issues.
>
> I have read the Python docs (http://www.python.org/doc/2.5.2/tut/
> node8.html#SECTION00840) about packages and it seems
> as though the recommended approach would be to do the second example
> (from foobar.story.models import Story) but from everything Im hearing
> in the Django community is that the one I propose (from story.models
> import Story) is the preferred method.

We need to make a distinction here about exactly what James (and the
Django community) is suggesting.

What James is advocating is that your application (in this case,
story) should exist and operate independent of your project (foobar).
This ensures that when your next project comes along that has a need
for stories, you can drop the story application into that project
without the untangle any foobar specific project-specific bindings.

The obvious way to do this (and the most immediate consequence of this
advice) is to say "don't include the project name in the namespace",
and use "from story.models import Story" in your code. That is, even
though Django puts applications under a project by default, that isn't
conceptually how your project should be organized. Conceptually, each
application should be free-standing, and your project should be
picking useful applications from the cloud and integrating them in
some meaningful way.

However, it's important to note that this doesn't preclude the use of
deeper namespaces - it just says that namespacing for an application
shouldn't be tied to the project. One obvious way to satisfy this
would be to create namespaces for the company, rather than the
project. For example, if you work for WhizCorp, create a
whizcorp.story application, and then create a whizcorp.foobar project
that imports whizcorp.story.

This isn't the only namespacing solution for this problem - I'm sure
you could come up with other options that may work better given your
local engineering environment and culture. The main point of James'
suggestion is that the story application (wherever it sits in the
namespace) should be constructed without any knowledge of the foobar
CMS.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---