Re: project don't apear in the admin page

2007-08-29 Thread Sheriff26

solved.
I don't added everywhere class Admin: pass



On Aug 29, 9:44 am, Sheriff26 <[EMAIL PROTECTED]> wrote:
> hi all...
>
> I have a problem.
>
> After I edited the models.py,
> and added class Admin: pass,
> and off course in settings.py 'mysite.myproject'
>
> it don't apear in the admin page!! Why ??
> What I do wrong ?
>
> this is the code of models.py
>
>  models.py
> from django.db import models
>
> import datetime
>
> class Cat(models.Model):
> name = models.CharField(max_length=200)
>
> class Admin:
> pass
>
> class Um(models.Model):
> um = models.CharField(max_length=3)
>
> class Produse(models.Model):
> name = models.CharField(max_length=200)
> cat = models.ForeignKey(Cat)
> desc = models.TextField()
> um = models.ForeignKey(Um)
> price =  models.IntegerField()
> pub_date = models.DateTimeField()


--~--~-~--~~~---~--~~
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: project don't apear in the admin page

2007-08-29 Thread Paul Rauch

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Sheriff26 schrieb:
> hi all...
> 
> I have a problem.
> 
> After I edited the models.py,
> and added class Admin: pass,
> and off course in settings.py 'mysite.myproject'
> 
> it don't apear in the admin page!! Why ??
> What I do wrong ?
> 
> this is the code of models.py
> 
>  models.py
> from django.db import models
> 
> import datetime
> 
> class Cat(models.Model):
> name = models.CharField(max_length=200)
> 
> class Admin:
> pass
> 
> class Um(models.Model):
> um = models.CharField(max_length=3)
> 
> class Produse(models.Model):
> name = models.CharField(max_length=200)
> cat = models.ForeignKey(Cat)
> desc = models.TextField()
> um = models.ForeignKey(Um)
> price =  models.IntegerField()
> pub_date = models.DateTimeField()
> 
> 
looks like wrong indetendation to me.
try this:
class Cat(models.Model):
name = models.CharField(max_length=200)
class Admin:
pass

greetz Paul Rauch
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iQIVAwUBRtUbfRG67lyyQrltAQJnrhAAmkdih65uC0lDFz37hfz+iax13GOMilvt
qLC4dH+WLFrlN0S8lAsh8cfVBxuGC2gWOh62oa0uwpyZDBFcsBrfCNTgiZkWa09C
XNHsPCw5rTxsh1AxZK/txKx/yjePbeLoXFZKGps/jL4rW7wADvChOmbuuOVKO+pc
UoIRFDdb43N+V1IS8jFgqFakaXBoBaFRaPz3MvKTZ8C7dyS+GYBL2BQOIxTpqLUj
rCy9E9ySIxUYQ4oeTkug+/72YDdO9zVepbN7ss8TIe6wKvNmTBQtQWlw/UW4CnD/
iEo4ByPrqG+ZAE7q7vGKDnmo8Zm1fHgbLsEexmvuAzoJEKv4n8yysirh4U6+sPnm
Fg81qamR46O5Srq20f4ZRN75LnEa3HV7+AaB9YQv0wtdutS/0NxlfKub3Or52Tfh
jsbKu7Up8oO/BFkxA4ohyLdz5RuhfY2ODus4fpKz/kk+C8K5tWUINqlRFglJhlQT
vKW8kyBkit7Qzvyf1PSH/s9UfGE9YRokbj+fQ4VbSTGUFQmnZdkURELLileyEaw1
w/U4kEKswsUsaJaoIWYBnYMbcyMNEJ/pfSfTrz9BAtnWNnPlP03ScojF/FrcSXEH
dEqLzK+yeH1LNnYEF0iOjqbwaRhcugRwuXCGxC5KbxyReqvaJ6x22jgBtBicFEqA
MkLkYc7m89g=
=L6eV
-END PGP SIGNATURE-

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

2007-08-29 Thread olive

Yes, me too.

I am desperately seeking this kind of job offering here in southern
Europe.

I hope it will happen before I retire (if I am not already too old).


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



Anyone built a django site in Welsh?

2007-08-29 Thread vanderkerkoff

Hello everyone

I was wondering if anyone in this group had built a django powered
site in the welsh language, that is, with Welsh Language content and
using Django's built in Welsh Admin backend?

I'd be really interested in starting up a conversation.


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

2007-08-29 Thread Matt Davies
you shouldn't limit your chances so much

"must be US citizens with no criminal history"

that's half the americans gone for starters :-)

Why live in New York?

People can do this from anywhere in the world.  You use cutting edge
technology like django, good choice, but you're not prepard to use cutting
edge work methods, bad choice.

See alot of these, they'll learn one day.

On 29/08/2007, olive <[EMAIL PROTECTED]> wrote:
>
>
> Yes, me too.
>
> I am desperately seeking this kind of job offering here in southern
> Europe.
>
> I hope it will happen before I retire (if I am not already too old).
>
>
> >
>

--~--~-~--~~~---~--~~
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: Anyone built a django site in Welsh?

2007-08-29 Thread Kenneth Gonsalves


On 29-Aug-07, at 12:58 PM, vanderkerkoff wrote:

> I was wondering if anyone in this group had built a django powered
> site in the welsh language, that is, with Welsh Language content and
> using Django's built in Welsh Admin backend?

is there a separate admin backend for welsh? I was under the  
impression that the admin backend was the same for all languages. I  
have done a site with english/finnish - set browser to english and  
everything appears in english. Set browser to finnish and everything  
appears in finnish (both strings and content)

-- 

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



--~--~-~--~~~---~--~~
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: UnicodeDecodeError with memcache

2007-08-29 Thread patrickk

thanks jeremy.
here´s the information:

CACHE_BACKEND = 'memcached://dedhost-sil-076.sil.at:11211/'

I´m not using the cache_middleware, because I´m using the per-view-
cache. Just re-checked the django-docs and hope I don´t misunderstand
the whole caching-thing - but according to the docs, the
cache_middleware is not necessary for the cache_page decorator.

instead of sending the whole stack, it´s probably easier to just check
it yourself:
http://skip.dedhost-sil-076.sil.at/trailer/

thanks,
patrick

On Aug 29, 4:49 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> On 8/28/07, patrickk <[EMAIL PROTECTED]> wrote:
>
>
>
> > additional information:
> > I just checked the default encoding
>
> > >>> import sys
> > >>> sys.getdefaultencoding()
> > 'ascii'
>
> > should that be something different (like utf-8)?
> > btw: all our data (database) and scripts are encoded with utf-8.
>
> patrickk, I'm not sure what lapain's experience with unicode is, but
> please disregard the advice to switch defaultencoding to utf-8.
> Despite appearances, it's *good* that python refuses to guess what
> encoding you might wish to emit.  You've found a bug in Django, and
> it's better to fix Django than tell everybody to go hack their python
> installs or change their processes with unusual configurations.


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



Window.Location using django and javascript

2007-08-29 Thread dOS

Im using a 2knob slider from blueshoes
I have the following code that prints out the url of the site

{% url full-filter
old_origin,length=old_length,area=old_area,from_price=old_from_price,to_price=old_to_price,shipdate=ship_shipdate
%}

and I need to pass a price range in the url like this

/shop/gp/length/area/priceSLIDER-SLIDER/shipdate/

Im using the following code

   var tempurl = "{% url full-filter
old_origin,length=old_length,area=old_area,from_price=old_from_price,to_price=old_to_price,shipdate=ship_shipdate
%}"
   window.location=tempurl
+mySlider1.getValue(1)+mySlider1.getValue(2);

But i need that the price goes in between the price range, not at the
end and if do something like this,
   var tempurl = "{% url full-filter
old_origin,length=old_length,area=old_area,from_price=
%}getValue(1)+mySlider1{%old_from_price,to_price=old_to_price,shipdate=ship_shipdate
%}"

it wont work

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: Django Development Position

2007-08-29 Thread Jarek Zgoda

olive napisał(a):

> Yes, me too.
> 
> I am desperately seeking this kind of job offering here in southern
> Europe.
> 
> I hope it will happen before I retire (if I am not already too old).

We are desperately seeking talented developers with Django skills.
Unfortunately - in central Europe. Missed again... ;)

-- 
Jarek Zgoda
Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)

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

2007-08-29 Thread James Bennett

On 8/29/07, Matt Davies <[EMAIL PROTECTED]> wrote:
> you shouldn't limit your chances so much
>
> "must be US citizens with no criminal history"

Somewhat OT, but for some companies this is a legal requirement.
Citizenship for certain firms who do government work, no criminal
record is common in industries where the company is bonded and risks
losing that if they have an employee with a record. I obviously don't
know the details of this specific job, but there are plenty of cases
where these really are non-negotiable requirements...


-- 
"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: Django Development Position

2007-08-29 Thread Kenneth Gonsalves


On 29-Aug-07, at 1:26 PM, James Bennett wrote:

>> "must be US citizens with no criminal history"
>
> Somewhat OT, but for some companies this is a legal requirement.
> Citizenship for certain firms who do government work, no criminal
> record is common in industries where the company is bonded and risks
> losing that if they have an employee with a record. I obviously don't
> know the details of this specific job, but there are plenty of cases
> where these really are non-negotiable requirements...

given the international nature of this list, it would be best for all  
job posters to follow the most sensible procedure - very brief  
description of the job and a pointer to a web page that gives full  
details. It helps the SNR and also avoids stepping on toes.

-- 

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



--~--~-~--~~~---~--~~
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: UnicodeDecodeError with memcache

2007-08-29 Thread Michael Radziej

On Wed, Aug 29, patrickk wrote:

> instead of sending the whole stack, it´s probably easier to just check
> it yourself:
> http://skip.dedhost-sil-076.sil.at/trailer/

 File "/usr/lib/python2.4/site-packages/memcache.py" in _set
  328. fullcmd = "%s %s %d %d %d\r\n%s" % (cmd, key, flags, time, len(val),
val)


It seems that memcached is not really prepared to take unicode cache keys.
Here, it constructs a cache value by pickle.dumps, so `val` is a bytestring.
key is still a unicode string. Combining both with the % operator won't
always work.

So, somewhere the cache backend need to use smart_str(). I'm not sure about
the right place, but django/core/cache/backends/memcached.py in set() would
be one place.

Michael




-- 
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100
http://www.noris.de - The IT-Outsourcing Company
 
Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk - 
Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689

--~--~-~--~~~---~--~~
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: Lighttpd advice please

2007-08-29 Thread b3n

I found a guide that said:

"RHEL 64 bit v4.0 does not support PHP as FastCGI. Lighttpd is not
available from RHN (up2date command). How do I configure and install
lighttpd with FastCGI?
Ok let me answer these questions and other queries systematically. I
have installed Lighttpd under both RHEL 32/64 bit version couple of
times. In all cases, you need to compile both PHP and Lightttpd."

I want to keep using Apache to host PHP sites and I want to start
using Lighttpd  to host Django sites and static media files.

I don't need to re-compile PHP do I?


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



count() causes QuerySet re-evaluation?

2007-08-29 Thread Bjorn Ruud

I have the following piece of code:

pool = Ticket.objects.filter(type='NORMAL', status='AVAILABLE')
rand = random.SystemRandom()
selected = rand.sample(xrange(pool.count()), amount)
for i in selected:
t = pool[i]
t.type = type
t.create_time = time
t.save()
print "i: %d, pool: %d" % (i, pool.count())

The pool QuerySet gets re-evaluated when the count() in the loop is
run. Since one of the fields in the filter gets changed, the amount of
objects in the QuerySet will be different. If pool.count() is replaced
with len(pool) this does not happen. Is this intended behaviour? Can a
QuerySet be made immutable?


Regards,
Bjorn Ruud


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

2007-08-29 Thread Rufman

this is my bullet class in models.py:

