Re: Haystack error rebuinding index

2010-12-20 Thread Sam Lai
2010/12/21 Daniel França :
> anyone?
>
> 2010/12/19 Daniel França 
>>
>> Hi all
>> I was using haystack(xapian) at a Mac, so I moved it to a Linux (Ubuntu
>> 10.10) using python 2.6.6, but now when I try to rebuild the index I get the
>> following error:
>> AttributeError: 'ProfileIndex' object has no attribute 'full_prepare'
>> ProfileIndex is my index, I didn't created a full_prepare atribute, but I
>> wonder that haystack created that for me, right?

full_prepare is a method in the SearchIndex class in Haystack. Does
ProfileIndex inherit from SearchIndex?

Maybe haystack isn't installed properly and Python can't find the
SearchIndex class? Although that should be a different error I
believe.

>> Anyone has any idea where can be the error? and how can I fix it?
>>
>> my Django version: 1.2.3
>> Best Regardds,
>> Daniel França
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Database edit tutorial / open source projects to learn from

2010-12-20 Thread Kenneth Gonsalves
On Mon, 2010-12-20 at 06:58 -0800, Michele JD Granocchia wrote:
> Can anybody post a good tutorial / open source project to learn
> something about database transactions? 

postgresql manual is excellent
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Łukasz Rekucki
On 21 December 2010 00:18, Morgan Wahl  wrote:
> Actually, it's funny you mention #7623; my situation _is_ described in
> #11618 ( http://code.djangoproject.com/ticket/11618 ). That bug was
> marked as a dup of #7623, but in my opinion isn't.

It is a duplicate, that's why I mentioned #7623 which is tracking this
bug. Existence of another table is irrelevant here, IMHO. The main
scheme is the same: You have an instance of class A and you want to
create an instance of class B which is a subclass of A, by writing:

a = A.object.get(pk=1) # existing instance of A
b = B(parent=A)
b.save() # this will fail

The patch on #7623 is describing exactly this situation, so you should
check it out.

>
> 2010/12/20 Łukasz Rekucki :
>> This looks a lot like this bug: http://code.djangoproject.com/ticket/7623.
>>
>> On 20 December 2010 23:14, morgan wahl  wrote:
>>> Yes, I had hope that would work, but it doesn't (see my original post). In
>>> your example u.doctype would end up as None instead of 'whatever'.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-us...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>
>>
>> --
>> Łukasz Rekucki
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Łukasz Rekucki

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Haystack error rebuinding index

2010-12-20 Thread Daniel França
anyone?

2010/12/19 Daniel França 

> Hi all
> I was using haystack(xapian) at a Mac, so I moved it to a Linux (Ubuntu
> 10.10) using python 2.6.6, but now when I try to rebuild the index I get the
> following error:
> AttributeError: 'ProfileIndex' object has no attribute 'full_prepare'
>
> ProfileIndex is my index, I didn't created a full_prepare atribute, but I
> wonder that haystack created that for me, right?
> Anyone has any idea where can be the error? and how can I fix it?
>
> my Django version: 1.2.3
>
> Best Regardds,
> Daniel França
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Morgan Wahl
Actually, it's funny you mention #7623; my situation _is_ described in
#11618 ( http://code.djangoproject.com/ticket/11618 ). That bug was
marked as a dup of #7623, but in my opinion isn't.

2010/12/20 Łukasz Rekucki :
> This looks a lot like this bug: http://code.djangoproject.com/ticket/7623.
>
> On 20 December 2010 23:14, morgan wahl  wrote:
>> Yes, I had hope that would work, but it doesn't (see my original post). In
>> your example u.doctype would end up as None instead of 'whatever'.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> Łukasz Rekucki
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Andrejus
Sent from my mobile device
On Dec 20, 2010 8:04 PM, "morgan wahl"  wrote:
> Hello all,
>
> I was wonder if there is a way to turn a model instance into an
> instance of a subclass of it's class. E.g.:
>
> class Document(models.Model):
> doctype = models.CharField(max_length=256, blank=True, null=True)
>
> class UploadedFile(Document):
> filename = models.CharField(max_length=256)
>
> Given a Document that isn't already an UploadedFile, can I turn it
> into one? I know at the database level it's just a matter of inserting
> a new row into the uploadedfile table with document_ptr_id = the
> Document's id. I've tried
>
> doc = Document.objects.create(doctype='photo')
> uf = UploadedFile(
> document_ptr=doc,
> filename='test.jpg',
> )
> uf.save()
>
> But that seems to produce two separate instances (i.e. uf.doctype !=
> doc.doctype).
>
> Is there a way to do this?
>
> Thanks in advance.
> -Morgan Wahl
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Morgan Wahl
That bug is slightly different; it concerns having _more than one_
entry in subclass(es)'s tables refer to the _same_ entry in the
superclass's (which pretty much breaks the analogy with class
inheritance, if you ask me).

My situation is that I have various instances of Document, some of
which are also instances of UploadedFile (or other Document
subclasses). I would like to turn ones which _aren't_ already
UploadedFile instances into ones that are, without changing their
existing fields (especially their IDs). I'm not trying to break the
one-to-one relationship between the tables in multi-table inheritance.

2010/12/20 Łukasz Rekucki :
> This looks a lot like this bug: http://code.djangoproject.com/ticket/7623.
>
> On 20 December 2010 23:14, morgan wahl  wrote:
>> Yes, I had hope that would work, but it doesn't (see my original post). In
>> your example u.doctype would end up as None instead of 'whatever'.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> Łukasz Rekucki
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Morgan Wahl
>
> Morgan, take a look at the inheritanceManager of this
> app: https://github.com/carljm/django-model-utils#readme
> --
> Marc
>

I'm not sure how InheritanceManager would quite solve _this_ problem,
although it certainly is handy (I've independently implemented
something like InheritanceCastModel already). So, thanks for the tip!

Just to clarify:
My problem is that Document instances get created at some point (and
referenced by other models), and at some later date a Document might
need to be transmuted to a UploadedFile (which should be fine
hypothetically).

The actual classes I'm dealing with are a little more complicated, my
example was just for this question.

