Re: Accessing User Object From Template

2008-07-12 Thread Chris

On Jul 12, 11:30 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> Are you using RequestContext, not Context, as mentioned here:

Nope, thanks for the clarification. I guess I misinterpreted the
technicality note that says that's the default.

Chris
--~--~-~--~~~---~--~~
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: Left Outer Join

2008-07-12 Thread Kenneth Gonsalves


On 13-Jul-08, at 11:07 AM, Chris wrote:

> record along with the article in SQL, this would just be a simple left
> outer join. How would this be done with Django's ORM? I've reviewed
> http://www.djangoproject.com/documentation/model-api/#relationships
> but I don't think it covers this case.

use your own sql statement

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/code/




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Left Outer Join

2008-07-12 Thread Chris

I'm reasonably fluent in SQL, and while I've found Django's ORM is
great for basic CRUD operations, I'm having trouble creating joins.

For example, I have a three tables, Article, Rating, and User. Rating
stores a user's rating of a particular article. I'm trying to create a
view that lists articles, and optionally shows the current user's
rating of each article, if they've made one. To query the rating
record along with the article in SQL, this would just be a simple left
outer join. How would this be done with Django's ORM? I've reviewed
http://www.djangoproject.com/documentation/model-api/#relationships
but I don't think it covers this case.

Regards,
Chris
--~--~-~--~~~---~--~~
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: Root Access

2008-07-12 Thread Tim Johnson

Hi:
Just wanted to thank all of you for the responses.
Good data set!
"Not bad for two fingers"
cheers
tim

--~--~-~--~~~---~--~~
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: Accessing User Object From Template

2008-07-12 Thread Karen Tracey
On Sat, Jul 12, 2008 at 11:12 PM, Chris <[EMAIL PROTECTED]> wrote:

>
> According to http://www.djangoproject.com/documentation/authentication/
> each template should have access to the variable "user" by default.
> However, after I login, this variable doesn't seem to be defined. Is
> there any special configuration required to have access to this? The
> only weird thing I imagine I could be doing is using
> render_to_response in my view. Would that be blocking the context from
> being populated correctly?
>

Are you using RequestContext, not Context, as mentioned here:

http://www.djangoproject.com/documentation/authentication/#authentication-data-in-templates

?

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: Accessing User Object From Template

2008-07-12 Thread Peter Rowell

> The only weird thing I imagine I could be doing is using
> render_to_response in my view. Would that be blocking the context from
> being populated correctly?

Nothing weird about that. Try reading the following section:
http://www.djangoproject.com/documentation/templates_python/#subclassing-context-requestcontext

And in particular, read about django.core.context_processors.auth.
Then you can {{user}} to your heart's content.

HTH,
Peter
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Accessing User Object From Template

2008-07-12 Thread Chris

According to http://www.djangoproject.com/documentation/authentication/
each template should have access to the variable "user" by default.
However, after I login, this variable doesn't seem to be defined. Is
there any special configuration required to have access to this? The
only weird thing I imagine I could be doing is using
render_to_response in my view. Would that be blocking the context from
being populated correctly?
--~--~-~--~~~---~--~~
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: Root Access

2008-07-12 Thread Dan Ellis

The only thing you really /need/ root for is having some web server
process (usually Apache or lighttpd, for example) bind to port 80.
Everything else can be done without it. In fact, in any typical set
up, once port 80 has been bound to you're not running as root any more
anyway.

--~--~-~--~~~---~--~~
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: Root Access

2008-07-12 Thread Tim Johnson

On Saturday 12 July 2008, [EMAIL PROTECTED] wrote:
> I don't think that is true, the only time I needed root was when I was
> symlinking django into /usr/lib/python2.5/site-packages/ but since you
> can put it anywhere on your python path, you just need to symlink it
> somewhere that's on your path and doesn't require root, since you need
> a location like this to run any python software this doesn't seem like
> an issue to me.
 Understood. And if sysadmin doesn't want to set a symlink, one can
 programmatically alter sys.path . 
 thnx
 tim
<..snipped..>