class Bullet(models.Model):
id_bullet = models.AutoField(primary_key=True)
content = models.TextField(help_text="Text field to enter
content")
fk_day = models.ForeignKey(Day, help_text="Day the entry belongs
to")
fk_rubric = models.ForeignKey(Rubric, help_text="Rubric the entry
belongs to")
fk_classification = models.ForeignKey(Classification,
help_text="Classification the entry belongs to")

#returns the absolute url of the object --> dynamicly updates if
urls.py is changed
def get_absolute_url(self):
return ('pyOrganize.pyworkbook.views.bullet.viewBullets',
None, {
'day_id': str(self.fk_day),
'rubric_id': str(self.fk_rubric)})
get_absolute_url = permalink(get_absolute_url)

#returns name of object -> Used for human identification in admin
interface
def __unicode__(self):
return "Bullet "+str(self.id_bullet)

and this is the server dump i get:

Traceback (most recent call last):
  File "c:\Python25\lib\site-packages\django\core\servers
\basehttp.py", line 279, in run
self.finish_response()
  File "c:\Python25\lib\site-packages\django\core\servers
\basehttp.py", line 318, in finish_response
self.write(data)
  File "c:\Python25\lib\site-packages\django\core\servers
\basehttp.py", line 397, in write
self.send_headers()
  File "c:\Python25\lib\site-packages\django\core\servers
\basehttp.py", line 449, in send_headers
self.send_preamble()
  File "c:\Python25\lib\site-packages\django\core\servers
\basehttp.py", line 379, in send_preamble
'Date: %s\r\n' % (formatdate()[:26] + "GMT")
  File "C:\Python25\Lib\socket.py", line 261, in write
self.flush()
  File "C:\Python25\Lib\socket.py", line 248, in flush
self._sock.sendall(buffer)
error: (10053, 'Software caused connection abort')

any help is appreciated


--~--~-~--~~~---~--~~
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: Anyone built a django site in Welsh?

2007-08-29 Thread vanderkerkoff

if you set lang_code to cy in settings.py the labels in the admin ar
ein welsh, home is adref etc etc



On Aug 29, 8:36 am, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> On 29-Aug-07, at 12:58 PM, vanderkerkoff wrote:
>
> > I was wondering if anyone in this group had built a django powered
> > site in the welsh language, that is, with Welsh Language content and
> > using Django's built in Welsh Admin backend?
>
> is there a separate admin backend for welsh? I was under the
> impression that the admin backend was the same for all languages. I
> have done a site with english/finnish - set browser to english and
> everything appears in english. Set browser to finnish and everything
> appears in finnish (both strings and content)
>
> --
>
> regards
> kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/


--~--~-~--~~~---~--~~
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: Choices cannot be marked for translation?

2007-08-29 Thread Michael Radziej

On Wed, Aug 29, Kenneth Gonsalves wrote:

> 
> 
> On 28-Aug-07, at 9:55 PM, Chris Hoeppner wrote:
> 
> >> when i upgraded to the latest svn head, I found that all the places
> >> in admin that had drop downs for choices were blank. I had always
> >> marked my choices for translation like so:
> >>
> >> article_type = (
> >> ("NW", _("News")),
> >> ("FT",_("Features")),
> >> )
> >>
> >> now, this doesnt work - when I remove the _(), then the choices
> >> appear. How do I then mark them for translation?
> >>
> >
> > Make sure to use gettext_lazy
> 
> i *am* using: from django.utils.translation import gettext_lazy as _

Ha! How should we know?

Does it help to use ugettext_lazy instead?

Michael


-- 
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100
http://www.noris.de - The IT-Outsourcing Company
 
Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk - 
Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689

--~--~-~--~~~---~--~~
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: Error adding DateField - 'unicode' object has no attribute 'strftime'

2007-08-29 Thread Michael Radziej

On Tue, Aug 28, Greg wrote:

> 
> Hello,
> I have the following code in my models.py file
> 
> class Orders(models.Model):
> timestamp = models.DateField()
> ... etc
> 
> /
> 
> I have the following in my view.py function
> 
> from datetime import datetime
> o = Orders()
> o.timestamp = datetime.now()
> ... etc
> o.save()
> 
> 
> 
> However, when I view this order in the admin I get the following
> error:
> 
> AttributeError at /admin/rugs/orders/13/
> 'unicode' object has no attribute 'strftime'
> 
> Does anybody know what's going on?

Do you use Mysql? I made the weird experience that MySQLdb sometimes returns
a string instead of datetime.datetime. It seemed to happen deep in either
MySQLdb or even the client library of mysql. (Mysql 4.1)

Michael

-- 
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100
http://www.noris.de - The IT-Outsourcing Company
 
Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk - 
Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689

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



content type with runserver

2007-08-29 Thread vanderkerkoff

Is it possible to set the content type using runserver in development
in the same way you'd set lighttpd to use utf-8 as described below?

mimetype.assign = (
  ".css"=>  "text/css; charset=utf-8",
  ".gif"=>  "image/gif",
  ".htm"=>  "text/html; charset=utf-8",
  ".html"   =>  "text/html; charset=utf-8",
  ".jpeg"   =>  "image/jpeg",
  ".jpg"=>  "image/jpeg",
  ".js" =>  "text/javascript; charset=utf-8",
  ".png"=>  "image/png",
  ".swf"=>  "application/x-shockwave-flash",
  ".txt"=>  "text/plain; charset=utf-8"
)

Any help, greatly appreciated.


--~--~-~--~~~---~--~~
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: UnicodeDecodeError with memcache

2007-08-29 Thread patrickk

I just changed
self._cache.set(key, value, timeout or self.default_timeout)
to
self._cache.set(smart_str(key), value, timeout or
self.default_timeout)
in memcached.py
and it seems to work.

Don´t know if that´s a proper solution though.

thanks,
patrick


On Aug 29, 10:32 am, Michael Radziej <[EMAIL PROTECTED]> wrote:
> On Wed, Aug 29, patrickk wrote:
> > instead of sending the whole stack, it´s probably easier to just check
> > it yourself:
> >http://skip.dedhost-sil-076.sil.at/trailer/
>
>  File "/usr/lib/python2.4/site-packages/memcache.py" in _set
>   328. fullcmd = "%s %s %d %d %d\r\n%s" % (cmd, key, flags, time, len(val),
> val)
>
> It seems that memcached is not really prepared to take unicode cache keys.
> Here, it constructs a cache value by pickle.dumps, so `val` is a bytestring.
> key is still a unicode string. Combining both with the % operator won't
> always work.
>
> So, somewhere the cache backend need to use smart_str(). I'm not sure about
> the right place, but django/core/cache/backends/memcached.py in set() would
> be one place.
>
> Michael
>
> --
> noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
> Tel +49-911-9352-0 - Fax +49-911-9352-100http://www.noris.de- The 
> IT-Outsourcing Company
>
> Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk -
> Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689


--~--~-~--~~~---~--~~
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: UnicodeDecodeError with memcache

2007-08-29 Thread Michael Radziej

On Wed, Aug 29, patrickk wrote:

> 
> I just changed
> self._cache.set(key, value, timeout or self.default_timeout)
> to
> self._cache.set(smart_str(key), value, timeout or
> self.default_timeout)
> in memcached.py
> and it seems to work.
> 
> Don´t know if that´s a proper solution though.

Me either ;-) It's probably not the full solution.

But please file a ticket so this doesn't get lost (with reference to this
thread).

Michael

-- 
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100
http://www.noris.de - The IT-Outsourcing Company
 
Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk - 
Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689

--~--~-~--~~~---~--~~
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: Choices cannot be marked for translation?

2007-08-29 Thread Kenneth Gonsalves


On 29-Aug-07, at 2:24 PM, Michael Radziej wrote:

 now, this doesnt work - when I remove the _(), then the choices
 appear. How do I then mark them for translation?

>>>
>>> Make sure to use gettext_lazy
>>
>> i *am* using: from django.utils.translation import gettext_lazy as _
>
> Ha! How should we know?
>
> Does it help to use ugettext_lazy instead?

doesnt work - i just marked one string, the marked string didnt  
appear, the other two did.

-- 

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



--~--~-~--~~~---~--~~
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: Choices cannot be marked for translation?

2007-08-29 Thread Michael Radziej

On Wed, Aug 29, Kenneth Gonsalves wrote:

> 
> 
> On 29-Aug-07, at 2:24 PM, Michael Radziej wrote:
> 
>  now, this doesnt work - when I remove the _(), then the choices
>  appear. How do I then mark them for translation?
> 
> >>>
> >>> Make sure to use gettext_lazy
> >>
> >> i *am* using: from django.utils.translation import gettext_lazy as _
> >
> > Ha! How should we know?
> >
> > Does it help to use ugettext_lazy instead?
> 
> doesnt work - i just marked one string, the marked string didnt  
> appear, the other two did.

Well, sorry, then I'm personally running out of ideas. But this looks really
weird.

Michael

-- 
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100
http://www.noris.de - The IT-Outsourcing Company
 
Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk - 
Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689

--~--~-~--~~~---~--~~
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: Choices cannot be marked for translation?

2007-08-29 Thread Jarek Zgoda

Kenneth Gonsalves napisał(a):

> now, this doesnt work - when I remove the _(), then the choices
> appear. How do I then mark them for translation?
>
 Make sure to use gettext_lazy
>>> i *am* using: from django.utils.translation import gettext_lazy as _
>> Ha! How should we know?
>>
>> Does it help to use ugettext_lazy instead?
> 
> doesnt work - i just marked one string, the marked string didnt  
> appear, the other two did.

The next testing option is to try with non-lazy version.

-- 
Jarek Zgoda
Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)

--~--~-~--~~~---~--~~
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: Choices cannot be marked for translation?

2007-08-29 Thread Kenneth Gonsalves


On 29-Aug-07, at 2:51 PM, Michael Radziej wrote:

>> doesnt work - i just marked one string, the marked string didnt
>> appear, the other two did.
>
> Well, sorry, then I'm personally running out of ideas. But this  
> looks really
> weird.

i filed a bug report

-- 

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



--~--~-~--~~~---~--~~
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: Choices cannot be marked for translation?

2007-08-29 Thread Kenneth Gonsalves


On 29-Aug-07, at 2:53 PM, Jarek Zgoda wrote:

>> now, this doesnt work - when I remove the _(), then the choices
>> appear. How do I then mark them for translation?
>>
> Make sure to use gettext_lazy
 i *am* using: from django.utils.translation import gettext_lazy  
 as _
>>> Ha! How should we know?
>>>
>>> Does it help to use ugettext_lazy instead?
>>
>> doesnt work - i just marked one string, the marked string didnt
>> appear, the other two did.
>
> The next testing option is to try with non-lazy version.

that works! import gettext as _

-- 

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



--~--~-~--~~~---~--~~
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: Anyone built a django site in Welsh?

2007-08-29 Thread Thomas Badran

I haven't yet, but I'm currently working on a clients site that's likely
to be translated at some point. Not the admin site though, just the main
content.

Tom

On Wed, 2007-08-29 at 07:28 +, vanderkerkoff wrote:
> Hello everyone
> 
> I was wondering if anyone in this group had built a django powered
> site in the welsh language, that is, with Welsh Language content and
> using Django's built in Welsh Admin backend?
> 
> I'd be really interested in starting up a conversation.
> 
> 
> > 


--~--~-~--~~~---~--~~
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: Anyone built a django site in Welsh?

2007-08-29 Thread Matt Davies
Thomas, I'm having one hell of a problem getting certain characters to work
in Unicode django

Basically the wW and yY with circumflexes above them.

You don't know if they're in some wierd character set that I need to grab
somehow?



On 29/08/2007, Thomas Badran <[EMAIL PROTECTED]> wrote:
>
>
> I haven't yet, but I'm currently working on a clients site that's likely
> to be translated at some point. Not the admin site though, just the main
> content.
>
> Tom
>
> On Wed, 2007-08-29 at 07:28 +, vanderkerkoff wrote:
> > Hello everyone
> >
> > I was wondering if anyone in this group had built a django powered
> > site in the welsh language, that is, with Welsh Language content and
> > using Django's built in Welsh Admin backend?
> >
> > I'd be really interested in starting up a conversation.
> >
> >
> > >
>
>
> >
>

--~--~-~--~~~---~--~~
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: Anyone built a django site in Welsh?

2007-08-29 Thread Jason Davies

Hello,

One of my first Django-powered sites was in fact bilingual (Welsh and
English) :-)

http://www.cyswllt.org/cy/

To activate the Welsh translation of the admin interface, simply set
LANGUAGE_CODE [1] to 'cy' in your settings.

Jason

[1] http://www.djangoproject.com/documentation/settings/#language-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: Anyone built a django site in Welsh?

2007-08-29 Thread Thomas Badran

Afraid not, i havent started toying with this yes. I was going on the
assumption that unicode would work fine without problems (i thought
everythign was unicode internally), looks like i might need to push
forward some testing.

Tom

On Wed, 2007-08-29 at 11:04 +0100, Matt Davies wrote:
> Thomas, I'm having one hell of a problem getting certain characters to
> work in Unicode django
> 
> Basically the wW and yY with circumflexes above them.
> 
> You don't know if they're in some wierd character set that I need to
> grab somehow? 
> 
> 
> 
> On 29/08/2007, Thomas Badran <[EMAIL PROTECTED]> wrote:
> 
> I haven't yet, but I'm currently working on a clients site
> that's likely
> to be translated at some point. Not the admin site though,
> just the main
> content.
> 
> Tom
> 
> On Wed, 2007-08-29 at 07:28 +, vanderkerkoff wrote: 
> > Hello everyone
> >
> > I was wondering if anyone in this group had built a django
> powered
> > site in the welsh language, that is, with Welsh Language
> content and
> > using Django's built in Welsh Admin backend? 
> >
> > I'd be really interested in starting up a conversation.
> >
> >
> > >
> 
> 
> 
> 
> 
> 
> > 


--~--~-~--~~~---~--~~
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: Anyone built a django site in Welsh?

2007-08-29 Thread Jason Davies

On Aug 29, 11:07 am, Jason Davies <[EMAIL PROTECTED]> wrote:
> http://www.cyswllt.org/cy/

There's also a Welsh translation of my fbfriends Facebook application:
http://www.jasondavies.com/fbfriends/

Jason


--~--~-~--~~~---~--~~
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: Anyone built a django site in Welsh?

2007-08-29 Thread Matt Davies
Hi Jason, Thomas

Jason, have you had any problems with the w character in capital and lower
case?  And the y character in capital and lower case?