-Morgan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Łukasz Rekucki
This looks a lot like this bug: http://code.djangoproject.com/ticket/7623.

On 20 December 2010 23:14, morgan wahl  wrote:
> Yes, I had hope that would work, but it doesn't (see my original post). In
> your example u.doctype would end up as None instead of 'whatever'.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Łukasz Rekucki

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread morgan wahl
ah, yes you beat me to it while I was composing my post below...

Thanks!

On Dec 20, 5:34 pm, Marc Aymerich  wrote:
> On Mon, Dec 20, 2010 at 11:14 PM, morgan wahl  wrote:
> > Yes, I had hope that would work, but it doesn't (see my original post). In
> > your example u.doctype would end up as None instead of 'whatever'.
>
> woww, I really need go to sleep :)
>
> I don't know the best way to achieve that, btw you can pass the document
> attributes to the uploadfile constructor.
>
> d=Document(doctype='whatever')
> d.save()
> u=UploadFile(document_ptr=d, doctype=d.doctype, filename='rat.doc')
> u.save()
>
> --
> Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Marc Aymerich
On Mon, Dec 20, 2010 at 11:34 PM, Marc Aymerich  wrote:

>
>
> On Mon, Dec 20, 2010 at 11:14 PM, morgan wahl wrote:
>
>> Yes, I had hope that would work, but it doesn't (see my original post). In
>> your example u.doctype would end up as None instead of 'whatever'.
>
>
> woww, I really need go to sleep :)
>
> I don't know the best way to achieve that, btw you can pass the document
> attributes to the uploadfile constructor.
>
>  d=Document(doctype='whatever')
> d.save()
> u=UploadFile(document_ptr=d, doctype=d.doctype, filename='rat.doc')
> u.save()
>
>
>
Morgan, take a look at the inheritanceManager of this app:
https://github.com/carljm/django-model-utils#readme

-- 
Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread morgan wahl
Hmmm, I seem to have somewhat figured out what's going on.

Using Marc's example, when you instantiate u it's doctype field is set
to the default for Documents (None), since it isn't passed in. Then
when you save it, it overwrites the field in d.

So it seems the answer to my question is something like:

d = Document(doctype='whatever')
d.save()
u_kwargs = 
u_kwargs.update({
'document_ptr_id': d,
'filename': 'rat.doc',
})
u = UploadedFile(**u_kwargs)
u.save()

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Marc Aymerich
On Mon, Dec 20, 2010 at 11:14 PM, morgan wahl  wrote:

> Yes, I had hope that would work, but it doesn't (see my original post). In
> your example u.doctype would end up as None instead of 'whatever'.


woww, I really need go to sleep :)

I don't know the best way to achieve that, btw you can pass the document
attributes to the uploadfile constructor.

d=Document(doctype='whatever')
d.save()
u=UploadFile(document_ptr=d, doctype=d.doctype, filename='rat.doc')
u.save()



-- 
Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread morgan wahl
Yes, I had hoped that would work, but it doesn't (see my original post). In 
your example u.doctype would end up as None instead of 'whatever' (however, 
u.document_ptr is d).

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread morgan wahl
Yes, I had hope that would work, but it doesn't (see my original post). In 
your example u.doctype would end up as None instead of 'whatever'.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Marc Aymerich
On Mon, Dec 20, 2010 at 11:00 PM, Morgan Wahl  wrote:

> On Mon, Dec 20, 2010 at 4:49 PM, Marc Aymerich 
> wrote:
> >
> >
> > On Mon, Dec 20, 2010 at 8:29 PM, morgan wahl 
> wrote:
> >>
> >> Hello all,
> >>
> >> I was wonder if there is a way to turn a model instance into an
> >> instance of a subclass of it's class. E.g.:
> >>
> >> class Document(models.Model):
> >>doctype = models.CharField(max_length=256, blank=True, null=True)
> >>
> >> class UploadedFile(Document):
> >>filename = models.CharField(max_length=256)
> >>
> >> Given a Document that isn't already an UploadedFile, can I turn it
> >> into one? I know at the database level it's just a matter of inserting
> >> a new row into the uploadedfile table with document_ptr_id = the
> >> Document's id. I've tried
> >>
> >
> > I think that something like this should do the work:
> > Document.UploadFile.filename="rat.doc"
> > Document.save()
> >
> > --
> > Marc
> Um, I'm not sure what it is you're trying to demonstrate here... in my
> example bits of code Document and UploadedFile are Model classes, not
> instances.
>
>
Hi Morgan, sorry, Yes you're rigth,


d=Document(doctype='whatever')
d.save()
u=UploadFile(document_ptr=d, filename='rat.doc')
u.save()


sorry for the confusion here :S

-- 
Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Morgan Wahl
On Mon, Dec 20, 2010 at 4:49 PM, Marc Aymerich  wrote:
>
>
> On Mon, Dec 20, 2010 at 8:29 PM, morgan wahl  wrote:
>>
>> Hello all,
>>
>> I was wonder if there is a way to turn a model instance into an
>> instance of a subclass of it's class. E.g.:
>>
>> class Document(models.Model):
>>    doctype = models.CharField(max_length=256, blank=True, null=True)
>>
>> class UploadedFile(Document):
>>    filename = models.CharField(max_length=256)
>>
>> Given a Document that isn't already an UploadedFile, can I turn it
>> into one? I know at the database level it's just a matter of inserting
>> a new row into the uploadedfile table with document_ptr_id = the
>> Document's id. I've tried
>>
>
> I think that something like this should do the work:
> Document.UploadFile.filename="rat.doc"
> Document.save()
>
> --
> Marc
Um, I'm not sure what it is you're trying to demonstrate here... in my
example bits of code Document and UploadedFile are Model classes, not
instances.

>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread Marc Aymerich
On Mon, Dec 20, 2010 at 8:29 PM, morgan wahl  wrote:

