Re: How to pass a variable as parameter to a tag

2006-02-14 Thread limodou

On 2/15/06, Ian Holsman <[EMAIL PROTECTED]> wrote:
>
> doesn't something like:
> class TopTagsNodeUser(template.Node):
> """ what is the root of this application """
> def render(self, context):
> user = context.get('user', None)
> if user.is_anonymous():
> return ""
> return "User 
> Prefs"+str(user)+"
> "
>
> work?
>

I think it can work. But this appoach skips parameter.

I'll use it for now. Thanks.

--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit


Re: How to pass a variable as parameter to a tag

2006-02-14 Thread Ian Holsman

doesn't something like:
class TopTagsNodeUser(template.Node):
""" what is the root of this application """
def render(self, context):
user = context.get('user', None)
if user.is_anonymous():
return ""
return "User Prefs"+str(user)+"
"

work?

On 2/15/06, limodou <[EMAIL PROTECTED]> wrote:
>
> Say I have a tag, it could take some parameter, just like:
>
> {% calendar 2006 2 %}
>
> But in above code, the parameter is a fixed value. But if I have a
> year and a month variable, and I want to pass them to calender tag, so
> how to deal with that. It seems that:
>
> {% calendar year month %}
>
> can not work.
>
> --
> I like python!
> My Blog: http://www.donews.net/limodou
> NewEdit Maillist: http://groups.google.com/group/NewEdit
>


--
[EMAIL PROTECTED] -- blog: http://feh.holsman.net/ -- PH: ++61-3-9877-0909

If everything seems under control, you're not going fast enough. -
Mario Andretti


How to pass a variable as parameter to a tag

2006-02-14 Thread limodou

Say I have a tag, it could take some parameter, just like:

{% calendar 2006 2 %}

But in above code, the parameter is a fixed value. But if I have a
year and a month variable, and I want to pass them to calender tag, so
how to deal with that. It seems that:

{% calendar year month %}

can not work.

--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit


Re: Request for ideas

2006-02-14 Thread tonemcd

Authentication.

There's some documentation, and it's pretty good. Having more won't
hurt though and will definitely help the people considering migrating
to django with their decisions. I'd suggest external (ie different to
the settings.py 'django' database) MySQL/Postgres databases, LDAP and
(if you feel up to it!) Shibboleth.

Cheers,
Tone



Re: Request for ideas

2006-02-14 Thread Malcolm Tredinnick

Kenneth Gonsalves wrote:
> On Wednesday 15 Feb 2006 9:08 am, Malcolm Tredinnick wrote:
> > do something useful here. I thought it would be nice to take a
> > couple of project ideas and produce some tutorial-like documents
> > describing how to implement them in Django from start to (more or
> > less) finish.
>
> do workflow - nothing published yet, and a *lot* of people are
> salivating for something like this

That is the idea: having a look at the motivation (at least, _my_
thinking, if not anybody elses) behind the implementation ideas, not
just the results. Reams of code with no takeaway value is not really
interesting to me as a reader either.

Malcolm



Re: admin on "/" unable to find media

2006-02-14 Thread limodou

On 2/15/06, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
>
> On Wednesday 15 Feb 2006 9:21 am, limodou wrote:
> > If you are using the lastest svn, why your output is not the same
> > as me?
>
> no idea
> >
> > Does you use apache?
>
> yes
>

Oops, maybe you should change httpd.conf just like these:

Alias /media
C:/Python24/Lib/site-packages/Django-0.91-py2.4.egg/django/contrib/admin/media

SetHandler None


If the DEBUG option in settings.py is set to False, static files will
be servered by web server, and will not come from django server again.

You should read http://www.djangoproject.com/documentation/modpython/
for more details.
--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit


Re: Request for ideas

2006-02-14 Thread Kenneth Gonsalves

On Wednesday 15 Feb 2006 9:08 am, Malcolm Tredinnick wrote:
> do something useful here. I thought it would be nice to take a
> couple of project ideas and produce some tutorial-like documents
> describing how to implement them in Django from start to (more or
> less) finish.

do workflow - nothing published yet, and a *lot* of people are 
salivating for something like this

-- 
regards
kg

http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!


Re: admin on "/" unable to find media

2006-02-14 Thread Kenneth Gonsalves

On Wednesday 15 Feb 2006 9:21 am, limodou wrote:
> If you are using the lastest svn, why your output is not the same
> as me?