On 29/08/2007, Thomas Badran <[EMAIL PROTECTED]> wrote:
>
>
> Afraid not, i havent started toying with this yes. I was going on the
> assumption that unicode would work fine without problems (i thought
> everythign was unicode internally), looks like i might need to push
> forward some testing.
>
> Tom
>
> On Wed, 2007-08-29 at 11:04 +0100, Matt Davies wrote:
> > Thomas, I'm having one hell of a problem getting certain characters to
> > work in Unicode django
> >
> > Basically the wW and yY with circumflexes above them.
> >
> > You don't know if they're in some wierd character set that I need to
> > grab somehow?
> >
> >
> >
> > On 29/08/2007, Thomas Badran <[EMAIL PROTECTED]> wrote:
> >
> > I haven't yet, but I'm currently working on a clients site
> > that's likely
> > to be translated at some point. Not the admin site though,
> > just the main
> > content.
> >
> > Tom
> >
> > On Wed, 2007-08-29 at 07:28 +, vanderkerkoff wrote:
> > > Hello everyone
> > >
> > > I was wondering if anyone in this group had built a django
> > powered
> > > site in the welsh language, that is, with Welsh Language
> > content and
> > > using Django's built in Welsh Admin backend?
> > >
> > > I'd be really interested in starting up a conversation.
> > >
> > >
> > > >
> >
> >
> >
> >
> >
> >
> > >
>
>
> >
>

--~--~-~--~~~---~--~~
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: Anyone built a django site in Welsh?

2007-08-29 Thread Matt Davies
Just added the app, nice work Jas



On 29/08/2007, Jason Davies <[EMAIL PROTECTED]> wrote:
>
>
> On Aug 29, 11:07 am, Jason Davies <[EMAIL PROTECTED]> wrote:
> > http://www.cyswllt.org/cy/
>
> There's also a Welsh translation of my fbfriends Facebook application:
> http://www.jasondavies.com/fbfriends/
>
> Jason
>
>
> >
>

--~--~-~--~~~---~--~~
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: Anyone built a django site in Welsh?

2007-08-29 Thread Matt Davies
Jason, do me a favour, can you try putting the welsh w character with a
circumflex into one of your django sites, see if it get's transated ok for
me?

I'm running unicde django, utf8 all over the place, sitecustomize is telling
it to be utf8, but I can't get those characters into mysql at all

Can you?



On 29/08/2007, Matt Davies <[EMAIL PROTECTED]> wrote:
>
> Just added the app, nice work Jas
>
>
>
> On 29/08/2007, Jason Davies <[EMAIL PROTECTED]> wrote:
> >
> >
> > On Aug 29, 11:07 am, Jason Davies <[EMAIL PROTECTED] > wrote:
> > > http://www.cyswllt.org/cy/
> >
> > There's also a Welsh translation of my fbfriends Facebook application:
> > http://www.jasondavies.com/fbfriends/
> >
> > Jason
> >
> >
> > > >
> >
>

--~--~-~--~~~---~--~~
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: caching and authentication

2007-08-29 Thread patrickk

it´s a bit late, but I just wanted to tell that it works with
patch_vary_headers.
in my opinion, this could be explained better in the docs.

so, if one uses a page based on user-authentication and wants to cache
that page using the cache_page decorator, here´s the code:

def my_view(request):


response = render_to_response('site/whatever/template.html', {
...
}, context_instance=RequestContext(request) )
patch_vary_headers(response, ['Cookie'])
return response
my_view = cache_page(may_view, 60 * 15)

thanks,
patrick


On 8 Jul., 01:18, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> On 7/7/07, patrick k. <[EMAIL PROTECTED]> wrote:
>
> > I don´t understand why the page_cache is keyed by the vary header and
> > the view_cache is not. is there a reason for this?
>
> You mean cache_page rather than page_cache, but what is view_cache?
>
> I think I may have spotted the problem: the cache_page decorator runs
> before the Vary header gets patched for the session access.
>
> As a test, just before you return your HttpResponse, try adding this
> to one of your auth views, and try to use the cache_page decorator:
>
> from django.utils.cacheimport patch_vary_headers
> patch_vary_headers(response, ('Cookie',))
>
> (Maye sure to dump yourcachefirst, too.)


--~--~-~--~~~---~--~~
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: caching and authentication

2007-08-29 Thread patrickk

I´ve been too optimistic - the above code doesn´t work.
(This whole caching-issue gives me the willies)

On 29 Aug., 12:21, patrickk <[EMAIL PROTECTED]> wrote:
> it´s a bit late, but I just wanted to tell that it works with
> patch_vary_headers.
> in my opinion, this could be explained better in the docs.
>
> so, if one uses a page based on user-authentication and wants to cache
> that page using the cache_page decorator, here´s the code:
>
> def my_view(request):
> 
>
> response = render_to_response('site/whatever/template.html', {
> ...
> }, context_instance=RequestContext(request) )
> patch_vary_headers(response, ['Cookie'])
> return response
> my_view = cache_page(may_view, 60 * 15)
>
> thanks,
> patrick
>
> On 8 Jul., 01:18, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
>
> > On 7/7/07, patrick k. <[EMAIL PROTECTED]> wrote:
>
> > > I don´t understand why the page_cache is keyed by the vary header and
> > > the view_cache is not. is there a reason for this?
>
> > You mean cache_page rather than page_cache, but what is view_cache?
>
> > I think I may have spotted the problem: the cache_page decorator runs
> > before the Vary header gets patched for the session access.
>
> > As a test, just before you return your HttpResponse, try adding this
> > to one of your auth views, and try to use the cache_page decorator:
>
> > from django.utils.cacheimport patch_vary_headers
> > patch_vary_headers(response, ('Cookie',))
>
> > (Maye sure to dump yourcachefirst, too.)


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



foreign keys between different application models

2007-08-29 Thread Graham Carlyle

I recently decided to split out a django application from another one as
it seemed to nicely separate a related bunch of views & models. 

However a model in the split-out application needs a foreign key to a
model in the original application. This seems to cause ./manage reset to
now fail.

I think this is because the reset is done on a per application basis and
so the table in the original app can't be dropped as its referred to by
the split-off application's model table.

So should models in different application's never have foreign key
dependencies and so i should bring them back to one application? or does
anyone know if there is another way around this problem?

thanks,
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, CherryPy and threading

2007-08-29 Thread Justin Johnson


Okay, maybe my text should have read "I've deployed Django with Apache 
and ModPython where each request *may* be serviced by a separate process."

Concurrent requests being handled within the same interpreter was my 
concern with Django.  After a quick look at the source code it seems 
that DatabaseWrapper is thread aware.  Hopefully it'll cope with 
sqlite3's threadsafety level which means you cannot share a connection 
object among multiple threads.

You're right in that there isn't any threading support with sessions.  
Writing session information back to the database is atomic though so the 
worst you'll get is data being overwritten by the last altered session.  
As you say, that's one to watch out for with concurrent Ajax operations 
which alter session information.  Wouldn't this still be an issue with 
the non-threading model?

The only way to ensure session integrity in these corner cases would be 
to lock on the session id during a request (somehow - probably not 
trivial).  That would mean that requests from the same source would be 
processed sequentially and not in parallel.  It's probably easier just 
to be very careful with parallel requests.

Justin
> On Aug 29, 1:39 am, Justin Johnson <[EMAIL PROTECTED]> wrote:
>   
>> I've managed to get Django working nicely with CherryPy using WSGI.
>> Previously I've deployed Django with Apache and ModPython where each
>> requested is serviced by a separate Python instance.
>> 
>
> How you think mod_python works is wrong, or at least the way you
> explain it is deceiving in its meaning.
>
> In mod_python, each request is not 'serviced by a separate Python
> instance'.
>
> In the case of prefork MPM in Apache, although it isn't threaded and
> so concurrent requests can't be handled at the same time within a
> single interpreter instance, successive requests do get handled in the
> same Python interpreter instance. In other words, the interpreter is
> not thrown away and instead persists until the process itself is
> killed, which may only be when Apache itself is shutdown or restarted.
>
> In the case of worker MPM in Apache, multithreading is used and so
> concurrent requests do get handled in the same interpreter at the same
> time. Again, the interpreter persists for the life of the process.
>
> Where confusion often arises and why this myth that a separate Python
> instance is used for each request persists is that Apache on UNIX is a
> multi process web server. Thus your requests aren't necessarily all
> handled in the same process, instead they can be distributed across
> multiple processes. The use of multiple processes by Apache and the
> fact that it can create more on demand as load rises, means that
> Apache is much better able to scale than solutions which use a single
> Python process with web server implemented in Python only.
>
> I really wish this myth about mod_python would die. :-(
>
> For a bit more information about the process/interpreter model in
> mod_python read:
>
>   http://www.dscpl.com.au/wiki/ModPython/Articles/TheProcessInterpreterModel
>
>   
>> This isn't the case with CherryPy though as it's thread based which
>> leads me to the following concern:  is it safe to serve Django with
>> CherryPy?
>> 
>
> If one takes the warning in mod_python documentation that only prefork
> MPM for Apache should be used and worker MPM should not, then it would
> follow that using the CherryPy multithreaded web server would not be
> safe. Similarly, it wouldn't be safe to run Django on Windows with
> Apache either.
>
> In practice, discussions in the past have indicated that there are no
> known multithreading problems in Django itself. Thus the warnings
> about avoiding worker MPM and thus multithreaded MPMs may not be
> strictly applicable. Now although Django may be safe for
> multithreading, you would still need to ensure that your higher level
> code implemented in Django is multithread safe. You would also need to
> ensure that you are using recent versions of any database adapters and
> that they declare themselves as multithread safe.
>
> Most importantly, you should rigorously test your application to
> ensure that it is truly safe to use in a multithreaded web server.
> Areas which I would suggest you look at closely are use of session
> objects as these from memory do not provide a locking mechanism, and
> so in an AJAX heavy application which issues lots of concurrent
> requests and each handler for them wants to manipulate the same
> session object, you might run into problems with the handlers and
> sequencing of operations against the session object.
>
> 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.

search better and free things to download from here

2007-08-29 Thread [EMAIL PROTECTED]

This is Piyu,

(this will help you finding and downloading any stuff for free)
This may help you to get better things
(Only for windows users)

Click Here

http://contest.guruji.com/download.php?refid=225ec06f8fe542cd04d824c79beeb5e7

Please use this for anything you feel for. You know what anything you
can do

Also Please forward it to your friends.

Thanks,
Yours  Piyu...


--~--~-~--~~~---~--~~
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: Anyone built a django site in Welsh?

2007-08-29 Thread Jason Davies

Hi Matt,

On Aug 29, 11:19 am, "Matt Davies" <[EMAIL PROTECTED]> wrote:
> Jason, do me a favour, can you try putting the welsh w character with a
> circumflex into one of your django sites, see if it get's transated ok for
> me?

Seems to work fine for me.  Are you sure the MySQL database is using
UTF-8 too?

Jason


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



site/section/app

2007-08-29 Thread Rob Slotboom

I'm trying to implement a kind of model but I'm stuck. Maybe someone
outhere can give me some help?

This is what I'm thinking about:

A site can have sections and a section can have apps. Also a site can
have apps.

For example:

Site: gardening.org
app: news
sections: garden/kitchen
garden apps: news/crop/tips
kitchen apps: news/recipes/tips

Site: canoein.org
app: news
sections: workshop/on the water
workshop apps: news/tools/tips
on the water apps: news/events/routes

I know I can create two sites (projects) but I'm thinking about some
database solution: One project and the abillity to add apps to sites
and/or site-sections.


--~--~-~--~~~---~--~~
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: Choices cannot be marked for translation?

2007-08-29 Thread Jarek Zgoda

Kenneth Gonsalves napisał(a):

>>> now, this doesnt work - when I remove the _(), then the choices
>>> appear. How do I then mark them for translation?
>>>
>> Make sure to use gettext_lazy
> i *am* using: from django.utils.translation import gettext_lazy  
> as _
 Ha! How should we know?

 Does it help to use ugettext_lazy instead?
>>> doesnt work - i just marked one string, the marked string didnt
>>> appear, the other two did.
>> The next testing option is to try with non-lazy version.
> 
> that works! import gettext as _

And that's a real bug, I think.

Anyway, for future reference, keep in mind that lazily translated
"strings" become real strings at access time. Before that they are
function objects. That is, you cann't, for example, pickle them - and in
consequence put in session because session data is pickled before
saving. Laziness isn't always good. ;)

-- 
Jarek Zgoda
Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)

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



Reutilizing views

2007-08-29 Thread Grupo Django

Hello, I'd like to know if there is some way for reutilizing a view.

In my case, I have an application to show some data, but I want to
show the same data in the front page, among other data from other
models.
Well, I have figured out this method:

def myview(request, returnHTTP=True):
t = loader.get_template('template.html')
...
c = RequestContext(request,{ 'data':data })
if returnHTTP:
return HttpResponse(t.render(c))
else:
return data

and in the view of the front page:

def front-page(request):
from someApp.views import myview
data = myview(request,False)


Is this ok? Perhaps there is a better way of doing it with django.
Thank you very much.


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



Django 1 debugging in pydev with breakpoints

2007-08-29 Thread Rufman

hey guys

does anyone have an idea how i can set breakpoint while debugging in
pydev. i got the dev server to work from inside eclipse but breakpoint
don't seem to work.


stephane


--~--~-~--~~~---~--~~
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: Anyone built a django site in Welsh?