> Hello all,
>
> I was wonder if there is a way to turn a model instance into an
> instance of a subclass of it's class. E.g.:
>
> class Document(models.Model):
>doctype = models.CharField(max_length=256, blank=True, null=True)
>
> class UploadedFile(Document):
>filename = models.CharField(max_length=256)
>
> Given a Document that isn't already an UploadedFile, can I turn it
> into one? I know at the database level it's just a matter of inserting
> a new row into the uploadedfile table with document_ptr_id = the
> Document's id. I've tried
>
>
I think that something like this should do the work:

Document.UploadFile.filename="rat.doc"
Document.save()


-- 
Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Using the media url in JS

2010-12-20 Thread Robert Steckroth
Hey gang, anyone care to share the best way to incorporate this image
loading function into
my Website.

*Here is the JS premise I want to achieve --> textureFile[t].image.src =
{{ MEDIA_URL }} + tempName + tExt;


This JS is successfully loaded by index.html via this --> 

*Needs a working method

-- 
*Bringing game to younix*
Bust0ut Entertainment  ---
PureBreedDefense.com --> TheLinuxGame.com --> PBDefence.com
"Finding the exit without looking"

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



turning a Model instance into an instance of one of it's subclasses

2010-12-20 Thread morgan wahl
Hello all,

I was wonder if there is a way to turn a model instance into an
instance of a subclass of it's class. E.g.:

class Document(models.Model):
doctype = models.CharField(max_length=256, blank=True, null=True)

class UploadedFile(Document):
filename = models.CharField(max_length=256)

Given a Document that isn't already an UploadedFile, can I turn it
into one? I know at the database level it's just a matter of inserting
a new row into the uploadedfile table with document_ptr_id = the
Document's id. I've tried

doc = Document.objects.create(doctype='photo')
uf = UploadedFile(
document_ptr=doc,
filename='test.jpg',
)
uf.save()

But that seems to produce two separate instances (i.e. uf.doctype !=
doc.doctype).

Is there a way to do this?

Thanks in advance.
-Morgan Wahl

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



DB synch error: postgis-1.5.dll

2010-12-20 Thread Charlie
I'm trying to create a PostGIS spatial database and having all sorts
of configuration issues (Windows XP SP3, PostgreSQL 8.4, PostGIS
version 1.5.2.3) .  I've finally made it to the synch step using the
command 'python manage.py syncdb'.  The tables are created fine, and
spatial indexes are created on all the auth tables.  However, when
indexing the actual data table, I get the following message:

Failed to install index for osp1a_app.Sites model: could not load
library "C:/Pr
ogram Files/PostgreSQL/9.0/lib/postgis-1.5.dll": The specified module
could not
be found.

Now the .dll is clearly in the indicated directory, so who knows what
it's griping about now?  Maybe it has to do with the forward slash --
back slash difference.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



MySQL jython backend implementation

2010-12-20 Thread Javier Aguirre
Hi,

I'm newbee in jython, and I need to connect to mysql with jython using
backend

does anybody know how to??

bye

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Multi-Table inheritance save problem

2010-12-20 Thread shitiz
Hi,
I have a rather complicated scenario.

I have two models A and B.

I have a third Class C which inherits both A and B.

I am now overriding the save method of class C using super.save

Now an object A is added to the database.

However when the save method of B is called it fetches the id field of
Model A.

So the id field of both my models A and B is always duplicate. However
the problem is that there are many other sources by which my model B
is created. Hence many times my model B is just updated( as an object
with same id already exists) when it should have been created.

Please Help.

Shitiz

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Serialize Data for JSON output

2010-12-20 Thread Dave Sayer
Thanks for your response, Nick.

I have called the gallery_thumbs_json variable in my template and get
a very comprehensive array of data, which is nice. I have then set
this as a js var and then passed that to my javascript via eval(),
which gives me a nicely formatted array but i can't work out how to
access specific data in the array. I'll have a hunt around on google.
I think this is now a bit off topic for the Django list.

Thanks for your help.

Dave


On 20 December 2010 16:42, Nick  wrote:
> This sounds like it is an issue with your JS for your carousel.
>
> If you are needing to get your JSON directly into your JS code then
> you can just make gallery_thumbs_json_s list as a variable
> {'caro_list': gallery_thumbs_json_s}
>
> and then just call it in your template
>
> On Dec 20, 9:16 am, Dave Sayer  wrote:
>> Hi,
>>
>> I am working on a photo portfolio site at the moment and for the
>> gallery side of things, I am using django-photologue to provide much
>> of the backend muscle. It's working great so far but I really want to
>> use an image slider/carousel to provide a nice, slick way of
>> navigating the photos.
>>
>> I am reckoning the best way to do this is to grab all the photos in a
>> gallery and slap them into a JSON string, which is then fed through my
>> slider script. So far, I have got the data into a serialized array
>> using:
>>
>> gallery_thumbs_json_s = serializers.serialize('json', gallery_thumbs,
>> fields=('image', 'title', 'caption', 'tags', 'title_slug',
>> 'date_taken'))
>>
>> Where I am now stuck, is how to use this as JSON in my script. I have
>> read that deserialize is the way to do it but I can't get my head
>> around what comes after deserialize.
>>
>> Any pointers would be much appreciated.
>>
>> Cheers,
>>
>> Dave
>>
>> --
>> ---
>> Dave Sayer | Bath Design
>> Web design & development with standards
>> ---
>> mobile: +44 (0)7702787436
>> email: d...@bathdesign.co.uk
>> web:http://bathdesign.co.uk
>> twitter:http://twitter.com/sweet_grass
>> photography:http://luxumbra.co.uk
>> ---
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
---
Dave Sayer | Bath Design
Web design & development with standards
---
mobile: +44 (0)7702787436
email: d...@bathdesign.co.uk
web: http://bathdesign.co.uk
twitter: http://twitter.com/sweet_grass
photography: http://luxumbra.co.uk
---

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: server connection dropped? IO Error? What's going on?

2010-12-20 Thread bax...@gretschpages.com


On Dec 20, 11:26 am, Tom Evans  wrote:
> On Mon, Dec 20, 2010 at 4:52 PM, bax...@gretschpages.com
>
> If I load the page in chrome with its resource tracking debug tab
> open, I can see that several files that are requested receive zero
> sized responses. When I loaded the page, this was for (what looks
> like) static files, which you say are being served by nginx.
>
> I don't see how django gets involved in this, which is probably part
> of the reason why you aren't getting any responses on this list. Try
> asking on a nginx list.
>
> As a wild stab in the dark, does it still happen when you turn
> sendfile off in nginx [1]? If so, that points to an OS/nginx bug.
>
> Cheers
>
> Tom
>