--~--~-~--~~~---~--~~
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: Root Access

2008-07-12 Thread Kenneth Gonsalves


On 13-Jul-08, at 6:44 AM, [EMAIL PROTECTED] wrote:

> I don't think that is true, the only time I needed root was when I was
> symlinking django into /usr/lib/python2.5/site-packages/ but since you
> can put it anywhere on your python path, you just need to symlink it
> somewhere that's on your path and doesn't require root, since you need
> a location like this to run any python software this doesn't seem like
> an issue to me.

if you are using mod_python - configuring and restarting apache is an  
issue. Webfaction, for example, allows you to do this with shell  
access - otherwise root access is a must. I was once on a host where  
they restarted apache every 30 minutes. OK, but when you want to  
urgently change something in production, not very satisfactory.

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/code/




--~--~-~--~~~---~--~~
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: Root Access

2008-07-12 Thread Andrew Ingram

Tim,

It is possible to get django running without root access but you will 
need certain levels of permissions to do things like adding libraries to 
the python path, there are guides to installing Django on shared hosting 
environments like dreamhost where they don't give you root - though they 
do give you more access than the average shared host might.

My personal feelings are that if you're trying to do things properly 
you're going to want complete control over your server config and access 
to services like memcached. Whilst you can get Django running on a range 
of hosting solutions I can't see myself doing anything more than a 
simple blog without looking into a VPS or dedicated server with root access.

Regards,
Andrew Ingram

Tim Johnson wrote:
> I'm a long-time python web programmer. My company is interested in Django.
>
> I note from the following Amazon URL:
> http://www.amazon.com/gp/product/1590597257/ref=s9subs_c4_img2-rfc_p?pf_rd_m=ATVPDKIKX0DER_rd_s=center-2_rd_r=060JP6WRHSEJAMPJ51S2_rd_t=101_rd_p=278240301_rd_i=507846
> Caution: The URL above is very long and expect your email program to wrap it.
>
> The follow excerpt of a review says this:
> """
> .the fact that there's not really any good way to get Django running 
> smoothly without root access to the server-
> """
> I'd welcome comments on this opinion.
> Personally I deal with servers on three different levels:
> 1)I have root access
> 2)I have access to a sysadmin who is cooperative and helpful.
> 3)No root access, sysadmins don't install anything for me that
> needs root access.
>
> I'm not trolling nor do I wish to invite controversy, just some professional
> opinions. Or urls to discussions on the topic.
>
> Regards
> Tim Johnson

--~--~-~--~~~---~--~~
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: Root Access

2008-07-12 Thread [EMAIL PROTECTED]

I don't think that is true, the only time I needed root was when I was
symlinking django into /usr/lib/python2.5/site-packages/ but since you
can put it anywhere on your python path, you just need to symlink it
somewhere that's on your path and doesn't require root, since you need
a location like this to run any python software this doesn't seem like
an issue to me.

On Jul 12, 6:52 pm, Tim Johnson <[EMAIL PROTECTED]> wrote:
> I'm a long-time python web programmer. My company is interested in Django.
>
> I note from the following Amazon 
> URL:http://www.amazon.com/gp/product/1590597257/ref=s9subs_c4_img2-rfc_p?...
> Caution: The URL above is very long and expect your email program to wrap it.
>
> The follow excerpt of a review says this:
> """
> .the fact that there's not really any good way to get Django running
> smoothly without root access to the server-
> """
> I'd welcome comments on this opinion.
> Personally I deal with servers on three different levels:
> 1)I have root access
> 2)I have access to a sysadmin who is cooperative and helpful.
> 3)No root access, sysadmins don't install anything for me that
> needs root access.
>
> I'm not trolling nor do I wish to invite controversy, just some professional
> opinions. Or urls to discussions on the topic.
>
> Regards
> Tim Johnson
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Root Access

2008-07-12 Thread Tim Johnson

I'm a long-time python web programmer. My company is interested in Django.