2007-08-29 Thread Matt Davies
Hi Jason

yeah mate, everything I can think of is set to utf-8 and unicode as
explained here

How did you get that character into the database?

Did you add it to a web form and put it in like that?

If so, did you type the character, or did you copy and paste it from
somewhere else?

Sorry to be a pain mate, but it'll really help me out if I can work out
whats going on here.

Interestingly enough only those two characters mess up, the others with
circumflexes are fine.



On 29/08/2007, Jason Davies <[EMAIL PROTECTED]> wrote:
>
>
> Hi Matt,
>
> On Aug 29, 11:19 am, "Matt Davies" <[EMAIL PROTECTED]> wrote:
> > Jason, do me a favour, can you try putting the welsh w character with a
> > circumflex into one of your django sites, see if it get's transated ok
> for
> > me?
>
> Seems to work fine for me.  Are you sure the MySQL database is using
> UTF-8 too?
>
> Jason
>
>
> >
>

--~--~-~--~~~---~--~~
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: Anyone built a django site in Welsh?

2007-08-29 Thread Jason Davies

Hi Matt,

On Aug 29, 12:02 pm, "Matt Davies" <[EMAIL PROTECTED]> wrote:
> How did you get that character into the database?
>
> Did you add it to a web form and put it in like that?
>
> If so, did you type the character, or did you copy and paste it from
> somewhere else?

I copied and pasted it into a web form from
http://www.200words-a-day.com/typing-welsh-characters.html

"ŵ and ŷ"

By the way, I'm using the latest SVN version of Django, which has
proper unicode support internally.

Jason


--~--~-~--~~~---~--~~
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: modpython and python2.5

2007-08-29 Thread Grupo Django

Finally I have rewritten the code to make it compatible with
python2.4. It was the easiest solution.

I hope Debian makes python 2.5 the default interpreter soon.

On 28 ago, 17:40, TheMaTrIx <[EMAIL PROTECTED]> wrote:
> mod_python needs to be compiled against the python version your using.
>
> On windows mod_python even trows errors in the logfile (although it
> still functions) when you use the mod_python for python 2.5, while
> your using python 2.5.1.
>
> On Aug 28, 1:48 pm, Leandro Zanuz <[EMAIL PROTECTED]> wrote:
>
> > You'll need to recompile your apache/mod-python. When you
> > compile the mod-python you'll need ro inform the python path
> > that you want to use.
>
> > Grupo Django escreveu:
>
> > > This is not a django related problem, but I thought that maybe someone
> > > could help me.
> > > I have a Debian 4 server with apache2, modpython 3.3., python2.4 and
> > > python2.5
> > > PYthon 2.4 is required by Debian to solve some dependency problem, I
> > > have just installed python2.5 and made it the default interpreter, but
> > > modpython is not using it, I have no idea why.
> > > Now I have a web down because I can't solve this problem.
>
> > > 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: Anyone built a django site in Welsh?

2007-08-29 Thread Jarek Zgoda

Matt Davies napisał(a):

> yeah mate, everything I can think of is set to utf-8 and unicode as
> explained here
> 
> How did you get that character into the database?
> 
> Did you add it to a web form and put it in like that?
> 
> If so, did you type the character, or did you copy and paste it from
> somewhere else?
> 
> Sorry to be a pain mate, but it'll really help me out if I can work out
> whats going on here.
> 
> Interestingly enough only those two characters mess up, the others with
> circumflexes are fine.

Are you sure your MySQL client sets proper charset on connection? From
the docs at
http://www.djangoproject.com/documentation/databases/#connecting-to-the-database
- check if the last line of example MySQL config file is in place. From
your description it looks that the client encoding is set to latin1.

-- 
Jarek Zgoda
Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)

--~--~-~--~~~---~--~~
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: Anyone built a django site in Welsh?

2007-08-29 Thread Matt Davies
Hi Jarek

Yep, got that line in my.cnf, my cocoa Show Variables are all utf8.

curl tells me it's utf8, request.meta tells me it's utf8, bit it really
doesn't look like it is utf8

any more suggestions anyone?

On 29/08/2007, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
>
>
> Matt Davies napisał(a):
>
> > yeah mate, everything I can think of is set to utf-8 and unicode as
> > explained here
> >
> > How did you get that character into the database?
> >
> > Did you add it to a web form and put it in like that?
> >
> > If so, did you type the character, or did you copy and paste it from
> > somewhere else?
> >
> > Sorry to be a pain mate, but it'll really help me out if I can work out
> > whats going on here.
> >
> > Interestingly enough only those two characters mess up, the others with
> > circumflexes are fine.
>
> Are you sure your MySQL client sets proper charset on connection? From
> the docs at
>
> http://www.djangoproject.com/documentation/databases/#connecting-to-the-database
> - check if the last line of example MySQL config file is in place. From
> your description it looks that the client encoding is set to latin1.
>
> --
> Jarek Zgoda
> Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101
>
> "We read Knuth so you don't have to." (Tim Peters)
>
> >
>

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



Apache + Django - syntax error

2007-08-29 Thread b3n

I'm trying to get Django working on my local Apache (v2). I'm on
Windows XP.


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE bookmarks.settings
PythonDebug On
PythonPath "C:\Python\bookmarks"


If I take out PythonPath I get even more traceback and the following
error:

"EnvironmentError: Could not import settings 'bookmarks.settings' (Is
it on sys.path? Does it have syntax errors?): No module named
bookmarks.settings"

What is the PythonPath meant to point to?

My Python code is in C:\Python.
My Python installation is in C:\Python25\
The location of python.exe is on my system PATH


--~--~-~--~~~---~--~~
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: Apache + Django - syntax error

2007-08-29 Thread daev

Try simple:
PythonPath "C:\Python"


--~--~-~--~~~---~--~~
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 1 debugging in pydev with breakpoints

2007-08-29 Thread Peter Melvyn

On 8/29/07, Rufman <[EMAIL PROTECTED]> wrote:

> does anyone have an idea how i can set breakpoint while debugging in
> pydev. i got the dev server to work from inside eclipse but breakpoint
> don't seem to work.

You need to configure and run dev server first (F9), then break its
execution using red box in Console window. Now you can issue command
'Debug last launched' (F11).

see http://www.fabioz.com/pydev/manual_101_run.html

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



Re: Reutilizing views

2007-08-29 Thread Etienne Robillard

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



Hi Grupo, 

I think it would be better not using the minus sign for naming your
front page function. Also, dont put weird attributes directly in a view,
but instead use a dictionary in your urls.py (read "Passing extra options to 
view
functions in url_dispatch.txt). 

Here's a quick rewrite for the records:

def myview(request, *args, **kwargs):
if kwargs['returnHttp']:
   # do stuff here
   ...

Cheers,

Etienne

On Wed, 29 Aug 2007 04:09:42 -0700
Grupo Django <[EMAIL PROTECTED]> wrote:

> 
> Hello, I'd like to know if there is some way for reutilizing a view.
> 
> In my case, I have an application to show some data, but I want to
> show the same data in the front page, among other data from other
> models.
> Well, I have figured out this method:
> 
> def myview(request, returnHTTP=True):
> t = loader.get_template('template.html')
> ...
> c = RequestContext(request,{ 'data':data })
> if returnHTTP:
> return HttpResponse(t.render(c))
> else:
> return data
> 
> and in the view of the front page:
> 
> def front-page(request):
> from someApp.views import myview
> data = myview(request,False)
> 
> 
> Is this ok? Perhaps there is a better way of doing it with django.
> Thank you very much.
> 
> 
> > 
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.5 (FreeBSD)

iEYEARECAAYFAkbVZvUACgkQdXKAffkXj4MQ/ACfT+ZbiErc/hgzo3wnJWvn/za8
QLkAn3PJ0GeB0E47KRR9phbMgotv6F2t
=ayKi
-END PGP SIGNATURE-

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



HttpMethodsMiddleware and mod_python (REST)

2007-08-29 Thread David Larlet

Hello all,

I wonder if there is an alternative of the HttpMethodsMiddleware
snippet http://www.djangosnippets.org/snippets/174/ which works with
mod_python because for the moment it raises an AttributeError when you
try to modify the request.method:

request.method = request.REQUEST[_MIDDLEWARE_KEY].upper()
AttributeError: can't set attribute

Any thoughts?

Regards,
David

--~--~-~--~~~---~--~~
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: Apache + Django - syntax error

2007-08-29 Thread b3n

Still says a syntax error when I navigate to http://localhost/

MOD_PYTHON ERROR

ProcessId:  1420
Interpreter:'localhost'

ServerName: 'localhost'
DocumentRoot:   'C:/xampp/htdocs'

URI:'/'
Location:   '/'
Directory:  None
Filename:   'C:/xampp/htdocs/'
PathInfo:   ''

Phase:  'PythonHandler'
Handler:'django.core.handlers.modpython'

Traceback (most recent call last):
  File "C:\Python25\lib\site-packages\mod_python\importer.py", line
1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
  File "C:\Python25\lib\site-packages\mod_python\importer.py", line
1186, in _process_target
newpath = eval(pathstring)
  File "", line 1
C:\Python
 ^
SyntaxError: invalid syntax


--~--~-~--~~~---~--~~
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: Reutilizing views

2007-08-29 Thread Grupo Django

Thanks Etienne!
By the way, the minus sign in the view was a mistake, I wanted to
write front_page. Anyway, it was just an example, in my case, the view
is called 'portada' = 'front page' in Spanish :-)

Thanks.

On 29 ago, 14:30, Etienne Robillard <[EMAIL PROTECTED]>
wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi Grupo,
>
> I think it would be better not using the minus sign for naming your
> front page function. Also, dont put weird attributes directly in a view,
> but instead use a dictionary in your urls.py (read "Passing extra options to 
> view
> functions in url_dispatch.txt).
>
> Here's a quick rewrite for the records:
>
> def myview(request, *args, **kwargs):
> if kwargs['returnHttp']:
># do stuff here
>...
>
> Cheers,
>
> Etienne
>
> On Wed, 29 Aug 2007 04:09:42 -0700
>
>
>
> Grupo Django <[EMAIL PROTECTED]> wrote:
>
> > Hello, I'd like to know if there is some way for reutilizing a view.
>
> > In my case, I have an application to show some data, but I want to
> > show the same data in the front page, among other data from other
> > models.
> > Well, I have figured out this method:
>
> > def myview(request, returnHTTP=True):
> > t = loader.get_template('template.html')
> > ...
> > c = RequestContext(request,{ 'data':data })
> > if returnHTTP:
> > return HttpResponse(t.render(c))
> > else:
> > return data
>
> > and in the view of the front page:
>
> > def front-page(request):
> > from someApp.views import myview
> > data = myview(request,False)
>
> > Is this ok? Perhaps there is a better way of doing it with django.
> > Thank you very much.
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2.0.5 (FreeBSD)
>
> iEYEARECAAYFAkbVZvUACgkQdXKAffkXj4MQ/ACfT+ZbiErc/hgzo3wnJWvn/za8
> QLkAn3PJ0GeB0E47KRR9phbMgotv6F2t
> =ayKi
> -END PGP SIGNATURE-


--~--~-~--~~~---~--~~
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: count() causes QuerySet re-evaluation?

2007-08-29 Thread Russell Keith-Magee

On 8/29/07, Bjorn Ruud <[EMAIL PROTECTED]> wrote:
>
> The pool QuerySet gets re-evaluated when the count() in the loop is
> run. Since one of the fields in the filter gets changed, the amount of
> objects in the QuerySet will be different. If pool.count() is replaced
> with len(pool) this does not happen. Is this intended behaviour? Can a
> QuerySet be made immutable?

This behaviour is by design.

queryset.count() actually constructs (and executes) a new 'SELECT
COUNT(*) FROM table' query. This means that it will always return the
current number of objects matching the query. In your case, the number
of objects is changing, so count() will return a different value each
time.

len(queryset) returns the length of the evaluated queryset. When the
queryset is evaluated for the first time, it will act as a cache, so
all calls to len(queryset) will return the same value.

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: Apache + Django - syntax error

2007-08-29 Thread b3n

Hey I managed to get Apache to find Django!


SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['C:\Python'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE bookmarks.settings
PythonDebug On


Now I get a nice Django-styled error instead of the crappy mod_python
one ;)

OperationalError at /
(2003, "Can't connect to MySQL server on 'localhost' (10061)")

Sooo... where do I setup the db? Shouldn't that be left to my project?



--~--~-~--~~~---~--~~
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: foreign keys between different application models

2007-08-29 Thread Russell Keith-Magee

On 8/29/07, Graham Carlyle <[EMAIL PROTECTED]> wrote:
>
> So should models in different application's never have foreign key
> dependencies and so i should bring them back to one application? or does
> anyone know if there is another way around this problem?

Models can and should have foreign key dependencies on other models.
The issue here is entirely with the reset command, which is broken as
currently implemented for many foreign key situations, including the
one you describe.

There are 2 options for workarounds:
1) use SQL ALTER statements rather than resetting the table. This
requires writing manual SQL statements to modify the existing tables
2) Drop the entire database and start again from scratch

2 is the easier option, but isn't viable if you have data that cannot
be lost. However, if you are in the initial phases of development, it
should be all you need.