Tom, I initially thought it was an nginx thing as well, but I don't
believe so any more. I don't think that would explain why it fails on
this topic EVERY time, and every other topic NONE of the time. I think
the failure to load some static media is a sympton, not the actual
problem. Turning sendfile off did not change the behavior at all.

Plus I have no errors in my nginx logs. Problem is, I can't find
anything about that particular topic that would cause any problem.
That topic (and a couple of others) will error every time, while all
the other pages on the site don't, ever.

I do think whatever it is, it's very low in the stack. Maybe
middleware?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: server connection dropped? IO Error? What's going on?

2010-12-20 Thread Tom Evans
On Mon, Dec 20, 2010 at 4:52 PM, bax...@gretschpages.com
 wrote:
> Foolishly posted this late last week, which is a tough time to get
> help. Please forgive me for reposting, but I'm at my wit's end here.
>
> What I've got is a very localized, yet apparently completely random
> sort of IO error, or something else causing the server to drop out.
> You can see an example here:
> http://gretschpages.com/forum/your-tunes/five-min-love-affair/36446/page1/
>
> On initial load, you'll probably see one or two static elements fail
> to load.
> If you hit reload or follow any link from that page, you'll either get
> ALL static media fail to load, or the page will not load at all,
> giving some sort of "server busy" message.
>
> That topic will do it every time. Pretty much every place else on the
> site will not. The server is not busy, it's something about that
> topic, and the handful of others this thing has hit.
>
> I can't find any commonality among the problem topics/posts. All other
> posts/topics are fine.
> If I copy all the info from the problem topic into a new one, it posts
> fine.
> If that user posts another topic, it works fine.
>
> Server config is Nginx is handling static media and passing django
> stuff over to Apache.
>
> I don't see anything in the nginx or apache error logs, and nothing
> looks off in the database, either.
>
> Any suggestions on where to look or how to debug this?
>

If I load the page in chrome with its resource tracking debug tab
open, I can see that several files that are requested receive zero
sized responses. When I loaded the page, this was for (what looks
like) static files, which you say are being served by nginx.

I don't see how django gets involved in this, which is probably part
of the reason why you aren't getting any responses on this list. Try
asking on a nginx list.

As a wild stab in the dark, does it still happen when you turn
sendfile off in nginx [1]? If so, that points to an OS/nginx bug.


Cheers

Tom


[1] http://wiki.nginx.org/HttpCoreModule#sendfile

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: server connection dropped? IO Error? What's going on?

2010-12-20 Thread bax...@gretschpages.com
> Just looking at your style.css file, it's got a weird (to my eye) line in it:
>
>         src: local('☺'), 
> url('/media/fonts/LeagueGothic/League_Gothic-webfont.woff') format('woff'),
>

Comes from fontsquirrel. As I recall, it forces the local load if the
font is available, or passes along to download if not.

I'm pretty sure it's nothing in my styles though, as it has only hit
about 5 pages out of about 50,000.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: server connection dropped? IO Error? What's going on?

2010-12-20 Thread Dan Fairs

> That topic will do it every time. Pretty much every place else on the
> site will not. The server is not busy, it's something about that
> topic, and the handful of others this thing has hit.
> 
> I can't find any commonality among the problem topics/posts. All other
> posts/topics are fine.
> If I copy all the info from the problem topic into a new one, it posts
> fine.
> If that user posts another topic, it works fine.
> 
> Server config is Nginx is handling static media and passing django
> stuff over to Apache.
> 
> I don't see anything in the nginx or apache error logs, and nothing
> looks off in the database, either.
> 
> Any suggestions on where to look or how to debug this?

Just looking at your style.css file, it's got a weird (to my eye) line in it:

src: local('☺'), 
url('/media/fonts/LeagueGothic/League_Gothic-webfont.woff') format('woff'),

Now - I know precisely nothing about font embedding and all that malarky, but 
what are those 'funny' characters doing there - are they intentional? Could 
they be confusing the browser, and preventing other stuff loading? (I'm viewing 
in Firefox 3.6.13 btw)

Cheers,
Dan

--
Dan Fairs | dan.fa...@gmail.com | www.fezconsulting.com


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



server connection dropped? IO Error? What's going on?

2010-12-20 Thread bax...@gretschpages.com
Foolishly posted this late last week, which is a tough time to get
help. Please forgive me for reposting, but I'm at my wit's end here.

What I've got is a very localized, yet apparently completely random
sort of IO error, or something else causing the server to drop out.
You can see an example here:
http://gretschpages.com/forum/your-tunes/five-min-love-affair/36446/page1/

On initial load, you'll probably see one or two static elements fail
to load.
If you hit reload or follow any link from that page, you'll either get
ALL static media fail to load, or the page will not load at all,
giving some sort of "server busy" message.

That topic will do it every time. Pretty much every place else on the
site will not. The server is not busy, it's something about that
topic, and the handful of others this thing has hit.

I can't find any commonality among the problem topics/posts. All other
posts/topics are fine.
If I copy all the info from the problem topic into a new one, it posts
fine.
If that user posts another topic, it works fine.

Server config is Nginx is handling static media and passing django
stuff over to Apache.

I don't see anything in the nginx or apache error logs, and nothing
looks off in the database, either.

Any suggestions on where to look or how to debug this?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Serialize Data for JSON output

2010-12-20 Thread Nick
This sounds like it is an issue with your JS for your carousel.

If you are needing to get your JSON directly into your JS code then
you can just make gallery_thumbs_json_s list as a variable
{'caro_list': gallery_thumbs_json_s}

and then just call it in your template