I note from the following Amazon URL:
http://www.amazon.com/gp/product/1590597257/ref=s9subs_c4_img2-rfc_p?pf_rd_m=ATVPDKIKX0DER_rd_s=center-2_rd_r=060JP6WRHSEJAMPJ51S2_rd_t=101_rd_p=278240301_rd_i=507846
Caution: The URL above is very long and expect your email program to wrap it.

The follow excerpt of a review says this:
"""
.the fact that there's not really any good way to get Django running 
smoothly without root access to the server-
"""
I'd welcome comments on this opinion.
Personally I deal with servers on three different levels:
1)I have root access
2)I have access to a sysadmin who is cooperative and helpful.
3)No root access, sysadmins don't install anything for me that
needs root access.

I'm not trolling nor do I wish to invite controversy, just some professional
opinions. Or urls to discussions on the topic.

Regards
Tim Johnson

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



ANN: django-oauth, a generic OAuth provider implementation

2008-07-12 Thread David Larlet

Hello,

At mixin[0], we are both interested in Semantic Web and Django[1],  
that's why we decided to release a generic application which  
implements the provider part of the OAuth protocol[2].

The code and examples are available at my mercurial repository[3] and  
the documentation[4] (which correspond to tests) implements the  
example of the OAuth specification[5].

The consumer part is still a work in progress but we plan to release  
it too. Do not hesitate to send feedback and/or review of the code  
which is already in production at mixin.

Best regards,
David Larlet

PS: for French readers, a detailled explanation is available at my  
blog[6].

[0] http://www.mixin.com
[1] http://www.djangoproject.com
[2] http://oauth.net
[3] http://code.larlet.fr/django-oauth/
[4] http://code.larlet.fr/doc/django-oauth-provider.html
[5] http://oauth.net/core/1.0/#anchor25
[6] 
http://www.biologeek.com/django,web-semantique/decouvrons-oauth-avec-mixin-et-django-oauth/


--~--~-~--~~~---~--~~
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: Updating Database Schema

2008-07-12 Thread Chris

On Jul 12, 3:31 pm, Jeff Anderson <[EMAIL PROTECTED]> wrote:
> Chris wrote:
> > What's the best way to update database schema? If I add a column to a
> > table in my models.py and then run "manage.py syncdb", it doesn't add
> > the new column in the database.
>
> syncdb will never issue an alter statement-- this could be devastating
> on a production server with lots of data.
>
> You have a few options:
>
> * issue the alter table command yourself
> * drop the table altogether and run syncdb again
> * check out the django-evolution project on google code. I haven't used
> it, but it is designed to handle just this.
>
> Good Luck!
>
> Jeff Anderson

Thanks. I'm not sure how an add column statement would be devastating,
but I can easily imagine how drop statements could wreak havoc.

Chris
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problem retrieving objects

2008-07-12 Thread Benjamin Buch
I'm trying to find my way round the django 'basic apps' to get to know  
django a little better.
http://playgroundblues.com/posts/2007/dec/2/django-basic-apps/

Installation of basic/blog went all right, I could save posts to the  
database (sqlite in this case) through the admin.

But if I try to edit a post in the admin, django throws this error:

'post object with primary key u'1' does not exist'

I checked the database, but the post with id=1 is there.
I even can't get any posts in the shell:

 >>>Post.objects.all()
[]

-benjamin



--~--~-~--~~~---~--~~
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: Updating Database Schema

2008-07-12 Thread Jeff Anderson

Chris wrote:

What's the best way to update database schema? If I add a column to a
table in my models.py and then run "manage.py syncdb", it doesn't add
the new column in the database.
  
syncdb will never issue an alter statement-- this could be devastating 
on a production server with lots of data.


You have a few options:

* issue the alter table command yourself
* drop the table altogether and run syncdb again
* check out the django-evolution project on google code. I haven't used 
it, but it is designed to handle just this.


Good Luck!

Jeff Anderson



signature.asc
Description: OpenPGP digital signature


Updating Database Schema

2008-07-12 Thread Chris

What's the best way to update database schema? If I add a column to a
table in my models.py and then run "manage.py syncdb", it doesn't add
the new column in the database.
--~--~-~--~~~---~--~~
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: default value for filter in admin pages