There are a number of efforts underway working on schema evolution,
which would be the 'django syntax' way of performing the equivalent of
option 1. If one of these ever reaches trunk, I would expect that the
reset command would be deprecated and removed.

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: Django Development Position

2007-08-29 Thread Josh Trutwin

On Wed, 29 Aug 2007 13:33:50 +0530
Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:

> given the international nature of this list, it would be best for
> all job posters to follow the most sensible procedure - very brief  
> description of the job and a pointer to a web page that gives full  
> details. It helps the SNR and also avoids stepping on toes.

Wonder if django could do the same thing PostgreSQL and a few other
OSS tools do and setup a separate django-jobs list?

Josh 

--~--~-~--~~~---~--~~
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: Apache + Django - syntax error

2007-08-29 Thread b3n

Ahh never mind.

I hadn't started the MySQL server. Doh.


--~--~-~--~~~---~--~~
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.core.management.dump_data gone into management.commands - but how to address it?

2007-08-29 Thread Russell Keith-Magee

On 8/29/07, Ulf Kronman <[EMAIL PROTECTED]> wrote:
>
> I've been using some borrowed code snippets to make a script that
> saves data from my PostgreSQL database, and now the script has stopped
> working since I last updated the Django code.
>
> This is how I used to do it:
>
> from django.core import management
> str_kth_data = management.dump_data(['kth'], format='json', indent=2)

Rather than call the command directly, you now go through the
management interface and invoke the command by name:

>>> management.call_command('dumpdata', 'kth', format='json', indent=2)

This will ultimately allow end users to register their own commands
with the management application.

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: django.core.management.dump_data gone into management.commands - but how to address it?

2007-08-29 Thread Ulf Kronman

Hi Russ,

> Rather than call the command directly, you now go through the
> management interface and invoke the command by name:
> >>> management.call_command('dumpdata', 'kth', format='json', indent=2)

Thanks for an *extremely* fast support response. Fantastic!

Is there any documentation on this change around yet?

Thanks,
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: Reutilizing views

2007-08-29 Thread Etienne Robillard

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


You're welcome, and thanks for the Spanish tip.. 

(I thought entrada was the appropriate word for front door,
but my Spanish skills arent very sharp..)  

Have to go catch a bus now.. =] 

Gracias,
Etienne 

On Wed, 29 Aug 2007 05:45:41 -0700
Grupo Django <[EMAIL PROTECTED]> wrote:

> 
> Thanks Etienne!
> By the way, the minus sign in the view was a mistake, I wanted to
> write front_page. Anyway, it was just an example, in my case, the view
> is called 'portada' = 'front page' in Spanish :-)
> 
> Thanks.
> 
> On 29 ago, 14:30, Etienne Robillard <[EMAIL PROTECTED]>
> wrote:
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
> >
> > Hi Grupo,
> >
> > I think it would be better not using the minus sign for naming your
> > front page function. Also, dont put weird attributes directly in a view,
> > but instead use a dictionary in your urls.py (read "Passing extra options 
> > to view
> > functions in url_dispatch.txt).
> >
> > Here's a quick rewrite for the records:
> >
> > def myview(request, *args, **kwargs):
> > if kwargs['returnHttp']:
> ># do stuff here
> >...
> >
> > Cheers,
> >
> > Etienne
> >
> > On Wed, 29 Aug 2007 04:09:42 -0700
> >
> >
> >
> > Grupo Django <[EMAIL PROTECTED]> wrote:
> >
> > > Hello, I'd like to know if there is some way for reutilizing a view.
> >
> > > In my case, I have an application to show some data, but I want to
> > > show the same data in the front page, among other data from other
> > > models.
> > > Well, I have figured out this method:
> >
> > > def myview(request, returnHTTP=True):
> > > t = loader.get_template('template.html')
> > > ...
> > > c = RequestContext(request,{ 'data':data })
> > > if returnHTTP:
> > > return HttpResponse(t.render(c))
> > > else:
> > > return data
> >
> > > and in the view of the front page:
> >
> > > def front-page(request):
> > > from someApp.views import myview
> > > data = myview(request,False)
> >
> > > Is this ok? Perhaps there is a better way of doing it with django.
> > > Thank you very much.
> >
> > -BEGIN PGP SIGNATURE-
> > Version: GnuPG v2.0.5 (FreeBSD)
> >
> > iEYEARECAAYFAkbVZvUACgkQdXKAffkXj4MQ/ACfT+ZbiErc/hgzo3wnJWvn/za8
> > QLkAn3PJ0GeB0E47KRR9phbMgotv6F2t
> > =ayKi
> > -END PGP SIGNATURE-
> 
> 
> > 
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.5 (FreeBSD)

iEYEARECAAYFAkbVdyUACgkQdXKAffkXj4NceQCfQ/r5hqK8YgkQ64f18oVteZkC
IUkAnRnSIAQP6hafuf0nK0TE/Kcj9vRy
=eQft
-END PGP SIGNATURE-

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



non unicode

2007-08-29 Thread Robin Becker

Hi, we're having some troubles with latest django that are caused by the switch 
to unicode string output. In particular since we were already carefully 
handling 
the conversion and encoding of the database values we are now getting errors 
because the data is in unicode. Is it possible to disable the unicode 
conversion?
-- 
Robin Becker

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



Multiple Django sites under Apache 2 on RHEL4 ?

2007-08-29 Thread b3n

I did search first and read a few threads but I'm still confused.

We have a dedicated server running RHEL ES4 . We have about 10 simple
PHP sites on there, under Apache.

I want to start using Django for some sites (I wont mix PHP and
Python).

What is the right way to set this up? I've been making good progress
with learning Django but now I want to try and put it on our live
server and start testing things in a "real" environment. It all seems
very complicated.

I gather it's better performance-wise to use FastCGI ? But I think I
read somewhere that RHEL 4 doesn't support FastCGI.

I suppose using multiple  + interpreters would be ok if we
only have a few Django sites.

I'm also wanting to install Lighttpd to use as static media server  -
could that also be used to run all of the Django sites? Would that be
better?

Any suggestions?

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



django.core.management.dump_data gone into management.commands - but how to address it?

2007-08-29 Thread Ulf Kronman

Hi all,
I've been using Django for building an application containing
information about my university's scientific publications, and I'm
quite impressed with it.

I've been using some borrowed code snippets to make a script that
saves data from my PostgreSQL database, and now the script has stopped
working since I last updated the Django code.

This is how I used to do it:

from django.core import management
str_kth_data = management.dump_data(['kth'], format='json', indent=2)

There is a report (http://code.djangoproject.org/changeset/5898) that
these management commands have been moved into separate modules:
"Major refactoring of django.core.management -- it's now a package
rather than a 1730-line single module. All django-admin/manage.py
commands are now stored in separate modules. This is backwards-
incompatible for people who used django.core.management functions
directly "

But how do I import the dump_data function from this new structure
that looks like this:
django/core/management/commands/dumpdata.py ?

Sorry if this is a newbie Python question, but I'm quite lost here. I
have looked into the source of dumpdata.py, but can't find anything
that resembles dump_data there.

Kind regards,
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: Reutilizing views

2007-08-29 Thread Grupo Django

You are right, entrada is front door, but front page is portada, the
front page of a magazine or a newspaper is called portada, and the
entrance or front door of a house entrada :-)

On 29 ago, 15:39, Etienne Robillard <[EMAIL PROTECTED]>
wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> You're welcome, and thanks for the Spanish tip..
>
> (I thought entrada was the appropriate word for front door,
> but my Spanish skills arent very sharp..)
>
> Have to go catch a bus now.. =]
>
> Gracias,
> Etienne
>
> On Wed, 29 Aug 2007 05:45:41 -0700
>
>
>
> Grupo Django <[EMAIL PROTECTED]> wrote:
>
> > Thanks Etienne!
> > By the way, the minus sign in the view was a mistake, I wanted to
> > write front_page. Anyway, it was just an example, in my case, the view
> > is called 'portada' = 'front page' in Spanish :-)
>
> > Thanks.
>
> > On 29 ago, 14:30, Etienne Robillard <[EMAIL PROTECTED]>
> > wrote:
> > > -BEGIN PGP SIGNED MESSAGE-
> > > Hash: SHA1
>
> > > Hi Grupo,
>
> > > I think it would be better not using the minus sign for naming your
> > > front page function. Also, dont put weird attributes directly in a view,
> > > but instead use a dictionary in your urls.py (read "Passing extra options 
> > > to view
> > > functions in url_dispatch.txt).
>
> > > Here's a quick rewrite for the records:
>
> > > def myview(request, *args, **kwargs):
> > > if kwargs['returnHttp']:
> > ># do stuff here
> > >...
>
> > > Cheers,
>
> > > Etienne
>
> > > On Wed, 29 Aug 2007 04:09:42 -0700
>
> > > Grupo Django <[EMAIL PROTECTED]> wrote:
>
> > > > Hello, I'd like to know if there is some way for reutilizing a view.
>
> > > > In my case, I have an application to show some data, but I want to
> > > > show the same data in the front page, among other data from other
> > > > models.
> > > > Well, I have figured out this method:
>
> > > > def myview(request, returnHTTP=True):
> > > > t = loader.get_template('template.html')
> > > > ...
> > > > c = RequestContext(request,{ 'data':data })
> > > > if returnHTTP:
> > > > return HttpResponse(t.render(c))
> > > > else:
> > > > return data
>
> > > > and in the view of the front page:
>
> > > > def front-page(request):
> > > > from someApp.views import myview
> > > > data = myview(request,False)
>
> > > > Is this ok? Perhaps there is a better way of doing it with django.
> > > > Thank you very much.
>
> > > -BEGIN PGP SIGNATURE-
> > > Version: GnuPG v2.0.5 (FreeBSD)
>
> > > iEYEARECAAYFAkbVZvUACgkQdXKAffkXj4MQ/ACfT+ZbiErc/hgzo3wnJWvn/za8
> > > QLkAn3PJ0GeB0E47KRR9phbMgotv6F2t
> > > =ayKi
> > > -END PGP SIGNATURE-
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2.0.5 (FreeBSD)
>
> iEYEARECAAYFAkbVdyUACgkQdXKAffkXj4NceQCfQ/r5hqK8YgkQ64f18oVteZkC
> IUkAnRnSIAQP6hafuf0nK0TE/Kcj9vRy
> =eQft
> -END PGP SIGNATURE-


--~--~-~--~~~---~--~~
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: UnicodeDecodeError with memcache

2007-08-29 Thread Jeremy Dunck

On 8/29/07, Michael Radziej <[EMAIL PROTECTED]> wrote:
>
> On Wed, Aug 29, patrickk wrote:
>
> >
> > I just changed
> > self._cache.set(key, value, timeout or self.default_timeout)
> > to
> > self._cache.set(smart_str(key), value, timeout or
> > self.default_timeout)
> > in memcached.py
> > and it seems to work.
> >
> > Don´t know if that´s a proper solution though.
>
> Me either ;-) It's probably not the full solution.
>
> But please file a ticket so this doesn't get lost (with reference to this
> thread).

Well, this is the error I suspected, but it now occurs to me that I'm
not sure what version or rev of Django is being used here.

Trunk already had this fixed:
http://code.djangoproject.com/changeset/5718

patrickk, if you're trying to use unicode (especially urls) without
using a version after rev 5609 (0.96 was something like rev 4800),
then you're likely to run into other problems.

--~--~-~--~~~---~--~~
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: Choices cannot be marked for translation?

2007-08-29 Thread Michael Radziej

On Wed, Aug 29, Jarek Zgoda wrote:

> 
> Kenneth Gonsalves napisał(a):
> 
> >>> now, this doesnt work - when I remove the _(), then the choices
> >>> appear. How do I then mark them for translation?
> >>>
> >> Make sure to use gettext_lazy
> > i *am* using: from django.utils.translation import gettext_lazy  
> > as _
>  Ha! How should we know?
> 
>  Does it help to use ugettext_lazy instead?
> >>> doesnt work - i just marked one string, the marked string didnt
> >>> appear, the other two did.
> >> The next testing option is to try with non-lazy version.
> > 
> > that works! import gettext as _
> 
> And that's a real bug, I think.
> 
> Anyway, for future reference, keep in mind that lazily translated
> "strings" become real strings at access time. Before that they are
> function objects. That is, you cann't, for example, pickle them - and in
> consequence put in session because session data is pickled before
> saving. Laziness isn't always good. ;)

If I haven't mistaken anything, we're talking about the choices setting in
model fields. The models are read in during initialization. But the choices
need to be translated for each request, and for different languages. I don't
see how this could work without lazy translation, and I'd be astonished if
the solution above really worked.

Michael


-- 
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100
http://www.noris.de - The IT-Outsourcing Company
 
Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk - 
Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689

--~--~-~--~~~---~--~~
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: UnicodeDecodeError with memcache

2007-08-29 Thread patrickk

I´m on revision 5646