no idea
>
> Does you use apache?

yes

-- 
regards
kg

http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!


Re: admin on "/" unable to find media

2006-02-14 Thread limodou

On 2/15/06, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
>
> On Wednesday 15 Feb 2006 8:36 am, limodou wrote:
> > > > > (r'^admin/', include('django.contrib.admin.urls.admin')),
> > > >
> > > > Which version do you use? It seems that the syntax is for
> > > > 0.91. If you are using 0.92, the above should be:
> > > >
> > > > (r'^admin/', include('django.contrib.admin.urls')),
> > >
> > > am using latest svn
> >
> > So you should change the urls.py just like what I shown you
> > above. And try again.
>
> what i put was automatically generated by startproject. If i use
> your pattern - i dont even get admin. My only problem is getting
> the css as admin works with my url
>

Oh, I'm sorry for my wrong reply. But my project urls.py is :

from django.conf.urls.defaults import *

urlpatterns = patterns('',
# Example:
# (r'^/', include('.apps.foo.urls.foo')),

# Uncomment this for admin:
# (r'^admin/', include('django.contrib.admin.urls')),
)

If you are using the lastest svn, why your output is not the same as me?

Does you use apache?

--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit


Re: admin on "/" unable to find media

2006-02-14 Thread Kenneth Gonsalves

On Wednesday 15 Feb 2006 8:36 am, limodou wrote:
> > > > (r'^admin/', include('django.contrib.admin.urls.admin')),
> > >
> > > Which version do you use? It seems that the syntax is for
> > > 0.91. If you are using 0.92, the above should be:
> > >
> > > (r'^admin/', include('django.contrib.admin.urls')),
> >
> > am using latest svn
>
> So you should change the urls.py just like what I shown you
> above. And try again.

what i put was automatically generated by startproject. If i use 
your pattern - i dont even get admin. My only problem is getting 
the css as admin works with my url

-- 
regards
kg

http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!


Request for ideas

2006-02-14 Thread Malcolm Tredinnick

Having been tooling around with Django for some months now, primarily
on little projects for my own use, I wanted to write up some of the
things I've learnt. I actually like doing documentation, so I want to
do something useful here. I thought it would be nice to take a couple
of project ideas and produce some tutorial-like documents describing
how to implement them in Django from start to (more or less) finish.
The goal is to avoid comments like this (from the early days of Ruby on
Rails):