2008-07-12 Thread xlty

implement FilterSpec class, you can got it

lee wrote:
> Guys,
>
> Is there a way of setting the default value for a filter in the admin
> site?
>
> Class Account(models.model):
> isClosed = models.BooleanField(blank=True)
> name = models.CharField(core=True, max_length=255,unique=True)
>
> class Admin:
>  list_filter = ['isClosed']
>
> On the admin page, I want the default value for the 'isClosed' field
> to be 'no', not 'All'.
>
> Thanks.
>
> - Lee.

--~--~-~--~~~---~--~~
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: Visualization of databases

2008-07-12 Thread Oscar Carlsson
There are a number of different toolkits that could do this for you, here
are three that looks usable:
http://code.google.com/apis/chart/
http://developer.yahoo.com/yui/charts/
http://matplotlib.sourceforge.net/

With (at least) matplotlib you could make your charts automatically in your
model, since they have python bindings.

Oscar

On Sat, Jul 12, 2008 at 7:28 PM, Xan <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> Is there any tool for visualizing database data? I mean for example,
> to build graphics like piechart, linechart, classification of database
> data in a frequency table (for example creating preaty diagrams like
> piwik [http://piwik.org/), or with R [http://www.r-project.org/], or
> gnuplot, )
>
> Thanks a lot,
> Xan.
>
> PS: I want to apply in activities done for my organization (typically
> I have a database of one class Action with the following fields:
> Title, Description, Type, DateofStart, DateofEnd, Location, ) and
> I want to classify and "draw" the actions by different type of fields)
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Visualization of databases

2008-07-12 Thread Xan

Hi,

Is there any tool for visualizing database data? I mean for example,
to build graphics like piechart, linechart, classification of database
data in a frequency table (for example creating preaty diagrams like
piwik [http://piwik.org/), or with R [http://www.r-project.org/], or
gnuplot, )

Thanks a lot,
Xan.

PS: I want to apply in activities done for my organization (typically
I have a database of one class Action with the following fields:
Title, Description, Type, DateofStart, DateofEnd, Location, ) and
I want to classify and "draw" the actions by different type of fields)
--~--~-~--~~~---~--~~
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: Autoupdate field?

2008-07-12 Thread Xan

Yes, but if mary is a Person and Smith is a Family, and mary belongs
to Smith Family (that is mary.family = Smith), how to change
mary.hometelephone if Smith.hometelephone change?

Thanks a lot,
Xan.

On Jul 6, 10:02 pm, Juanjo Conti <[EMAIL PROTECTED]> wrote:
> I you want your data to be normalized, telephone_home char(9) should not
> be an attribute of Person.
>
> If mary is a Person you always can do:
>
> mary.family.telephone_home to get her telephone_home.
>
> Juanjo
> --
> mi blog:http://www.juanjoconti.com.ar
--~--~-~--~~~---~--~~
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: USAepay cc payment processor

2008-07-12 Thread Chris Moffitt
I'm not familiar with this particular processor but on the surface it looks
like a similar process to what you would use for Authorize.net. You can see
how we use this particular processor in Satchmo -
http://www.satchmoproject.com/trac/browser/satchmo/trunk/satchmo/payment/modules/authorizenet

Line #82 in processor.py is where the post and response code happens.

Hopefully this helps you out.

-Chris

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



USAepay cc payment processor

2008-07-12 Thread Bobby Roberts

Hi group.  I'm now successfully dinging credit cards using https
posting over to USAepay.com.  It's working great.  I've got a question
though that i'm not sure how to handle and general guidance is greatly
appreciated.

I pass two parameters to them called UMredirAccept and UMredirDecline
for urls to redirect to on the appropriate response they send back to
me.

After talking with them, they will be using that url and posting back
data to me directly in the URL.

So I have some questions that I can't seem to figure out.

first let's look at the view i've built:

###
import urllib

def DoChargeCard (request):
  UMredirApproved = "http://www.mysite.com/paynow/approved.html;
#these are included in DataToSend
  UMredirDeclined = "http://www.mysite.com/paynow/declined.html;