On 29 Aug., 16:57, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> On 8/29/07, Michael Radziej <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > On Wed, Aug 29, patrickk wrote:
>
> > > I just changed
> > > self._cache.set(key, value, timeout or self.default_timeout)
> > > to
> > > self._cache.set(smart_str(key), value, timeout or
> > > self.default_timeout)
> > > in memcached.py
> > > and it seems to work.
>
> > > Don´t know if that´s a proper solution though.
>
> > Me either ;-) It's probably not the full solution.
>
> > But please file a ticket so this doesn't get lost (with reference to this
> > thread).
>
> Well, this is the error I suspected, but it now occurs to me that I'm
> not sure what version or rev of Django is being used here.
>
> Trunk already had this fixed:http://code.djangoproject.com/changeset/5718
>
> patrickk, if you're trying to use unicode (especially urls) without
> using a version after rev 5609 (0.96 was something like rev 4800),
> then you're likely to run into other problems.


--~--~-~--~~~---~--~~
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: non unicode

2007-08-29 Thread Malcolm Tredinnick

On Thu, 2007-08-30 at 00:52 +1000, Malcolm Tredinnick wrote:
> On Wed, 2007-08-29 at 14:58 +0100, Robin Becker wrote:
> > Hi, we're having some troubles with latest django that are caused by the 
> > switch 
> > to unicode string output. In particular since we were already carefully 
> > handling 
> > the conversion and encoding of the database values we are now getting 
> > errors 
> > because the data is in unicode. Is it possible to disable the unicode 
> > conversion?
> 
> No, it's not possible. The assumptions that strings will already be
> Unicode is fairly tightly inter-twined throughout the code. To do
> otherwise would, for example, really impact performance because we would
> *never* be able to assume that things were in the right encoding and
> have to call smart_unicode() everywhere -- the function call overhead
> would be noticeable (I say this from having tested it).

 Thinking about this for a few minutes more, it might be possible to do
a workaround (not something I'd want to put in core, but it might work
for your current purposes until binary data transmission is possible).
This is only for the database barrier and assuming you are pretty much
going from database to models and not doing much else with that data
without massaging it further. If you are doing other stuff (particularly
sending to templates), things will behave unexpectedly because your
encoding won't be UTF-8 (if it was UTF-8, Unicode would just work) and
Django has the requirement that bytestrings are UTF-8 encoded.

Take one of the existing database backends -- whichever one you're using
-- and remove all the setting up of Unicode encoding and decoding. This
probably means removing any setting that would return the strings as
Unicode (e.g. use_unicode in mysql, the Unicode extension in
postgresql_psycopg2, the typecast_string function in postgresql, etc)
and anything that converts *to* UTF-8 for transmission to the database.

The net effect here would be that models are created with raw
bytestrings in whatever format they are returned from the database. 

Again, this is not a "correct" solution, because it breaks violates some
internal invariants. But it might be sufficient for your requirements
for the moment if you understand where those invariants are required.

Regards,
Malcolm


-- 
Quantum mechanics: the dreams stuff is made of. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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: non unicode

2007-08-29 Thread Michael Radziej

On Wed, Aug 29, Robin Becker wrote:

> 
> Hi, we're having some troubles with latest django that are caused by the 
> switch 
> to unicode string output. In particular since we were already carefully 
> handling 
> the conversion and encoding of the database values we are now getting errors 
> because the data is in unicode. Is it possible to disable the unicode 
> conversion?

No. There's really no such thing as "unicode string output", it's
rather using unicode for accessing the database interface. Actually, the
switch was required since newforms left unicode strings in the model
attributes, so there was no way to use newforms with non-ASCII characters.

Have you seen the hints at
http://www.djangoproject.com/documentation/unicode/
? They should cover all required modifications of your code.


Michael

-- 
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100
http://www.noris.de - The IT-Outsourcing Company
 
Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk - 
Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689

--~--~-~--~~~---~--~~
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: foreign keys between different application models

2007-08-29 Thread Graham Carlyle

On Wed, 2007-08-29 at 21:12 +0800, Russell Keith-Magee wrote:
> There are 2 options for workarounds:
> 1) use SQL ALTER statements rather than resetting the table. This
> requires writing manual SQL statements to modify the existing tables
> 2) Drop the entire database and start again from scratch
> 
> 2 is the easier option, but isn't viable if you have data that cannot
> be lost. However, if you are in the initial phases of development, it
> should be all you need.

Cool, thanks for the speedy and clear response

Yes i am in the initial development phase at the moment and so option 2)
is much more attractive. 

I was hoping something similar would be tenable for the production phase
as well... just dumping the data and then re-loading after recreating
the database, with some possible data munging if the schema has changed
in an incompatible way. For my project the downtime for the
dump/rebuild/load cycle should be short. Also I'm imagining scripts to
modify yaml will be more straightforward & flexible than doing any
manipulation with SQL.

Does anybody think this is a reasonable solution or am i missing
something?

A bash script along the lines of this is what I think would work...
--
DATA_APPS="auth foo bar"
mkdir -p upgrades
TMPDIR=`mktemp -d -p upgrades`
for app in $DATA_APPS; do
./manage.py dumpdata --format=yaml $app > $TMPDIR/$app.yaml
done
sudo su - postgres -c "dropdb mydb"
sudo su - postgres -c "createdb mydb"
./manage.py syncdb --noinput
for app in $DATA_APPS; do
./manage.py loaddata --format=yaml $TMPDIR/$app.yaml
done
--

cheers,
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: UnicodeDecodeError with memcache

2007-08-29 Thread patrickk

I´ll do a django-update on the weekend.
If the problem still exists, I´ll post here again.

Thanks for the answers,
Patrick

On 29 Aug., 17:06, patrickk <[EMAIL PROTECTED]> wrote:
> I´m on revision 5646
>
> On 29 Aug., 16:57, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
>
> > On 8/29/07, Michael Radziej <[EMAIL PROTECTED]> wrote:
>
> > > On Wed, Aug 29, patrickk wrote:
>
> > > > I just changed
> > > > self._cache.set(key, value, timeout or self.default_timeout)
> > > > to
> > > > self._cache.set(smart_str(key), value, timeout or
> > > > self.default_timeout)
> > > > in memcached.py
> > > > and it seems to work.
>
> > > > Don´t know if that´s a proper solution though.
>
> > > Me either ;-) It's probably not the full solution.
>
> > > But please file a ticket so this doesn't get lost (with reference to this
> > > thread).
>
> > Well, this is the error I suspected, but it now occurs to me that I'm
> > not sure what version or rev of Django is being used here.
>
> > Trunk already had this fixed:http://code.djangoproject.com/changeset/5718
>
> > patrickk, if you're trying to use unicode (especially urls) without
> > using a version after rev 5609 (0.96 was something like rev 4800),
> > then you're likely to run into other problems.


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



django guru wanted

2007-08-29 Thread Stephen Phillips


i need a django guru to get our development team up and moving quickly

2-4 week contract - brisbane australia - will fly in / fly out -
accommodation included - top dollar for the right guy

major new australian news site

mysql / lucene skills useful

will consider applicants from usa / uk / australia


--~--~-~--~~~---~--~~
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: non unicode

2007-08-29 Thread Malcolm Tredinnick

On Wed, 2007-08-29 at 14:58 +0100, Robin Becker wrote:
> Hi, we're having some troubles with latest django that are caused by the 
> switch 
> to unicode string output. In particular since we were already carefully 
> handling 
> the conversion and encoding of the database values we are now getting errors 
> because the data is in unicode. Is it possible to disable the unicode 
> conversion?

No, it's not possible. The assumptions that strings will already be
Unicode is fairly tightly inter-twined throughout the code. To do
otherwise would, for example, really impact performance because we would
*never* be able to assume that things were in the right encoding and
have to call smart_unicode() everywhere -- the function call overhead
would be noticeable (I say this from having tested it).

I'd like to hear details of what the actual problems are, so that we can
fix things rather than trying to hide them. I'm not going to be able to
work on anything like this for a little while (partly because of a
commitment to get some other code finished urgently), but we should fix
any difficulties.

I'm not going to be too surprised to hear that it's something like
trying to use binary-like data in text fields -- getting a proper binary
field and, most importantly, getting transparent transmission to and
from the database in play is a pretty big priority once I have time.
It's not completely trivial, but, again, a clear description of the
problems you are having might help guide the design. That will, in
effect, provide a way to have deliberately unencoded data in both a
designated binary field and also available for any custom field types
and should solve some problems I suspect exist.

Regards,
Malcolm


-- 
Why can't you be a non-conformist like everyone else? 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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: caching and authentication

2007-08-29 Thread Jeremy Dunck

It's clear to me that the docs involving patch_vary_header, cache_page
and the cache middleware need to be improved.

I'm using this thread as proof.  :)

The cache_page decorator is actually just a wrapper around the cache
middleware; think of it as view-specific application ofthe cache
middleware.

In any case, the patch_vary_headers *should* work with the cache_page
decorator; the decorator forms the cache key based on the response.
This is a separate problem from the unicode issue.

Can you provide any info on what isn't working as expected with the
patch_vary_headers call?


On 8/29/07, patrickk <[EMAIL PROTECTED]> wrote:
>
> I´ve been too optimistic - the above code doesn´t work.
> (This whole caching-issue gives me the willies)
>
> On 29 Aug., 12:21, patrickk <[EMAIL PROTECTED]> wrote:
> > it´s a bit late, but I just wanted to tell that it works with
> > patch_vary_headers.
> > in my opinion, this could be explained better in the docs.
> >
> > so, if one uses a page based on user-authentication and wants to cache
> > that page using the cache_page decorator, here´s the code:
> >
> > def my_view(request):
> > 
> >
> > response = render_to_response('site/whatever/template.html', {
> > ...
> > }, context_instance=RequestContext(request) )
> > patch_vary_headers(response, ['Cookie'])
> > return response
> > my_view = cache_page(may_view, 60 * 15)
> >
> > thanks,
> > patrick
> >
> > On 8 Jul., 01:18, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> >
> > > On 7/7/07, patrick k. <[EMAIL PROTECTED]> wrote:
> >
> > > > I don´t understand why the page_cache is keyed by the vary header and
> > > > the view_cache is not. is there a reason for this?
> >
> > > You mean cache_page rather than page_cache, but what is view_cache?
> >
> > > I think I may have spotted the problem: the cache_page decorator runs
> > > before the Vary header gets patched for the session access.
> >
> > > As a test, just before you return your HttpResponse, try adding this
> > > to one of your auth views, and try to use the cache_page decorator:
> >
> > > from django.utils.cacheimport patch_vary_headers
> > > patch_vary_headers(response, ('Cookie',))
> >
> > > (Maye sure to dump yourcachefirst, too.)
>
>
> >
>

--~--~-~--~~~---~--~~
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: Anyone built a django site in Welsh?

2007-08-29 Thread Matt Davies
got it

cocoa was showing everything in the mysql as utf8, but the tables themselves
were latin1

:-)

wicked, I now have the great job of turning it all back, setting it to not
create as Latin1 in the future, check all the data

thanks for your help everyone, not a django problem, an mysql one



On 29/08/2007, Matt Davies <[EMAIL PROTECTED]> wrote:
>
> Hi Jarek
>
> Yep, got that line in my.cnf, my cocoa Show Variables are all utf8.
>
> curl tells me it's utf8, request.meta tells me it's utf8, bit it really
> doesn't look like it is utf8
>
> any more suggestions anyone?
>
> On 29/08/2007, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
> >
> >
> > Matt Davies napisał(a):
> >
> > > yeah mate, everything I can think of is set to utf-8 and unicode as
> > > explained here
> > >
> > > How did you get that character into the database?
> > >
> > > Did you add it to a web form and put it in like that?
> > >
> > > If so, did you type the character, or did you copy and paste it from
> > > somewhere else?
> > >
> > > Sorry to be a pain mate, but it'll really help me out if I can work
> > out
> > > whats going on here.
> > >
> > > Interestingly enough only those two characters mess up, the others
> > with
> > > circumflexes are fine.
> >
> > Are you sure your MySQL client sets proper charset on connection? From
> > the docs at
> >
> > http://www.djangoproject.com/documentation/databases/#connecting-to-the-database
> > - check if the last line of example MySQL config file is in place. From
> > your description it looks that the client encoding is set to latin1.
> >
> > --
> > Jarek Zgoda
> > Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101
> >
> > "We read Knuth so you don't have to." (Tim Peters)
> >
> > > >
> >
>

--~--~-~--~~~---~--~~
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 1 debugging in pydev with breakpoints

2007-08-29 Thread Bob T.

You'll need to run the development server using the debug button from
within Eclipse, like you're probably already doing. Be sure to add
the  --noreload parameter to your manage.py runserver. command.

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: caching and authentication

2007-08-29 Thread patrickk

thanks jeremy.

answer to "what isn´t working":
on the top of each page, we have two links which depend on whether the
user is authenticated or not.
either: username / logout (if authenticated)
or: login / register (if not authenticated)

when I use cache_page (with or without patch_vary_headers resp.
vary_on_headers('Cookie')) my username is still displayed when I´m
logged out (and also the other way round).

patrick.