"If you don't want to make a to do list, create a recipe manager or
build an online bookstore then there isn't much out there for you.
Basically, ruby on rails seems to be mostly used as a toy language and
every time that I attempt to look online for a description of how to
set up something I get redirected to one of these simplistic tutorials.
There is only so many times that I can read over what is essentially a
'hello world' app before I get frustrated."
(from http://alice.nodelman.net/?p=4)

Since it turns out I am pretty lame at generating interesting ideas, I
would like to canvas the community for some project ideas to cover. The
couple that I have so far are:

 - A reimplementation of the Planet aggregators
(www.planetplanet.org)

 - A front-end to a distributed tinder-box setup. Reporting build
results that are either pulled from other locations or posted to the
server.

As you can see, neither of these are particularly large scale -- I
don't want to write 1000 pages for one project. I am also avoiding (a)
a blog implementation (done by other people), (b) a comments /
noticeboard (done already), (c) a newspaper-like site (already the
topic of the tutorial shipped with Django).

So what would you like to see? Nothing is too silly to suggest[1]. I'm
not going to promise to take every idea, but whatever I do write will
be put up for free use on the web.

Thanks,
Malcolm

[1] "...except for women's Ice Hockey", if you are a Sports Night fan.



Re: Dreamhost, Django and MySQL server connection

2006-02-14 Thread Eugene Lazutkin


kmh wrote:

Edgars Jekabsons wrote:

OK, posted a patch agaist trunk (revision 2307)
http://code.djangoproject.com/attachment/ticket/463/mysql_rev2307.diff

--
Edgars


Hey thanks Edgars,

I'll run it for a while and post encouragement to the ticket if I have
no problems.

Kieran


Let me know how it goes. If there is a problem, I'll make my patch. I 
use it for a long time now without problems.


Thanks,

Eugene



Re: admin on "/" unable to find media

2006-02-14 Thread limodou

On 2/15/06, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
>
> On Wednesday 15 Feb 2006 8:11 am, limodou wrote:
> > > (r'^admin/', include('django.contrib.admin.urls.admin')),
> >
> > Which version do you use? It seems that the syntax is for 0.91.
> > If you are using 0.92, the above should be:
> >
> > (r'^admin/', include('django.contrib.admin.urls')),
>
> am using latest svn
>

So you should change the urls.py just like what I shown you above. And
try again.

--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit


Re: Dynamic choices

2006-02-14 Thread Chetan Vaity
Thanks Amit and Adrian,I think I'll do something like what Amit said or write a custom manipulator.- ChetanOn 2/8/06, Adrian Holovaty <
[EMAIL PROTECTED]> wrote:On 2/8/06, Amit Upadhyay <
[EMAIL PROTECTED]> wrote:> > What I notice is that whenever an entry is added to LDAP, it is not> reflected in the SelectField drop-down on the create form for the model. But
> if I simply restart the Apache httpd server, the drop-down is correctly> populated.> >> > Can someone tell me why this is so?>> This is so because getLocationChoices() is calculated when model is being
> created. To solve your problem you can do the following:You could do what Amit suggested, but I would suggest creating aseparate Location model  to avoid this problem entirely. The "choices"
parameter is intended for a finite list of choices that never change.When you're dealing with data that needs to be dynamic, use thedatabase.Adrian--Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org


Re: admin on "/" unable to find media

2006-02-14 Thread Kenneth Gonsalves

On Wednesday 15 Feb 2006 8:11 am, limodou wrote:
> > (r'^admin/', include('django.contrib.admin.urls.admin')),
>
> Which version do you use? It seems that the syntax is for 0.91.
> If you are using 0.92, the above should be:
>
>      (r'^admin/', include('django.contrib.admin.urls')),

am using latest svn

-- 
regards
kg

http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!


Re: admin on "/" unable to find media

2006-02-14 Thread limodou

On 2/15/06, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
>
> On Tuesday 14 Feb 2006 6:37 pm, coulix wrote:
> > can i see your url.py, cause i had to take off the leading '^' to
> > be able to recognize the admin part
> > at /mysite/admin.
>
> (r'^admin/', include('django.contrib.admin.urls.admin')),
>

Which version do you use? It seems that the syntax is for 0.91. If you
are using 0.92, the above should be:

 (r'^admin/', include('django.contrib.admin.urls')),


--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit


Re: recommended javascript books/tutorials/howtos?

2006-02-14 Thread Kenneth Gonsalves

On Tuesday 14 Feb 2006 9:45 pm, James Bennett wrote:
> And don't let the 2001 publication date fool you; this book is
> still very relevant.
+1

-- 
regards
kg

http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!


Re: admin on "/" unable to find media

2006-02-14 Thread Kenneth Gonsalves

On Tuesday 14 Feb 2006 6:37 pm, coulix wrote:
> can i see your url.py, cause i had to take off the leading '^' to
> be able to recognize the admin part
> at /mysite/admin.

(r'^admin/', include('django.contrib.admin.urls.admin')),

-- 
regards
kg

http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!


Re: Dreamhost, Django and MySQL server connection

2006-02-14 Thread [EMAIL PROTECTED]

I was also experiencing sql disconnect errors with Dreamhost.  I have
just updated my site http://www.socialistsoftware.com/ to use this
patch.

We will see how it goes.



TZ Interactions

2006-02-14 Thread Max Battcher


As part of a personal side project I'm taking information from an 
external command (a source control system) and marshalling its 
information into django model classes.


I hit a small stumbling block and was curious if anyone had any 
particular experience.


I'm using Windows for my development environment (yeah, I know), and 
without a TZ setting the external app is returning, in one of its 
fields, the timezone "Eastern Standard Time", which it is pulling from 
Windows.  Django is setting the TZ setting to the one in my settings.py 
file "America/Louisville".  It appears that the application can't make 
out how to exactly convert that in a Windows environment and is 
returning for the time-zone "Ame", which Python is then in turn not 
interpreting as a valid time-zone.


Is there any way in Django itself to convert this, perhaps?  Do I need 
to just move the uglier ("EST5EDT...") syntax?  Is there any "best 
practice" in this situation that works well cross-platform?


--
--Max Battcher--
http://www.worldmaker.net/


Raw SQL to Django API Question and a ManyToMany Model Question

2006-02-14 Thread Brett Hoerner

Working on a last-minute mapping app for PyCon here, I'm currently
using a raw SQL query to SELECT information from People (Model) who all
share the same Tag (Model in a ManyToMany with People).  I'm feeding
the query a range of lat/lon and the tag I want,

c = db.cursor()
c.execute("""select p.id, p.name, p.lat, p.lon from maps_people as
p
left join maps_tags_person as pt on pt.person_id = p.id
left join maps_tags as t on t.id = pt.tag_id
where t.tag = '%s'
and p.lat >= %s
and p.lon >= %s
and p.lat <= %s
and p.lon <= %s
order by p.id""" % (request_tag, minlat, minlon, maxlat,
maxlon))
r = c.fetchall()
c.close()

I'd just like to figure out the Django API equivalent (if there is one)
to do something like this.

I was thinking, like, people.get_list(lat__gte=minlat, lon__gte=minlon,
lat__lte=maxlat, lon__lte=maxlon, has__tag=tag) or whatever... ideas?

---

Second question,

What is a good method of keeping a count of ManyToMany relationships
that each entry in the table has?  In the example above, I added a
meta.IntegerField to the Tag Model, and I want it to hold the # of
people that have that tag.  I don't want to calculate this as-needed
(way to often, if I use it)...  I can't really import the model IN the
model, can I?  (I tried, and then my brain exploded)

My original thought was to just add a _pre_save that updated with the
count everytime a Tag was saved (Tags aren't really edited, so pretty
much ALL saves affect the number of relationships) ... but I wasn't
sure what a "best practice" method of this was.

---

Thanks,
Brett



Re: Dreamhost, Django and MySQL server connection

2006-02-14 Thread kmh

Edgars Jekabsons wrote:
> OK, posted a patch agaist trunk (revision 2307)
> http://code.djangoproject.com/attachment/ticket/463/mysql_rev2307.diff
>
> --
> Edgars

Hey thanks Edgars,

I'll run it for a while and post encouragement to the ticket if I have
no problems.

Kieran



Re: Dreamhost, Django and MySQL server connection

2006-02-14 Thread Edgars Jekabsons

OK, posted a patch agaist trunk (revision 2307)
http://code.djangoproject.com/attachment/ticket/463/mysql_rev2307.diff

--
Edgars



Re: more model basics - mny to many's

2006-02-14 Thread gizo

ah, looks clever, i like that.
I'll check it when i get into work.
thanks...



Re: Dreamhost, Django and MySQL server connection

2006-02-14 Thread kmh

Edgars Jekabsons wrote:
> Hi Kieran,
>
> I posted a working patch against Django release 0.91 on the same ticket
> http://code.djangoproject.com/ticket/463

Thanks Edgars,

Unfortunately your patch can't get committed as-is either because it is
against 0.91 and there have been a few changes since then. The Django
devs are much wiser than to use MySQL ;) so it really needs to work
with the latest version of trunk in svn to stand a chance.