#these are included in DataToSend

  DataToSend = urllib.urlencode({

[snip ]
})

  DataPacket = urllib.urlopen("http://www.somesite.com/
gate",DataToSend)

###

I've snipped the boring build for the data to pass but it's a simple
https post that sends data over to usaepay.com.

Here are a few things i'm running into:

first they will pass variables back with data in them to the url(s)
above.  As I understand it they will send the response back to:

http://www.mysite.com/paynow/approved.html?approvecode=xx=blah...

I'm having trouble figuring out how to rip those variables and values
out of the url in django/python.


secondly if you look in the view above... i don't do anything after I
post over to the website.  As a result i'm getting a traceback for
"didn't return an HttpResponse object".  The reason is i'm stuck and
have no idea what to do from this point on.

now my understanding is that the cc processor redirects to a URL we
provide so what http response would i put in there since they are (i
guess) controlling the browser after the post?

Secondly, how would i parse the results being appended to the url  as
described above.


Many thanks.

I'm very confused here.
--~--~-~--~~~---~--~~
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: Creating a Scheduled Task

2008-07-12 Thread Peter Rowell

> I can do
> this "outside" Django with Cron and a script that uses the standalone
> ORM, but is there any way to incorporate this into admin so I can see
> what tasks are run and when?

Well, you are probably still going to have cron (or equivalent) in
there somewhere because you need something that is clock-driven, as
opposed to client-request-driven.

If you want to do everything inside of Django, you could create a url/
view like '/myadmin/do/jobs/' and then have cron periodically trigger
a wget on that url. Note: if you are doing some sort of big, honking,
run-for-a-long-time job, doing so inside the context of a web server
may not be the best choice.

Another alternative is to do most of your work in standalone scripts,
but have a periodic cron job trigger a wget which causes Django to
rewrite a cron file of scheduled jobs.


--~--~-~--~~~---~--~~
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: Creating a Scheduled Task

2008-07-12 Thread John M

I've seen previous posts which tell you to setup the CRON job with the
correct settings, so you can just call django from the CRON job, since
django is just python, as long as it finds the settings file you
should be ok.

J

On Jul 12, 7:53 am, Chris <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm a newbie to Django, and I'm trying to find the best way to create
> a recurring scheduled task. I'd like to run a script that periodically
> downloads an RSS feed and updates records in the database. I can do
> this "outside" Django with Cron and a script that uses the standalone
> ORM, but is there any way to incorporate this into admin so I can see
> what tasks are run and when?
>
> Thanks,
> Chris
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



modify select widget

2008-07-12 Thread Nenillo

Hi,

I'm doing an app with a category model. That category model has an
autoreference field, to do multiple category levels.  I'm using
models.ForeignKey('self',
null=True, blank=True) for that. The problem is that the select is
shown in a plain way and I wan to do something like:

Cat1
- Subcat1-1
- Subcat1-2
Cat2
- Subcat2-1

Is there any easy way to do that? O are hint on how to do it?

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: encoding and escaping of form values

2008-07-12 Thread commander_coder

Thank you *very* much.

> What happens when you try it? Your computer won't catch on fire when you
> make a mistake, so experimentation is a good way to learn. :-)
I left out a lot of fumblings, including these ones.  I find that when
I'm beginning trying to understand a system with lots of parts them I
can't understand from what I'm looking at even what is relevant to my
question.  That is, it's the "Hello world" problem where until you
have something then you can't move on to the next.

Thanks again.
--~--~-~--~~~---~--~~
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: Automatic Image Resizing upon Upload

2008-07-12 Thread TheBoff

I've actually realised I've been an idiot: seen as models are
subclasses of models.Model, I should be able to just call
model.Model.save() from within the custom save method! And my other
idea wouldn't work if the image were changed.