On 29 Aug., 17:33, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> It's clear to me that the docs involving patch_vary_header, cache_page
> and the cache middleware need to be improved.
>
> I'm using this thread as proof.  :)
>
> The cache_page decorator is actually just a wrapper around the cache
> middleware; think of it as view-specific application ofthe cache
> middleware.
>
> In any case, the patch_vary_headers *should* work with the cache_page
> decorator; the decorator forms the cache key based on the response.
> This is a separate problem from the unicode issue.
>
> Can you provide any info on what isn't working as expected with the
> patch_vary_headers call?
>
> On 8/29/07, patrickk <[EMAIL PROTECTED]> wrote:
>
>
>
> > I´ve been too optimistic - the above code doesn´t work.
> > (This whole caching-issue gives me the willies)
>
> > On 29 Aug., 12:21, patrickk <[EMAIL PROTECTED]> wrote:
> > > it´s a bit late, but I just wanted to tell that it works with
> > > patch_vary_headers.
> > > in my opinion, this could be explained better in the docs.
>
> > > so, if one uses a page based on user-authentication and wants to cache
> > > that page using the cache_page decorator, here´s the code:
>
> > > def my_view(request):
> > > 
>
> > > response = render_to_response('site/whatever/template.html', {
> > > ...
> > > }, context_instance=RequestContext(request) )
> > > patch_vary_headers(response, ['Cookie'])
> > > return response
> > > my_view = cache_page(may_view, 60 * 15)
>
> > > thanks,
> > > patrick
>
> > > On 8 Jul., 01:18, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
>
> > > > On 7/7/07, patrick k. <[EMAIL PROTECTED]> wrote:
>
> > > > > I don´t understand why the page_cache is keyed by the vary header and
> > > > > the view_cache is not. is there a reason for this?
>
> > > > You mean cache_page rather than page_cache, but what is view_cache?
>
> > > > I think I may have spotted the problem: the cache_page decorator runs
> > > > before the Vary header gets patched for the session access.
>
> > > > As a test, just before you return your HttpResponse, try adding this
> > > > to one of your auth views, and try to use the cache_page decorator:
>
> > > > from django.utils.cacheimport patch_vary_headers
> > > > patch_vary_headers(response, ('Cookie',))
>
> > > > (Maye sure to dump yourcachefirst, too.)


--~--~-~--~~~---~--~~
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: UnicodeDecodeError with memcache

2007-08-29 Thread Iapain

> patrickk, I'm not sure what lapain's experience with unicode is, but
> please disregard the advice to switch defaultencoding to utf-8.

I didnt want this either, but some time you have to toil a bit for
debugging. I suggested him to use smart_str in post1, because i am
aware of recently merger of unicode branch but probably he wasnt or
using old version.


--~--~-~--~~~---~--~~
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 search does not work in my models

2007-08-29 Thread Ariel Mauricio Nunez Gomez
Hello people,

Summary:
Django admin search returns all results in my models. (in auth.user, search
works ok)

Context:
I'm using revision 6023 from trunk, using Postgresql 8.2 with psycopg2 on an
Ubuntu Feisty 7.04 Box.

Model:
Using a simple model:

from django.db import models

# Create your models here.
class Business(models.Model):
business_name = models.CharField(max_length=50)
employees = models.IntegerField()
text = models.TextField()
def __unicode__(self):
return "%s %s %s" % (self.business_name, self.employees, self.text)
class Admin:
list_display = ('business_name', 'employees', 'text',)
search_fields = ('business_name')
list_filter = ('business_name',)

Observations:
I looked at the generated ur, when I search in my model:
http://localhost/admin/test/business/?e=1
and when I search in user:
http://moteserver/admin/auth/user/?q=ariel

If I apply a query in the url, like this:
http://localhost/admin/test/business/?q=testing
It displays everythin and changes to,
http://localhost/admin/test/business/?e=1

Does anybody know what can be happening?

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



Max. size of User.email is 75 chars

2007-08-29 Thread Peter Melvyn

Hi all,

I've a question, why max. size of User.email field is set to 75 characters,
if RFC 2821 limits local part to 64 characters and domain to 255.
With '@' it is together 320 chars.

Should not be this field extended?


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



@url tag - getting rid of urlpatterns

2007-08-29 Thread Ilya Semenov

I've been using django for almost a year and I was always frustrated
by its cumbersome urlpatterns system. While it is really flexible, it
doesn't provide any shortcuts for widely-used url and views naming
schemes.

Let me show in examples what I mean.

As everyone, I started with the tutorial and worked with the following
system:

=== urls.py ===
urlpatterns = patterns('',
(r'^$', 'apps.app1.views.index'),
(r'^news/$', 'apps.app1.views.news'),
(r'^members/profile/$', 'apps.app1.views.members.profile'),
(r'^members/secure/$', 'apps.app1.views.members.secure'),
(r'^app2/page/$', 'apps.app2.views.page'), # some other app
...
)

It becomes quite a large and hardy maintainable list when the number
of applications and views grows. I do believe in DRY principle and I
didn't like much that I had to repeat the URL bases and parent module
names again and again. So I kept reading the docs and involved the
system to the following:

=== urls.py ===
urlpatterns = patterns('',
(r'^', include('apps.app1.urls')),
(r'^app2', include('apps.app2.urls')),
)

=== apps/app1/urls/__init__.py ===
urlpatterns = patterns('apps.app1.views',
(r'^index/$', 'index'),
(r'^news/$', 'news'),
(r'^members', include('apps.app1.urls.members'),
)

=== apps/app1/urls/members.py ===
urlpatterns = patterns('apps.app1.views.members',
(r'^profile/$', 'profile'),
(r'^secure/$', 'secure'),
)

=== apps/app1/views/__init__.py ===
def index(request):
...
def news(request):
...

=== apps/app1/views/members.py ===
def profile(request):

def secure(request):
...

(I skipped app2.* files for easier reading)

While this system had less redundancy and easier to maintain (the DRY
benefits), it suffered from another DRY problem - there were two
packages with the same structure (apps.app1.urls.* and
apps.app1.views.*), with the highly related content. When I was
renaming a view, I had to browse through two package structures and
change the things twice. Still frustrating, you see.

So what I decided, why do we have to keep urlpatterns apart of the
views? Why wouldn't I put them in the same files? The architecture
became:

=== urls.py ===
urlpatterns = patterns('',
(r'^', include('apps.app1.views')), # note views, not urls
(r'^app2', include('apps.app2.views')),
)

=== apps/app1/views/__init__.py ===
urlpatterns = patterns(__name__, # sic!
(r'^index/$', 'index'),
(r'^news/$', 'news'),
(r'^members', include('apps.app1.views.members'),
)

def index(request):
...
def news(request):
...

=== apps/app1/views/members.py ===
urlpatterns = patterns(__name__,
(r'^profile/$', 'profile'),
(r'^secure/$', 'secure'),
)

def profile(request):

def secure(request):
...

This was a good change. I had 50% less files, and I put the related
info within the same modules. Also note the usage of __name__, which
increased the DRY factor a bit more :-)

Yet I wasn't fully satisfied. Whenever I renamed a view I had to patch
the urlpatterns as well.
I also remembered an old inconvenience I always felt with views
modules. If I place views functions in a views module, and place like
"normal" helper functions there as well, they got mixed. By looking at
the code it is sometimes hard to understand which function is a view,
and which function is a helper.
So what I created is the @url decorator which solved the both
problems:

=== urls.py ===
urlpatterns = patterns('',
(r'^', include('apps.app1.views')),
(r'^app2', include('apps.app2.views')),
)

=== apps/app1/views/__init__.py ===
@url(r'^index/$')
def index(request):
...

@url(r'^news/$')
def news(request):
...

urlpatterns += include_urlpatterns(r'^members',
'apps.app1.views.members')

=== apps/app1/views/members.py ===
@url(r'^profile/$)
def profile(request):


@url(r'^secure/$)
def secure(request):
...

@url(r'^path1/$', '^path2/$') # you can specify several patterns
def multipath_view(request):
...

def helper(): # easily distinguishable - no @url!
...

Summarizing, the benefits are:
- no more creating and supporting urlpattern maps (less files, less
code, more DRY)
- have the url associated with a view in-place
- easily see if a function is a view
- fully compatible with other chained decorators

Implementation problems, or possible improvements:
- it is hackish
- the speed isn't constant time, it is O(N) where N is the number of
currently loaded modules
- I would like to make it support the no-arguments syntax:

@url()
def profile(request):


and have the decorator automatically pull the function name as the url
pattern, but that doesn't seem possible if there are further
decorators (like @user_passes_test or @render_to)

The source code can be found at http://www.djangosnippets.org/snippets/395/


--~--~-~--~~---

Keeping track of the original values for a record...

2007-08-29 Thread [EMAIL PROTECTED]

Since there isn't a load() method on a model... I'm thinking I somehow
have to do this on the manager..but not sure ... any tips would be
great.

When I load a record, either via get() or by looping through the
results of a .filter(), I'd like to keep track of the original
attribute values via setting a custom property on that model which
would contain a dict of the attribute/value at the time the record was
loaded ...

This is basically so that when I save, I can compare the current
values with those of the original to see which values have changed,
and which haven't, which I need to know for some event logs I'm
writing out at save time.

Thanks for any info.


--~--~-~--~~~---~--~~
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: Keeping track of the original values for a record...

2007-08-29 Thread Jure Čuhalev

On 8/29/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Since there isn't a load() method on a model... I'm thinking I somehow
> have to do this on the manager..but not sure ... any tips would be
> great.
>
> When I load a record, either via get() or by looping through the
> results of a .filter(), I'd like to keep track of the original
> attribute values via setting a custom property on that model which
> would contain a dict of the attribute/value at the time the record was
> loaded ...
>
> This is basically so that when I save, I can compare the current
> values with those of the original to see which values have changed,
> and which haven't, which I need to know for some event logs I'm
> writing out at save time.
>
> Thanks for any info.
>

You could hook yourself to pre_save:

http://www.djangoproject.com/documentation/db-api/#what-happens-when-you-save

kr, jure

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



Forms, paging and pretty urls

2007-08-29 Thread Matt Haggard

How do you incorporate forms into pretty urls?

I have a paged list of things that you access with the following urls

/goals/page1/start35/
/goals/page2/start35/
/goals/page3/start35/

etc...

Doing links to the next and previous page is easy:
{% url ids.views.goals page_num=prev_page,start_num=start_num %}
{% url ids.views.goals page_num=next_page,start_num=start_num %}

But if I want to provide an input field to let them choose a page to
jump to, how would I implement that?

Go to page 


I can send it to the generic /goals/ page with POSTed data and handle
it just fine... but then I don't have the /goals/page#/start35/ url
anymore.

Any help?


--~--~-~--~~~---~--~~
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: Keeping track of the original values for a record...

2007-08-29 Thread [EMAIL PROTECTED]

Thanks..but I'm already overriding save, and creating an event
record... I need to know how to do something extra when the data is
loaded initially. I know I could query the record again into a new
object and use that for the original values..but that  seems pretty
hackish ...so I'd prefer to try and save off the original values into
a dict when the record gets loaded...

On Aug 29, 1:21 pm, "Jure Čuhalev" <[EMAIL PROTECTED]> wrote:
> On 8/29/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Since there isn't a load() method on a model... I'm thinking I somehow
> > have to do this on the manager..but not sure ... any tips would be
> > great.
>
> > When I load a record, either via get() or by looping through the
> > results of a .filter(), I'd like to keep track of the original
> > attribute values via setting a custom property on that model which
> > would contain a dict of the attribute/value at the time the record was
> > loaded ...
>
> > This is basically so that when I save, I can compare the current
> > values with those of the original to see which values have changed,
> > and which haven't, which I need to know for some event logs I'm
> > writing out at save time.
>
> > Thanks for any info.
>
> You could hook yourself to pre_save:
>
> http://www.djangoproject.com/documentation/db-api/#what-happens-when-...
>
> kr, jure


--~--~-~--~~~---~--~~
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: Keeping track of the original values for a record...

2007-08-29 Thread George Vilches

Jure Čuhalev wrote:
> On 8/29/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> Since there isn't a load() method on a model... I'm thinking I somehow
>> have to do this on the manager..but not sure ... any tips would be
>> great.
>>
>> When I load a record, either via get() or by looping through the
>> results of a .filter(), I'd like to keep track of the original
>> attribute values via setting a custom property on that model which
>> would contain a dict of the attribute/value at the time the record was
>> loaded ...
>>
>> This is basically so that when I save, I can compare the current
>> values with those of the original to see which values have changed,
>> and which haven't, which I need to know for some event logs I'm
>> writing out at save time.
>>
>> Thanks for any info.
>>
> 
> You could hook yourself to pre_save:
> 
> http://www.djangoproject.com/documentation/db-api/#what-happens-when-you-save

But by the time pre_save occurs, all the values have been changed, and 
you would have to perform another get() before you would have all the 
original values.  I don't think that's quite as good.

Something you could do is override the __set__ (or do the same via a 
descriptor), and from there you could easily populate your dict with 
original values.  Once there's a set value for each key, then don't 
populate the dict any more.  Off the cuff code:

d = {}
def __set__(self, obj, val):
 if obj not in d:
 d[obj] = val
 super(SomeClass, self).__set__(obj, val)

I have no idea if that works, but it's one possible starting point.  If 
you do manage to get this working, post your solution, I think this one 
might be a good starting point for those people who want to do the 
"change-only" query saves to the DB too.  (I know that there's a ticket 
somewhere in Trac that is related to that topic, but I'm too lazy to 
look it up).

Good luck,
gav

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

2007-08-29 Thread Kevin Menard

On 8/28/07, Alvaro Mouriño <[EMAIL PROTECTED]> wrote:
>
> Hi list,
>
> I have been running django under python 2.4 but now I'm considering
> switching to 2.5. Are there any known compatibility issues? Or is it
> just straightforward?

I've been running under 2.5 without any problems.  The same codebase
works under 2.4 as well.

-- 
Kevin

--~--~-~--~~~---~--~~
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: Keeping track of the original values for a record...

2007-08-29 Thread Doug B

You could probably use the post_init signal to make a copy of the
model values for comparison in your save method. I'm doing something
similar to create a special manager object each time a certain model
instance is created.

Something like this...

def backup_model_data(sender, instance, signal, *args, **kwargs):
 instance._original_data = instance.__dict__.copy()

class YourModel(model.Models):
...
dispatcher.connect(backup_model_data,signal=signals.post_init,
sender=YourModel)




--~--~-~--~~~---~--~~
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: Reutilizing views

2007-08-29 Thread Doug B

I think you should take a look at writing a custom inclusion tag, and
then using that tag in both views.

http://www.djangoproject.com/documentation/templates_python/#inclusion-tags

Unless I am misunderstanding, they would be perfect for what you want
to do (and are very easy to make).


--~--~-~--~~~---~--~~
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: Forms, paging and pretty urls

2007-08-29 Thread [EMAIL PROTECTED]

Easiest way to do it with your url scheme is to use Javascript and
build up the location by concatenating "/goals/page" +  pagele.value +
"start35/".  You'd then navigate to this url onsubmit or some other
trigger.  You could also change your code to look for the page number
in the arguments and then fall back to a request parameter (?page=x).

On Aug 29, 1:23 pm, Matt Haggard <[EMAIL PROTECTED]> wrote:
> How do you incorporate forms into pretty urls?
>
> I have a paged list of things that you access with the following urls
>
> /goals/page1/start35/
> /goals/page2/start35/
> /goals/page3/start35/
>
> etc...
>
> Doing links to the next and previous page is easy:
> {% url ids.views.goals page_num=prev_page,start_num=start_num %}
> {% url ids.views.goals page_num=next_page,start_num=start_num %}
>
> But if I want to provide an input field to let them choose a page to
> jump to, how would I implement that?
>
> Go to page 
> 
>
> I can send it to the generic /goals/ page with POSTed data and handle
> it just fine... but then I don't have the /goals/page#/start35/ url
> anymore.
>
> Any help?


--~--~-~--~~~---~--~~
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.core.management.dump_data gone into management.commands - but how to address it?

2007-08-29 Thread James Bennett

On 8/29/07, Ulf Kronman <[EMAIL PROTECTED]> wrote:
> Is there any documentation on this change around yet?

As always, backwards-incompatible changes appear here:

http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Changestomanagement.pycommands

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



Multi page article

2007-08-29 Thread MichaelMartinides

Hi all,

Any tips for setting up a multi-page article (ie one news story spread
over several pages, box with a content list of the news story, links,
etc.)?

With my current knowledge I would do this:

class NewsStory(models.Model):
 headline = ...
 image = ...

class NewsStoryPage(models.Model):
  story = models.Foreignkey(NewsStory, edit_inline=True)
  page_number = models.IntegerField()
  content = 

The ordering with the integer number would probably be an inconvience
for the editor...

But is this the way to go?

Cheers,
  >>Michael


--~--~-~--~~~---~--~~
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: Keeping track of the original values for a record...

2007-08-29 Thread [EMAIL PROTECTED]

I tried using the signals... but setting a new value on the record,
seems to also set it on the _original_data ...which is odd...maybe I'm
not seeing something stupid that I'm doing?  If I change my
marketing_status_name data in my view and save, the new data is in
both the _original_data, and in the new property value.

# some extra properties removed to make it shorter to read
from django.db.models import signals
from django.dispatch import dispatcher
from django.db import models

def backup_model_data(sender, instance, signal, *args, **kwargs):
 instance._original_data = instance.__dict__.copy()

class MarketingStatus(models.Model):
marketing_status_id = models.AutoField(primary_key=True)
marketing_status_name = models.CharField(blank=True, maxlength=30)
marketing_status_description = models.CharField(blank=True,
maxlength=255)

def save(self):
testing =
self._original_data['marketing_status_name']
testing2 = self.marketing_status_name

triggererror = madeupvariabletotriggererror #
just stuck this here so I can view the data in the browser

super(MarketingStatus, self).save()

class Meta:
db_table = 'marketing_status'

dispatcher.connect(backup_model_data,signal=signals.post_init,sender=MarketingStatus)



On Aug 29, 2:24 pm, Doug B <[EMAIL PROTECTED]> wrote:
> You could probably use the post_init signal to make a copy of the
> model values for comparison in your save method. I'm doing something
> similar to create a special manager object each time a certain model
> instance is created.
>
> Something like this...
>
> def backup_model_data(sender, instance, signal, *args, **kwargs):
>  instance._original_data = instance.__dict__.copy()
>
> class YourModel(model.Models):
> ...
> dispatcher.connect(backup_model_data,signal=signals.post_init,
> sender=YourModel)


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



$5 into $50000

2007-08-29 Thread [EMAIL PROTECTED]

Read this. It can change your life:

 HOW MUCH DO YOU SPEND ON LOTTERIES?  HAVE YOU EVER WON?
 HOW MUCH DOES $5 BUY AT MCDONALD'S? AT A BAR?
 HOW MUCH DOES ONE MAGAZINE COST?  MORE THAN THIS DOES MOST LIKELY...

 I saw an article in an internet newsgroup telling me I could
 make $50,000 within a month for an investment of only $5.
 Who'd believe that?  It's a scam, right?  Wrong!

 *
 ** READ ON!!!THIS WORKS!!! **
 *

 I thought it was a huge joke.  I spoke to my wife, attorney
 and friends about it, and they all agreed it was some kind
 of scam.  I can't stand scams, because usually someone gets
 burned, and I didn't want it to be me.  Of course, I rejected
 the idea at first.  After a short period of about two weeks,
 I thought "I have already heard of such things.  But on the
 Internet?!?".  I decided that even if I had to throw $5 into
 the fire, it wouldn't hurt my wallet that much, and gave it
 a try.  After all my wallet could sure use a LOT more than
 five dollars.

 Two weeks later, I began receiving money in the mail!  I
 could not believe it!  Soon hundreds, and then thousands of
 dollars began to roll in.  Within 4 weeks, I had received a
 total of $32,445!  It came from everywhere in the world.  My
 bank account has changed its "-" into a big "+" ()!!!
 I bought myself a car and things I had wanted for a long,
 long time for my wife and kids!

 If you follow the three steps below, there is no reason why
 the same shouldn't happen to you!  This is a legitimate
 investment opportunity.  You invest $5, and you receive a
 return on your investment.  So does the next investor.  NOT
 ILLEGAL, NOT A CHAIN LETTER- PERFECTLY LEGITIMATE.

 If you are not interested, then don't participate, but
 please print this article and pass it on to someone who may
 be interested, so they can take advantage.

 The procedure is simple:

 1) Write your name and address on 5 sheets of paper.
Below that, write the words, "Please add me to your
mailing list." Fold $1 note or bank draft or money
order in each piece of paper and mail them to the
following 5 addresses:

 1.  Esteban Zugasti
 100 Orange Dr.
 Chula Vista CA 91911  USA

 2.  Edward Gere
 6705 Ilex Court
 Frederick, Maryland 21774   USA

 3.  Rejean Raiche
 1802, Du Renne,
 Longueuil. Qc.
 Canada.   J4N 1L3

 4.  Derrick Lin
 20204 Bainbridge Way
 Freehold, NJ 07728

 5.  Barry Pope
 650 Old Fannin Road #D-9
 Jackson, MS 39208

2) Now remove the top name from the list, and move the other
four names up.  In other words, #5 becomes #4 and so on.
Put your name as the fifth one on the list.   Use a simple
text editor such as Notepad, in your  "accessories" window
(If you have MS-Windows), or DOS editor.  In fact, any
editor will do.

 3) Post the article to at least 200 newsgroups.  There are