Anyone running a patch against svn?

Cheers,
Kieran



Re: Class Methods in Model?

2006-02-14 Thread Roberto Aguilar

Awesome, works great.  Thanks for the help, guys!

-berto.

On 2/14/06, James Bennett <[EMAIL PROTECTED]> wrote:
>
> On 2/14/06, Eric Walstad <[EMAIL PROTECTED]> wrote:
> > Hey Berto,
> >
> > 
>
> And magic-removal, as far as I understand it, will do away with the
> need for that. Hooray!
>
> --
> "May the forces of evil become confused on the way to your house."
>   -- George Carlin
>


Re: Class Methods in Model?

2006-02-14 Thread James Bennett

On 2/14/06, Eric Walstad <[EMAIL PROTECTED]> wrote:
> Hey Berto,
>
> 

And magic-removal, as far as I understand it, will do away with the
need for that. Hooray!

--
"May the forces of evil become confused on the way to your house."
  -- George Carlin


Re: Class Methods in Model?

2006-02-14 Thread Eric Walstad

On Tuesday 14 February 2006 10:23, Roberto Aguilar wrote:
> Hello,
>
> I have a model called Invitation that I would like to have a method
> called make_rsvp_code.  In the model I define it as such:
>
> class Invitation(meta.Model):
> [...]
>
> def make_rsvp_code(self, invitation):
> [...]
> make_rsvp_code = classmethod(make_rsvp_code)
>
> The reason I pass in an invitation is because the RSVP code is based
> on some other fields within the  invitation object.
>
> When I run:
>
> invitations.make_rsvp_code(invitation)
>
> I get this error:
>
> AssertionError: 'make_rsvp_code' is an invalid model parameter.
>
> Is it possible to give a class classmethods in django?
>
> Thanks!
> -berto.