On Jul 12, 12:37 pm, TheBoff <[EMAIL PROTECTED]> wrote:
> Wow: thanks for all the replies guys!
>
> Photologue is perhaps a bit heavyweight for my current purposes,
> although it looks like an extremely impressive bit of kit, and were I
> to make a dedicated photo gallery etc app with django, I would
> certainly use it.
>
> Embedding something in the save method seems like a very good idea: I
> can't work out how to do it without breaking the current save
> functionality in the model, so I think I'll probably do it as a new
> classes style property: no setter, because it's automatic, but the
> getter will try and load the image from a file, and if that fails
> create the file using PIL functionality.
>
> Colin
>
> On Jul 11, 8:39 pm, blis102 <[EMAIL PROTECTED]> wrote:
>
> > You could also use django-photologue. Its quite powerful and very
> > useful in templates:
>
> >http://code.google.com/p/django-photologue/
>
> > Cheers,
> > Dana
>
> > On Jul 11, 12:47 am, "Ben Ford" <[EMAIL PROTECTED]> wrote:
>
> > > Or you could have a look at google appengine for your image storage. They
> > > have an picassa like API that would allow you to do lots of stuff to your
> > > images on the fly and you wouldn't pay for any of the processor cost (or
> > > storage if you're under 500M). Just a thought.
> > > Ben
>
> > > 2008/7/11 Eric Abrahamsen <[EMAIL PROTECTED]>:
>
> > > > It's intensive, but not prohibitively so. I've used a few setups where
> > > > large image files were uploaded and, depending on the options, two or
> > > > even three different versions of the image are created in the save()
> > > > method. The server has yet to explode. Try poking through some of
> > > > these snippets and see if anything appeals to you:
>
> > > >http://www.djangosnippets.org/tags/thumbnail/
>
> > > > Eric
>
> > > > On Jul 11, 2008, at 3:53 AM, TheBoff wrote:
>
> > > > > To jump straight in to the question:
>
> > > > > I'm wrinting a website using the automatic admin interface, and am
> > > > > wondering if there's any way to create a thumbnail automatically upon
> > > > > the upload of the image.
>
> > > > > I know I could set it as a property, and use PIL to do it on the fly
> > > > > (well I assume I could, I haven't checked it in any detail!), but
> > > > > wouldn't that be hugely processor intensive?
>
> > > --
> > > Regards,
> > > Ben Ford
> > > [EMAIL PROTECTED]
> > > +447792598685
--~--~-~--~~~---~--~~
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: determining model subclass

2008-07-12 Thread Andre Meyer
hi Dave

finally, i have tried what you suggested. indeed, this is what is described
here.
and it works!

thanks a lot!
cheers
André


On Tue, Jul 8, 2008 at 3:13 PM, Chester <[EMAIL PROTECTED]> wrote:

>
> André,
> I'm assuming that you are using the Trunk version of Django because
> subclassing isn't supported in previous versions.
>
> Assuming that.
>
> You can either have Item be an Abstract class which does not act like
> a table but just a parent class containing common items. (this is not
> what you are trying...)
>
> Or
>
> Each sub class is a seperate model from Item (assuming this is what
> you want).   From the documentation you should be able to do the
> following:
>
> items = Item.objects.all()
> for item in items:
>  try:
>x = Item.task
>type = "Task"
>  except:
>try:
>   x = Item.event
>   type = "Event"
>except:
>   type = "Item"
>  Do something pertaining to the item type
>
>
> I haven't tried this but according to the docs it should work You
> should also fill in the correct exception.  I just don't know what it
> is.
>
> Hope it helps.
>
> Dave.
>
>
>
>
>
>
> On Jul 8, 2:12 am, "Andre Meyer" <[EMAIL PROTECTED]> wrote:
> > hi all
> >
> > is it possible to determine the subclass of a model instance?
> >
> > what i mean is this:
> > if you have a (n abstract) model class and two subclasses, like
> >
> > class Item(models.Model):
> > pass
> >
> > class Task(Item):
> > pass
> >
> > class Event(Item):
> > pass
> >
> > and you retrieve
> >
> > items = Item.objects.all()
> >
> > how can you know whether the items are either tasks or events?
> >
> > items[0].__class__ returns just .
> >
> > thanks for sharing your insights
> > regards
> > André
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---