On Dec 20, 9:16 am, Dave Sayer  wrote:
> Hi,
>
> I am working on a photo portfolio site at the moment and for the
> gallery side of things, I am using django-photologue to provide much
> of the backend muscle. It's working great so far but I really want to
> use an image slider/carousel to provide a nice, slick way of
> navigating the photos.
>
> I am reckoning the best way to do this is to grab all the photos in a
> gallery and slap them into a JSON string, which is then fed through my
> slider script. So far, I have got the data into a serialized array
> using:
>
> gallery_thumbs_json_s = serializers.serialize('json', gallery_thumbs,
> fields=('image', 'title', 'caption', 'tags', 'title_slug',
> 'date_taken'))
>
> Where I am now stuck, is how to use this as JSON in my script. I have
> read that deserialize is the way to do it but I can't get my head
> around what comes after deserialize.
>
> Any pointers would be much appreciated.
>
> Cheers,
>
> Dave
>
> --
> ---
> Dave Sayer | Bath Design
> Web design & development with standards
> ---
> mobile: +44 (0)7702787436
> email: d...@bathdesign.co.uk
> web:http://bathdesign.co.uk
> twitter:http://twitter.com/sweet_grass
> photography:http://luxumbra.co.uk
> ---

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



redirecting on SMTP error

2010-12-20 Thread Nick
I have an app with some SMTP errors that are getting tricky. Our
network team is working on our email servers for the next few days and
it is affecting the auto-notifications portion of the app. Right now i
am getting a 550 'relay not permitted' error.

How can I trap this error and redirect upon encountering it so front
end users don't see any interruption?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Serialize Data for JSON output

2010-12-20 Thread Dave Sayer
Hi,

I am working on a photo portfolio site at the moment and for the
gallery side of things, I am using django-photologue to provide much
of the backend muscle. It's working great so far but I really want to
use an image slider/carousel to provide a nice, slick way of
navigating the photos.

I am reckoning the best way to do this is to grab all the photos in a
gallery and slap them into a JSON string, which is then fed through my
slider script. So far, I have got the data into a serialized array
using:

gallery_thumbs_json_s = serializers.serialize('json', gallery_thumbs,
fields=('image', 'title', 'caption', 'tags', 'title_slug',
'date_taken'))

Where I am now stuck, is how to use this as JSON in my script. I have
read that deserialize is the way to do it but I can't get my head
around what comes after deserialize.

Any pointers would be much appreciated.

Cheers,

Dave

-- 
---
Dave Sayer | Bath Design
Web design & development with standards
---
mobile: +44 (0)7702787436
email: d...@bathdesign.co.uk
web: http://bathdesign.co.uk
twitter: http://twitter.com/sweet_grass
photography: http://luxumbra.co.uk
---

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: add template variable to an external view, without changing the view

2010-12-20 Thread Mikhail Korobov
Hi Yves,

In django 1.3 there is also a TemplateResponse (
http://docs.djangoproject.com/en/dev/ref/template-response/ ) that can
perform as render_to_response replacement, doesn't require class based
views and enables developer to change the template context (as well as
the template to be rendered) of a third-party view so the future is
even brighter ;)

It still requires changes to third-party app but the changes are quite
trivial (replacing render_to_response with even simpler
TemplateResponse call) and I expect third-party apps to begin
replacing render_to_response with TemplateResponse or with class based
views once django 1.3 will be released.

In case of registration and login form at the same pages, there are 2
viable solutions:

1. add the login form to context in the context processor (globally or
based on request url);
2. write the html without constructing the form object. This object is
not really necessary because the validation, etc. should be handled by
an another view and django form object is not necessary to make html
form in django.

On 20 дек, 20:00, yves_s  wrote:
> Hello
>
> I'm using the registration django app and want to have the
> registration and login form on the same page.
> When I reuse the auth_login view, the registration form is missing in
> the context of the template.
> My quickfix is to copy the original auth login view to my own views.
> Then I changed the the call of "return render_to_response(..." and
> added the registration form. This works but this approach is not very
> DRY.
>
> I tried other approaches, but nothing worked.
> The first idea was to use a view decorator, but this don't worked
> because the view decorator
> is to late in the chain and already has the finished rendered template
> html code.
>
> The next idea was to import the login view and than to redefine the
> render_to_response function. I only got this working when the login
> view code is in my own views file, so not very DRY.
>
> I tried to make a new "version" of the login view with the python new
> module. The idea was to pass
> a new global context to the login view so that it uses my changed
> render_to_response function.
>
> This was the code:
> loign_new = new.function(login.func_code, globals(), login.func_name,
> login.func_defaults, login.func_closure)
>
> It worked partial, put the registration form was the same as login
> form, so some fields were missing.
>
> In django 1.3 there are are class based view, which solves this issue
> with the function get_context_data, but the external app must uses
> class based views, so the future looks birght :-)
>
> Is there any solution to get this working in django 1.2 with views
> from other apps? Any dirty python tricks?
>
> regards
> Yves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Complex serialization from models

2010-12-20 Thread gregory semah
Hi all,

I'm searching a simple way to generate xml from my models, and a
simple use of serializers can do this for me.
But my models are defined with ForeignKey and ManyToManyField...
The xml generated shows me only key values of these field.

Is there a simple way to catch any other field value than "id",
related to ForeignKey or ManyToManyField?
I mean with this example:

class Shirt(models.Model):
   color = ManyToManyField(Color)
   name = models.CharField(max_length=255)

class Color(models.Model):
   value = models.CharField(max_length=6)
   

to generate this kind of xml (not really this one but the same tree
structure)


 00
 00EE00
 FF


and NOT (as i try to explain):


 1
 2
 3


Thanks for your answer

Greg







-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



add template variable to an external view, without changing the view

2010-12-20 Thread yves_s
Hello

I'm using the registration django app and want to have the
registration and login form on the same page.
When I reuse the auth_login view, the registration form is missing in
the context of the template.
My quickfix is to copy the original auth login view to my own views.
Then I changed the the call of "return render_to_response(..." and
added the registration form. This works but this approach is not very
DRY.

I tried other approaches, but nothing worked.
The first idea was to use a view decorator, but this don't worked
because the view decorator
is to late in the chain and already has the finished rendered template
html code.

The next idea was to import the login view and than to redefine the
render_to_response function. I only got this working when the login
view code is in my own views file, so not very DRY.