Hey Berto,



Eric.


Class Methods in Model?

2006-02-14 Thread Roberto Aguilar

Hello,

I have a model called Invitation that I would like to have a method
called make_rsvp_code.  In the model I define it as such:

class Invitation(meta.Model):
[...]

def make_rsvp_code(self, invitation):
[...]
make_rsvp_code = classmethod(make_rsvp_code)

The reason I pass in an invitation is because the RSVP code is based
on some other fields within the  invitation object.

When I run:

invitations.make_rsvp_code(invitation)

I get this error:

AssertionError: 'make_rsvp_code' is an invalid model parameter.

Is it possible to give a class classmethods in django?

Thanks!
-berto.


Re: How to customize display of radio-button group?

2006-02-14 Thread Waylan Limberg

On 2/14/06, Leeuw van der, Tim <[EMAIL PROTECTED]> wrote:
>
>
>
> I have a field in my model that is entered, in a form, using a group of
> radio-buttons. However, I don't like the display of those radio-buttons: I
> want them side by side, rather than as a bulleted-list below each other.
>
>
>
> Is that possible? How would I achieve that? (Except for custom-coding the
> html for that bit of the form)
>
Without recoding the html being output, you could create some css to
make the list inline. A quick web search should bring up many good
suggestions on how to do that. I seem to recall a good article on
styling lists over at alistapart a few year back. Maybe start there.


--

Waylan Limberg
[EMAIL PROTECTED]


Customizing limit_choices_to

2006-02-14 Thread Jakub Labath

Hi,

class Category(meta.Model):
name = meta.CharField(maxlength=255)

class Article(meta.Model):
   title = meta.CharField(maxlength=255)
   category = meta.ForeignKey(Category)

class Pillar(meta.Model):
name = meta.CharField(maxlength=255)
categories =
meta.ManyToManyField(Category,blank=True,filter_interface=meta.HORIZONTAL)
articles = 
meta.ManyToManyField(Article,blank=True,filter_interface=meta.HORIZONTAL,limit_choices_to
= {'category__id__in':[1,2,3]})
class META:
admin = meta.Admin()
def __repr__(self):
return self.name

This works great I'm just wondering if there is a way to change the
value of 'limit_choices_to' after the object has been created e.g.
1. user chooses certain categories and saves the pillar
2. user edits the pillar again and the list of articles contains only
articles for the categories selected in that pillar?

I know I can change the value of
p = Pillar(...)
p._meta.many_to_many[1].rel.limit_choices_to = {blah:blah}
at run-time I'm just wondering if there is a way to do it right after
the object has been created.
perhaps some kind of post __init__ hook or something.

Am I making any sense?

Thanks for help


Re: more model basics - mny to many's

2006-02-14 Thread Jacob Kaplan-Moss


On Feb 14, 2006, at 9:55 AM, gizo wrote:

Each Song can have Many Player/Instrument combinations (where each
musician could play any instrument, in theory)


Give this a shot::

class Musician(meta.Model):
...

class Instrument(meta.Model):
...

class Band(meta.Model):
...

class BandMember(meta.Model):
band = meta.ForeignKey(Band, edit_inline=meta.STACKED)
musician = meta.ForeignKey(Musician)
instruments = meta.ManyToManyField(Instrument)

(Something pretty similar to this is what we use for the band  
database on lawrence.com, and it works well).


Jacob


Re: recommended javascript books/tutorials/howtos?

2006-02-14 Thread James Bennett

On 2/14/06, Steven Armstrong <[EMAIL PROTECTED]> wrote:
> I'ld have a look at "JavaScript - The Definitive Guide" by David
> Flanagan [1].

Seconded. Reading this book will make you understand JavaScript on a
deep level, and then doing web stuff with JavaScript just becomes a
matter of learning the DOM API, which is documented in the book and
online.

And don't let the 2001 publication date fool you; this book is still
very relevant.

--
"May the forces of evil become confused on the way to your house."
  -- George Carlin


Re: more model basics - mny to many's

2006-02-14 Thread gizo

wont that just give me:
Each Song can have many Instruemtns
Each Song can have many Musicians?

what I want is:
Each Song can have Many Player/Instrument combinations (where each
musician could play any instrument, in theory)