17,000, so it shouldn't be hard to find that many.  Try
posting to as many newsgroups as you can,  and the bigger the
newsgroup is, the more people are sure to see your message!

 You are now in the mail order investment business, and
 should start seeing returns within a week or two.  Of course,
 the more newsgroups you post to, the greater your return is.
 If you wish to remain anonymous, you may use a pseudonym,
 call yourself "The Manager", "The Boss", whatever but make
 sure your address is correct.

 Now, here is why the system works:

 -Of every 200 posts I made, I received 5 responses.  Yes,
 only 5.  You make $5 for every 200 posts with your name at #5.

 -Each person who sent you $1 now also makes 200 additional
 postings with your name at #4.  ie. 1000 postings.  On average
 therefore, 50 people will send you $1 with your name at #4.
 $50.

 -Your 50 new agents make 200 postings each with your name at
 #3 or 10,000 postings.  Average return 500 people = $500.
 They make 200 postings each with your name at #2=100,000
 postings=5000 return at $1 each=$5000.

 -Finally, 5,000 people make 200 postings with your name at
 #1 and you get a return of $50,000 before your name drops
 off the list.  AND THAT'S IF EVERYONE DOWN THE LINE MAKES 200
 POSTINGS!  Total income in one cycle=$55,000.

 From time to time, when you see your name no longer on the
 list, take the latest posting that appears in the newsgroups,
 and send out another $5, and put your name at #5, and start
 posting again.  Remember, 200 postings is only a guideline.
 The more you post, the greater the return.

 Let's review why you should do this.  THE ONLY COST IS $5, AND
 5 STAMPS, AND 5 ENVELOPES.  Anyone can afford $5 for such an
 effortless investment with such SPECTACULAR RETURNS.

 Some people have said to me, "What happens if this is
 played out and no one sends me any money?"  Big Deal, so you
 lose $5-but what are the chances of that happening??  Do you
 think that NOBODY cares about a LEGAL chance of making such
 BIG money as $50,000.00

Re: Keeping track of the original values for a record...

2007-08-29 Thread Michael

You can simply override the __init__ method and take a copy of the
values then:

See Malcolm's explanation here:
http://groups.google.com/group/django-users/msg/6d849eca95243371

-Mike

On Aug 30, 5:28 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> I tried using the signals... but setting a new value on the record,
> seems to also set it on the _original_data ...which is odd...maybe I'm
> not seeing something stupid that I'm doing?  If I change my
> marketing_status_name data in my view and save, the new data is in
> both the _original_data, and in the new property value.
>
> # some extra properties removed to make it shorter to read
> from django.db.models import signals
> from django.dispatch import dispatcher
> from django.db import models
>
> def backup_model_data(sender, instance, signal, *args, **kwargs):
>  instance._original_data = instance.__dict__.copy()
>
> class MarketingStatus(models.Model):
> marketing_status_id = models.AutoField(primary_key=True)
> marketing_status_name = models.CharField(blank=True, maxlength=30)
> marketing_status_description = models.CharField(blank=True,
> maxlength=255)
>
> def save(self):
> testing =
> self._original_data['marketing_status_name']
> testing2 = self.marketing_status_name
>
> triggererror = madeupvariabletotriggererror #
> just stuck this here so I can view the data in the browser
>
> super(MarketingStatus, self).save()
>
> class Meta:
> db_table = 'marketing_status'
>
> dispatcher.connect(backup_model_data,signal=signals.post_init,sender=MarketingStatus)
>
> On Aug 29, 2:24 pm, Doug B <[EMAIL PROTECTED]> wrote:
>
> > You could probably use the post_init signal to make a copy of the
> > model values for comparison in your save method. I'm doing something
> > similar to create a special manager object each time a certain model
> > instance is created.
>
> > Something like this...
>
> > def backup_model_data(sender, instance, signal, *args, **kwargs):
> >  instance._original_data = instance.__dict__.copy()
>
> > class YourModel(model.Models):
> > ...
> > dispatcher.connect(backup_model_data,signal=signals.post_init,
> > sender=YourModel)


--~--~-~--~~~---~--~~
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: Multi page article

2007-08-29 Thread Michael

I wouldn't be storing the pages in a separate model, but rather using
some sort of page break marker within a 'body' field of the
NewsStory... otherwise i can imagine it will become difficult to edit
(add an extra paragraph to the first page, then cut-n-paste like a
waterfall through the other pages...)

You could then perhaps create a custom filter to do something like:

{% newsarticle.body|page pagenum %}

which just outputs the page you're after based on the page break
markers within the body text. I'm no expert either, but there's an
idea :)

Hope that helps!
-Michael

On Aug 30, 5:23 am, MichaelMartinides <[EMAIL PROTECTED]>
wrote:
> Hi all,
>
> Any tips for setting up a multi-page article (ie one news story spread
> over several pages, box with a content list of the news story, links,
> etc.)?
>
> With my current knowledge I would do this:
>
> class NewsStory(models.Model):
>  headline = ...
>  image = ...
>
> class NewsStoryPage(models.Model):
>   story = models.Foreignkey(NewsStory, edit_inline=True)
>   page_number = models.IntegerField()
>   content = 
>
> The ordering with the integer number would probably be an inconvience
> for the editor...
>
> But is this the way to go?
>
> Cheers,
>   >>Michael


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



  1   2   >