I tried to make a new "version" of the login view with the python new
module. The idea was to pass
a new global context to the login view so that it uses my changed
render_to_response function.

This was the code:
loign_new = new.function(login.func_code, globals(), login.func_name,
login.func_defaults, login.func_closure)

It worked partial, put the registration form was the same as login
form, so some fields were missing.

In django 1.3 there are are class based view, which solves this issue
with the function get_context_data, but the external app must uses
class based views, so the future looks birght :-)

Is there any solution to get this working in django 1.2 with views
from other apps? Any dirty python tricks?

regards
Yves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Database edit tutorial / open source projects to learn from

2010-12-20 Thread Michele JD Granocchia
Can anybody post a good tutorial / open source project to learn
something about database transactions?

I didn't find anything useful...

Thanks in advance!!!  ^_^

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: template concat of string trouble (solved)

2010-12-20 Thread Tonton
{% autoescape *OFF* %}

{{ script }}

{% endautoescape %}



On Mon, Dec 20, 2010 at 3:41 PM, Tonton  wrote:

> yes i am reading on this
>
> but this
> {{script|escapejs}} seems to not work
> i investigate more
>
> thanks
>
>
> On Mon, Dec 20, 2010 at 3:37 PM, Tom Evans wrote:
>
>> On Mon, Dec 20, 2010 at 2:20 PM, Tonton  wrote:
>> > hello
>> >
>> > i don't the the name of ' and this " but is about my trouble with it ...
>> >
>> > i try to made a script for open layers  with url
>> > :http://ipadress/webservices
>> >
>> > like this
>> >
>> > var wms0=new
>> > OpenLayers.Layer.WMS(restcl_bus_line,'
>> http://192.168.12.60/cgi-bin/mapserv?map=/var/www/geomod/demo.map&;',
>> >
>> > from string concatenation wmsdef
>> > +="'http://192.168.12.60/cgi-bin/mapserv?map=/var/www/geomod/demo.map&;
>> ',"
>> >
>> > but i receive this in the web page
>> >
>> > wms0=new
>> > OpenLayers.Layer.WMS(restcl_bus_line,'
>> http://192.168.12.60/cgi-bin/mapserv?map=/var/www/geomod/demo.map&'
>> ;,
>> >
>> > // make comment for the rest of the line :(
>> > and & became &
>> > and ' became '
>> >
>> > so my script not working
>> >
>> > did someone knows how to change this ?
>> >
>> > regards
>> >
>> > tonton
>> >
>>
>> http://docs.djangoproject.com/en/1.2/ref/templates/builtins/#autoescape
>>
>> HTH
>>
>> Tom
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: template concat of string trouble

2010-12-20 Thread Tonton
yes i am reading on this

but this
{{script|escapejs}} seems to not work
i investigate more

thanks


On Mon, Dec 20, 2010 at 3:37 PM, Tom Evans  wrote:

> On Mon, Dec 20, 2010 at 2:20 PM, Tonton  wrote:
> > hello
> >
> > i don't the the name of ' and this " but is about my trouble with it ...
> >
> > i try to made a script for open layers  with url
> > :http://ipadress/webservices
> >
> > like this
> >
> > var wms0=new
> > OpenLayers.Layer.WMS(restcl_bus_line,'
> http://192.168.12.60/cgi-bin/mapserv?map=/var/www/geomod/demo.map&;',
> >
> > from string concatenation wmsdef
> > +="'http://192.168.12.60/cgi-bin/mapserv?map=/var/www/geomod/demo.map&;
> ',"
> >
> > but i receive this in the web page
> >
> > wms0=new
> > OpenLayers.Layer.WMS(restcl_bus_line,'
> http://192.168.12.60/cgi-bin/mapserv?map=/var/www/geomod/demo.map&'
> ;,
> >
> > // make comment for the rest of the line :(
> > and & became &
> > and ' became '
> >
> > so my script not working
> >
> > did someone knows how to change this ?
> >
> > regards
> >
> > tonton
> >
>
> http://docs.djangoproject.com/en/1.2/ref/templates/builtins/#autoescape
>
> HTH
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: template concat of string trouble

2010-12-20 Thread Tom Evans
On Mon, Dec 20, 2010 at 2:20 PM, Tonton  wrote:
> hello
>
> i don't the the name of ' and this " but is about my trouble with it ...
>
> i try to made a script for open layers  with url
> :http://ipadress/webservices
>
> like this
>
> var wms0=new
> OpenLayers.Layer.WMS(restcl_bus_line,'http://192.168.12.60/cgi-bin/mapserv?map=/var/www/geomod/demo.map&;',
>
> from string concatenation wmsdef
> +="'http://192.168.12.60/cgi-bin/mapserv?map=/var/www/geomod/demo.map&;',"
>
> but i receive this in the web page
>
> wms0=new
> OpenLayers.Layer.WMS(restcl_bus_line,'http://192.168.12.60/cgi-bin/mapserv?map=/var/www/geomod/demo.map&';,
>
> // make comment for the rest of the line :(
> and & became &
> and ' became '
>
> so my script not working
>
> did someone knows how to change this ?
>
> regards
>
> tonton
>

http://docs.djangoproject.com/en/1.2/ref/templates/builtins/#autoescape

HTH

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



template concat of string trouble

2010-12-20 Thread Tonton
hello

i don't the the name of ' and this " but is about my trouble with it ...

i try to made a script for open layers  with url :
http://ipadress/webservices

like this

var wms0=new 
OpenLayers.Layer.WMS(restcl_bus_line,'http://192.168.12.60/cgi-bin/mapserv?map=/var/www/geomod/demo.map&;',

from string concatenation wmsdef +="'
http://192.168.12.60/cgi-bin/mapserv?map=/var/www/geomod/demo.map&;',"

but i receive this in the web page

wms0=new 
OpenLayers.Layer.WMS(restcl_bus_line,'http://192.168.12.60/cgi-bin/mapserv?map=/var/www/geomod/demo.map&';,

// make comment for the rest of the line :(
and & became &
and ' became '

so my script not working

did someone knows how to change this ?

regards

tonton

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django queryset custom manager - refresh caching

2010-12-20 Thread LaundroMat


On Dec 20, 2:23 pm, Daniel Roseman  wrote:
> On Monday, December 20, 2010 11:03:10 AM UTC, LaundroMat wrote:
>
> > Hi -
>
> > Django seems to be caching data that I query through a custom method on a
> > model. I've tried to describe the issue over at SO (
> >http://stackoverflow.com/questions/4010317/django-queryset-custom-man...),
> > but received close to no replies... Does anyone here have an idea as to how
> > I could solve my problem?
>
> > Many thanks in advance,
>
> > Mathieu
>
> Apologies, I didn't see that you had posted the additional info I requested
> on that question. I've answered it there.
> --
> DR.

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



Re: Django queryset custom manager - refresh caching

2010-12-20 Thread LaundroMat


On Dec 20, 2:23 pm, Daniel Roseman  wrote:
> On Monday, December 20, 2010 11:03:10 AM UTC, LaundroMat wrote:
>
> > Hi -
>
> > Django seems to be caching data that I query through a custom method on a
> > model. I've tried to describe the issue over at SO (
> >http://stackoverflow.com/questions/4010317/django-queryset-custom-man...),
> > but received close to no replies... Does anyone here have an idea as to how
> > I could solve my problem?
>
> > Many thanks in advance,
>
> > Mathieu
>
> Apologies, I didn't see that you had posted the additional info I requested
> on that question. I've answered it there.
> --
> DR.

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



Re: Django queryset custom manager - refresh caching

2010-12-20 Thread Daniel Roseman
On Monday, December 20, 2010 11:03:10 AM UTC, LaundroMat wrote:
>
> Hi -
>
> Django seems to be caching data that I query through a custom method on a 
> model. I've tried to describe the issue over at SO (
> http://stackoverflow.com/questions/4010317/django-queryset-custom-manager-refresh-caching),
>  
> but received close to no replies... Does anyone here have an idea as to how 
> I could solve my problem?
>
> Many thanks in advance,
>
> Mathieu
>

Apologies, I didn't see that you had posted the additional info I requested 
on that question. I've answered it there.
--
DR.
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Transifex - django 1.3

2010-12-20 Thread Thierry
Whats the best way to currently setup transifex with django 1.3

The announcement says that people are working on this.
Dont want to duplicate their efforts, where can i find information on
this?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: VirtualHost and external IP

2010-12-20 Thread Tom Evans
On Sat, Dec 18, 2010 at 4:58 AM, andy  wrote:
> I have the following in my apache httpd.conf file
>
>
>
> 
>        ServerName localhost/portfolio
>

Short note: this is a nonsense ServerName. The ServerName directive
must not contain any path info (ie you cannot have different
virtualhosts for http://localhost/portfolio and
http://localhost/wibble.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django queryset custom manager - refresh caching

2010-12-20 Thread Mathieu Dhondt
Hi -

Django seems to be caching data that I query through a custom method on a 
model. I've tried to describe the issue over at SO 
(http://stackoverflow.com/questions/4010317/django-queryset-custom-manager-refresh-caching),
 
but received close to no replies... Does anyone here have an idea as to how 
I could solve my problem?

Many thanks in advance,

Mathieu

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: query fast on command line - slow via url

2010-12-20 Thread Tom Evans
On Sun, Dec 19, 2010 at 6:43 PM, NoviceSortOf  wrote:
> I'm trying to determine why our search queries return so slow.
>
> We are not doing anything fancy in our searches, simply searching
> for author, or title in a table of about 6000 books.
>
> http://www.rareorientalbooks.com/searchadv/
>
> On the command line using the exact code in the views.py everything
> returns instantly.
>
> When accessing the same code via url browser access all searches take
> a minimum of 10 seconds whether it returning 10 or 500 titles.
>
> __If via the command line the queries return instantly
>
> * am I right in thinking the bottleneck is somewhere else in the
>  process?
>
> * where might that bottleneck be and how can i streamline it?
>
> Any ideas appreciated.
>

When you evaluate a query on the command line, what you do not get
exactly the same behaviour as in a view context, an automatic limit of
maximum 21 items is added to the query. Many SQL queries can be
considerably faster with a limit statement on them without.

If you evaluate the queryset as a list, then you will get the
behaviour you get in your view, and the query should take much longer
to complete. As an example:

>>> from django.db import connection
>>> connection.queries=[]
>>> User.objects.filter()
[, . (snipped) ... , '...(remaining elements truncated)...']
>>> print connection.queries[0]['sql']
SELECT `auth_user`.`id`, `auth_user`.`username`,
`auth_user`.`first_name`, `auth_user`.`last_name`,
`auth_user`.`email`, `auth_user`.`password`, `auth_user`.`is_staff`,
`auth_user`.`is_active`, `auth_user`.`is_superuser`,
`auth_user`.`last_login`, `auth_user`.`date_joined` FROM `auth_user`
LIMIT 21
>>> list(User.objects.filter())
[, . (snipped) ... , ]
>>> print connection.queries[1]['sql']
SELECT `auth_user`.`id`, `auth_user`.`username`,
`auth_user`.`first_name`, `auth_user`.`last_name`,
`auth_user`.`email`, `auth_user`.`password`, `auth_user`.`is_staff`,
`auth_user`.`is_active`, `auth_user`.`is_superuser`,
`auth_user`.`last_login`, `auth_user`.`date_joined` FROM `auth_user`


Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: why will HttpResponseRedirect prevent re submit of form?

2010-12-20 Thread Tom Evans
On Mon, Dec 20, 2010 at 10:02 AM, Mingming Wang  wrote:
> Thanks a lot Javier! It takes me days to understand this.
> Hm...what if we don't use Redirect, what will happen in the wire? is it the
> following? If so, then no re submit problem lor. I must missed something
> out.
> <-  GET /yourapp/voteform/
> -> 200 OK (html with form)
> <- POST /yourapp/vote   (params)
> -> 200 OK (html with results)
>

The browser stores the state that a page was requested with. If at
this point, the user clicks refresh in their browser, then a browser
will typically resubmit the form, which is sub-optimal. By redirecting
to the appropriate page, you avoid this issue.

A common pattern with CRUD like queries is to redirect after any
modifying action, even if it is to the same page.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Custom SQL questions

2010-12-20 Thread Tim Sawyer

On 20/12/10 00:10, Andy wrote:



On Dec 19, 6:20 pm, Tim Sawyer  wrote:


I think so, yes.  Something like this:

You can then do something like

anObjectA = ObjectA.objects.filter(id=1)[0]
objectBs = ObjectB.objects.filter(object_a=anObjectA)


This requires 2 separate queries, right? I'm hoping to just have 1
trip to the DB.


You could do this instead to avoid the anObjectA instance:

objectBs = ObjectB.objects.filter(object_a__id=1)

Hope that helps.  I'm a bit confused by what you're selecting in:

  >  SELECT * FROM TableA JOIN TableB ON TableA.id=TableB.some_id
  >  WHERE TableA.id=1

What are you hoping to have returned?


I'm hoping to return the record from TableA with id=1 as well as all
the records from TableB with some_id=1.  Did I do that the wrong way?
An example would be in an auctioning system, return the details of the
auction with  id=1 and all the bids that have auction_id=1


lListOfBids = Bids.objects.filter(auction__id=1).select_related()

You could then reference lBid.auction on any of the bids to get the 
auction object.


Tim.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: why will HttpResponseRedirect prevent re submit of form?

2010-12-20 Thread Mingming Wang
Thanks a lot Javier! It takes me days to understand this.

Hm...what if we don't use Redirect, what will happen in the wire? is it the
following? If so, then no re submit problem lor. I must missed something
out.
<-  GET /yourapp/voteform/
-> 200 OK (html with form)
<- POST /yourapp/vote   (params)
-> 200 OK (html with results)


On Sun, Dec 19, 2010 at 7:36 PM, Javier Guerra Giraldez
wrote:

> On Sat, Dec 18, 2010 at 11:06 AM, Mingming Wang 
> wrote:
> > From the tutorial of Django, there is the following code in here
> > Who knows the mechanism behind a redirect or a direct response? Refer the
> > comments below. Thanks a lot!
>
> HttpResponseRedirect returns a 301 or 302 response code to the
> browser, instead of more common 200 (ok), or 404 (not found).  That
> simply instructs the browser to load the given URL.  The interesting
> part is that that given URL replaces the original (POST) one in the
> browser's history.
>
> for example, this is what happens on the wire:
>
> <-  GET /yourapp/voteform/
> -> 200 OK (html with form)
> <- POST /yourapp/vote   (params)
> -> 301 Redirect (/yourapp/voteresults/)
> <- GET (/yourapp/voteresults/)
> -> 200 OK (html with results)
>
> but this is what gets stored in the history:
>
> 1:
> action: GET /yourapp/voteform/
> cache: html with form (filled)
>
> 2:
> action: GET /yourapp/voteresult/
> cache: html with results
>
>
> see? no traces of the POST.  if you hit 'back' in the browser, you go
> to the form! the POST ceases to be an event, since from the point of
> view of the browser, its only result is to go to the /voteresult/
> page.
>
> Of course, the user is free to go back and hit the submit button
> again, but he's not presented with that cryptic "post again?" dialog.
>
> --
> Javier
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Forbidden (403) - CSRF verification failed. Request aborted.

2010-12-20 Thread Daniel Roseman

On 17 December 2010 19:46, hank23  wrote:
> Thanks for the note. Below is the screen code again which I've changed
> a little, plus the two views which deal with it. Let me know if you
> need anything else. Here's the screen code:
>
> Add Poll Question Screen
>
> {% if error_message %}{{ error_message }}{%
> endif %}
>
> {% csrf_token %}
>
> QUESTION: 
> value="please enter poll question text here">
> 
> 
>
> 
>
> Here's the code to display the screen initially:
>
> @csrf_protect
> def addnewpoll(request):
>p = get_list_or_404(Poll)
>dctnry = {}
>pollcount = 0
>for item in p:
>pollcount = pollcount + 1
>dctnry['pcount'] = pollcount
>return render_to_response('polls/addpoll.html', dctnry,
>
> context_instance=RequestContext(request))
>
> Here's the code of the view to receive the request after the addpoll
> button on the screen is clicked:
>
> @csrf_protect
> def addpoll(request):
>dctnry = {}
>dctnry['error_message'] = "No new poll data added"
>return render_to_response('polls/addpoll.html', dctnry,
>
> context_instance=RequestContext(request))
>
> This last block of code I just wanted to display an error messge on
> the screen the first time so I knew itwas receiving the request ok.
> How would I extract the question text from the textbox on the screen/
> request if I wanted to in this view, so that I could take it an create
> a new poll object? The documentation on django is good but sometimes
> pieces of information seem to be missing so that its difficult to
> figure how everything works. More examples with complete coding and
> more detailed explanations would help in some instances. Thanks in
> advance for the help.
>

This sort of user interaction is usually best done with Django forms. Look 
at the documentation for standard forms here:
http://docs.djangoproject.com/en/1.2/topics/forms/
The forms framework will handle form creation, display and validation. 
There's also a specific ModelForm class, which abstracts form creation based 
on a model and creating model instances based on the POSTed values, see 
here:
http://docs.djangoproject.com/en/1.2/topics/forms/modelforms/

Note specifically the "Using a form in a view" section of that first link, 
which shows the standard pattern of handling both the initial form request 
and the processing of the submitted data in the same view, rather than 
separate views for each. Also, you shouldn't need to specifically decorate 
your views with @csrf_protect: since version 1.2, CSRF protection is always 
on by default.

To answer your specific question on how to get access to POSTed values, you 
can always use request.POST['fieldname'] - see the request documentation 
here:
http://docs.djangoproject.com/en/1.2/ref/request-response/
But as I say above, you're better off using the forms framework in this 
situation.

One final point: your code above to get the count of Polls in your database 
is very inefficient. You can do in one go:
Poll.objects.all().count()
which simply sends a SELECT COUNT(*) to the database. 
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.