Re: recommended javascript books/tutorials/howtos?

2006-02-14 Thread Jeremy Dunck

On 2/14/06, Gábor Farkas <[EMAIL PROTECTED]> wrote:
> i'd like to increase/enhance my javascript knowledge, which right now is
>   rather limited (zero?) :)

Aside from the usual book recommendations, I suggest you go get dojo.

That's the largest body of well-written javascript I've ever seen. 
Read that code and ask questions on the mailing list.

http://dojotoolkit.org/


ANN: Django hosting available at Python-Hosting.com

2006-02-14 Thread Remi

Hello everyone,

I'm happy to announce that Python-Hosting.com now supports Django.

We've been hosting Django sites for a while but we've now added
it to our official list of supported software.

You can host 5 Django sites with up to 10 MySql or PostgreSql databases
for $15/month.

When you signup you get a default running Django site using the latest
Django version and a blank Django project. The Django python module is
installed in your HOME directory so you can change the version if you
want to.

Your Django site runs on top of mod_python. You actually get your own
Apache2 instance with mod_python, which you have total control over
(for instance, you can start it and stop it on your own).

Remi.

http://www.python-hosting.com



Re: Dreamhost, Django and MySQL server connection

2006-02-14 Thread Jeremy Jones

On Mon, 13 Feb 2006 11:12:27 -0800
"Edgars Jekabsons" <[EMAIL PROTECTED]> wrote:

> 
> Does anyone else who uses Dreamhost has problems with MySQL connection
> going away?
> 
> The project I suggested hosting there is not even inproduction yet,
> but we get MySQL server errorsa lot (a few times a day).
> Sometimes it's just Django error 500, but other times I get a Python
> traceback screen.
> 
> Is it just plain unlucky me and an unreliable MySQL server on
> Dreamhost or I should have used something more robust than the setup
> described in http://wiki.dreamhost.com/index.php/Django?
> 
> TIA,
> Edgars
> 

I seemed to have a problem with a test environment I setup.  But my
"main production" environment is doing better.  I don't think it would
hurt anything to replicate your current database on a new DB which
you setup in the Dreamhost panel.

I wrote a little ping script which requests a URL in my app which
triggers a simple database lookup.  I run the script on a cron job every
5 minutes on a server on my LAN at home.  Over the past 8 days, it's
only reported back 4 errors. After I got the sense to store the
resulting error pages, it looks like one is a 500 error (which feels
like a database problem) and one is a a URL lookup failure.  The latter
is a little weird.  I'll try to beef up the error trapping and
reporting when I get a chance.  

One of the reasons I did this, though, was on Dreamhost my app is
running under fastcgi.  Since it's a low-traffic site, the response
time for a new request after no requests have happened in a while is
miserable.  So, this script keeps the site alive and hopefully provides
users with a little better experience and provides information for when
the site was having problems.  Anyway, that's not exactly what you were
asking, but I hope it's helpful nonetheless.

- jmj


Re: admin on "/" unable to find media

2006-02-14 Thread coulix

can i see your url.py, cause i had to take off the leading '^' to be
able to recognize the admin part
at /mysite/admin.



Re: recommended javascript books/tutorials/howtos?

2006-02-14 Thread Jiri Barton

The javascript language itself (plus browser javascript interface -
this is rather messy IMHO):

http://wp.netscape.com/eng/mozilla/3.0/handbook/javascript/

I have found the following reference very valuable. It describes the
MSIE web browser javascript interface. Surprisingly, it is from
Microsoft (surprisingly, the documentation is useful). Of course, skip
the non-W3C parts (they are well marked in the documentation).

http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

HTH,
jbar



Re: recommended javascript books/tutorials/howtos?

2006-02-14 Thread Steven Armstrong


On 02/14/06 11:07, Gábor Farkas wrote:

hi,

i'd like to increase/enhance my javascript knowledge, which right now is 
  rather limited (zero?) :)


so, are there are books/websites you can recommend?

i'm primarily interested in the application of javascript to the 
webpages, so DOM manipulation and things like that.


of course i am also interested in learning about the object-model of 
javascript and things like that, but what i'm lacking right now is the 
knowledge about the javascript-webpage interaction.


thanks,
gabor



I'ld have a look at "JavaScript - The Definitive Guide" by David 
Flanagan [1].


An in dept overview of the language and at the same time a complete 
reference.


In my JS-learning-days I always had it with me, used it daily.

cheers
Steven

[1] http://www.oreilly.com/catalog/jscript4/


admin on "/" unable to find media

2006-02-14 Thread Kenneth Gonsalves

hi,
so far, using mod_python, i have my location as "/mysite/" and my 
admin mounted as:
http://mydomain.com/mysite/admin/
no problems
I tried location as "/" and admin mounted as:
http://mydomain.com/admin/
admin comes up - but css is not found. On looking at the page source 
of both it gives:
"/media/css/base.css/" in both examples, but in the second example i 
get a 404 in the logs saying css not found. How to solve this?
-- 
regards
kg

http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!


recommended javascript books/tutorials/howtos?

2006-02-14 Thread Gábor Farkas


hi,

i'd like to increase/enhance my javascript knowledge, which right now is 
 rather limited (zero?) :)


so, are there are books/websites you can recommend?

i'm primarily interested in the application of javascript to the 
webpages, so DOM manipulation and things like that.


of course i am also interested in learning about the object-model of 
javascript and things like that, but what i'm lacking right now is the 
knowledge about the javascript-webpage interaction.


thanks,
gabor


Re: Version 1.0 Features

2006-02-14 Thread Jeroen Ruigrok van der Werven
Have you checked:

http://code.djangoproject.com/wiki/VersionOneFeatures


Re: more model basics - mny to many's

2006-02-14 Thread patrick k

what do you need the table songInstrument for?
i´d suggest using a many-to-many relationship ... see
http://www.djangoproject.com/documentation/model_api/#many-to-many-relations
hips

class song(meta.Model):
title = ...
duration = ...
instrument = meta.ManyToManyField(instrument)
musician = meta.ManyToManyField(musician)
def __repr__(self):
  return self.title()
class META:
  admin = meta.Admin()

patrick


> 
> Hiya.
> I am not a web developer, okay, just trying to do a band website (so
> take it easy on me, please ;)
> I am having trouble with my models.
> 
> I have the following:
> 
> class musician(meta.Model):
> ...
> class instrument(meta.Model):
> ...
> class song(meta.Model):
> ..
> class songInstrument(meta.Model):
> song = meta.ForeignKey(song, edit_inline=meta.TABULAR, core=True)
> instrument = meta.ForeignKey(instrument)
> musician = meta.ForeignKey(musician)
> def __repr__(self):
>   return "%s, %s, %s" % (self.get_song(), self.get_musician(),
> self.get_instrument())
> class META:
>   admin = meta.Admin()
> 
> So each song has many musicians playing many instruments (ie. Jerry
> might have played drums and bass and read Chaucer in a particular
> song). This is great, and when I add a song in the admin section, I can
> add all this detail, but when I look at songInstrument in admin, there
> are no entries??
> 
> Can anyone tell me:
> a) where have I gone wrong?
> b) is there an easier way to set up these (and similar) models?
> 
> thanks, 
> and keep up to good work, django ist fun
> 



Re: Dreamhost, Django and MySQL server connection

2006-02-14 Thread Eugene Lazutkin


Jamison Roberts wrote:
I have nothing but problems with Dreamhost + Django.  More specifically 
Dreamhost + Python.  I hate that company and will be switching as soon 
as my year is up.


What "more specifically" was your problem with Python?


Can I threadjack and ask for a host recommendation?


http://code.djangoproject.com/wiki/DjangoFriendlyWebHosts

Thanks,

Eugene



Re: Dreamhost, Django and MySQL server connection

2006-02-14 Thread Eugene Lazutkin


foot wrote:

We've got our django project hosted over at Site5 and we have a similar
MySQL problem: A (2006, MySQL server has gone away) error, whenever the

[snip]

It would be great to get this fixed tho...


It was fixed 5 months ago but didn't make it to trunk. Please try 
http://code.djangoproject.com/ticket/463 (the new patch by nash) and see 
if it helps you.


Thanks,

Eugene



Re: Dreamhost, Django and MySQL server connection

2006-02-14 Thread Eugene Lazutkin


Edgars Jekabsons wrote:

Does anyone else who uses Dreamhost has problems with MySQL connection
going away?


I use Dreamhost without any problems, because I use MySQL patch (ticket 
#463 --- http://code.djangoproject.com/ticket/463). Please use the last 
version by nesh --- it was updated to use fair RW lock. I have no idea 
why it didn't make to trunk yet --- I never heard complains about the patch.


Thanks,

Eugene