Re: How to access manipulator from admin change_form?

2006-11-08 Thread Mario Graziosi

Yes, Lorenzo, that's what I'm looking for.

Doing it for my own forms is quite easy. But, as you noted, I want that 
for a contrib.admin based form (specifically, the change_form which is 
the one that handles most new/edit tasks in the Admin framework).

If I had access to the manipulator, I'd be able to keep the admin logic 
intact and lay-out the data fields the way I wish.

Well, I'll try to find my own way to do what I want and, if successful, 
I'll post the solution in the hope it might be useful to other developers.

Thanks.

[EMAIL PROTECTED] wrote:
> Hi Mario,
>
> you probably need something like this:
>
> http://paste.e-scribe.com/2702/
>
> Though i wouldn't know how to apply it to the admin interface if that's
> what u want.
>
> Lorenzo
>
> On Nov 8, 4:43 pm, Mario Graziosi <[EMAIL PROTECTED]> wrote:
>   
>> Please,
>>
>> does anybody know how do I access the manipulator from withn the
>> template of the admin change_form?
>>
>> Thanks.
>>
>> --
>> Mario Graziosi, mailto:[EMAIL PROTECTED]
>> FG srl (http://www.fgasoftware.com/)
>> [EMAIL PROTECTED]: The agile PBX (http://www.voiceatwork.eu/)
>> Tel: 02 9350-4780 interno 101, Fax: 02 9139-0172
>> 
>
>
> >
>
>   


-- 
Mario Graziosi, mailto:[EMAIL PROTECTED]
FG srl (http://www.fgasoftware.com/)
[EMAIL PROTECTED]: The agile PBX (http://www.voiceatwork.eu/)
Tel: 02 9350-4780 interno 101, Fax: 02 9139-0172


--~--~-~--~~~---~--~~
 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 and upload paths

2006-11-08 Thread Mark Jarecki
Hi allI'm trying to use the value of a foreignkey as an input to the "upload_to" path of an image field (note I'm using ImageWithThumbnailField and it works properly when upload_to='Images/'). But i can't seem to form a proper string to enter. The images load into folders with names such as: When all I want is something like: Gallery1 (i.e. if the foreign key equals "Gallery1")My model looks something like this:def imageGalleryPath(self):     a = self                                  ### I'm uncertain what to write here, this gives folder mentioned above     return "%s/" % (a)class Gallery(models.Model):    ImageGalleryName = models.CharField(maxlength=200, core=True)    def __str__(self):       return self.ImageGalleryName    class Admin:        passclass GalleryImage(models.Model):    gallery = models.ForeignKey(Gallery, verbose_name="Gallery", core=True)    galleryimage = ImageWithThumbnailField(upload_to=imageGalleryPath(gallery), thumb_field='thumb', thumb_size=(200,150))    thumb = models.ImageField(upload_to='Thumbs/', blank=True, editable=False)    def __str__(self):         return self.galleryimage    class Admin:        passThanksMark
--~--~-~--~~~---~--~~
 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  -~--~~~~--~~--~--~---



unicode urls (not domains)

2006-11-08 Thread [EMAIL PROTECTED]

Does anyone know how much trouble I'll get myself into if I try to use
Norwegian characters in urlpatterns, e.g. I'd like to map the url
foo/blåbærsyltetøy.

I've noticed that if you type that into your browser's address bar each
browser does its own thing, Firefox url-encodes it using a iso-8859-1
(latin-1) encoding of the string, IE url-encodes using utf-8, and I'm
not quite sure what Opera does.

I managed to get all of them to display using

   (u'^foo/blåbærsyltetøy/$'.encode('utf-8'), 'myview'),
   (u'^foo/blåbærsyltetøy/$'.encode('iso-8859-1'), 'myview'),
   (u'^foo/blåbærsyltetøy/$', 'myview'),

I seem to recall that I couldn't get Opera to work without the last
one, but I could be remembering this incorrectly...

Has anyone done anything like this?

-- bjorn
~
   http://blog.tkbe.org
~


--~--~-~--~~~---~--~~
 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, RDF & XUL

2006-11-08 Thread James Bennett

On 11/8/06, benj <[EMAIL PROTECTED]> wrote:
> Does anyone have experience translating django models into RDF graphs?
> My ideal views would look something like this:

Off the top of my head I don't know of anyone who's done this, but it
would certainly be a useful thing to have available. Maybe we could
work on developing an RDF serializer to go into Django's serialization
framework..

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

--~--~-~--~~~---~--~~
 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, RDF & XUL

2006-11-08 Thread benj

Hi folks,
After using django for a number of more conventional projects, I'm
toying around with trying to use it to drive a XUL application. Using
django's template system to generate XUL views is easy enough, as is
passing serialized objects around with AJAX. However, most of XUL's
widgets use RDF data bindings, and I'm not finding a lot of resources
for working with them.

Does anyone have experience translating django models into RDF graphs?
My ideal views would look something like this:

def person_list_rdf(request, filter):
pl = Person.objects.filter(lname__icontains=filter) # or whatever else
I'm doing
rdf_list = translate_to_rdf_graph(pl)
return HTTPResponse(rdf_list)

I doubt anything will actually be that simple, but at this point I
don't even know where to start. Can anyone share experience, ideas, or
pointers?

Thanks,
Benj


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



get_FOO_display for a grouper

2006-11-08 Thread sorrison

I have a class with a "site" field that uses choices
I want to display the human readable name for it when being used as a
grouper

i thought something like
site.get_grouper_display or get_site.grouper_display

but that doesn't work

here is the template code

{% regroup object_list|dictsort:"group" by group as sites %}

{% for site in sites %}
{{ site.grouper }}

{% for buddy in site.list %}
{{ buddy.alias
}}
{% endfor %}

{% endfor %}


is there a way to do it?

Thanks,

Sam


--~--~-~--~~~---~--~~
 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: Order_by problem

2006-11-08 Thread nymbyl

It might be the problem of a tuple with only one item:
so instead of this:
words.get_list(order_by=('Word'))
use this:
words.get_list(order_by=('Word',))

It's interpreting ('Word') as ('W', 'o', 'r','d') ergo "unknown column
W.."


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



template tag or template filter? (Or just a bad idea?)

2006-11-08 Thread Rob Hudson

I'm wanting to add support for a sort of template language in the 
database content for our content providers.

We came up with this as a good syntax:

{% link URL as NAME [with KEY=VALUE [KEY=VALUE] [...]] %}

[ and ] aren't required, I'm just indicating the optional elements.

Our idea is we'd rather the teams use this than try to hard code links 
in the content themselves.  And if our programs migrate to other servers 
or environments (which is typical), we want all linking to route through 
a single function so we can change them.  This also covers external 
links so we can add things like class=external to add little icon 
indicators or whatever else.

I was thinking this made sense for a inclusion tag since there is an 
HTML snippet, but since it inherits the context and we're not simply 
replacing context variables with template variables, this didn't make sense.

So I started coding it as a filter since that passes in the content. 
And also doesn't require "evaluating" the database content using the 
template libraries but rather manipulates the content directly.

I'm not quite done yet but I do have the parsing and substitution 
working (see doc test below).  But I'm curious of general thoughts on 
this.  Is there an easier way?  A bad idea in general?

I gave a few tries at using the template libraries but didn't see an 
easy way to do it so I wrote my own parsing of this.  If I could 
integrate with the template libraries and make sort of a hybrid filter 
that uses template tag syntax that might be best, no?

Just now I thought that we could possibly hack up markdown to do this 
but I like the ease of the tokens and how they are similar to the Django 
syntax.  Versus something like [URL NAME](URL).  We can also make the 
syntax very English like, eg: {% jump to #anchor as "Click to jump" %}.

 >>> link.link_to("""{% link URL as NAME %}""")
'NAME'
 >>> link.link_to("""String before {% link URL as NAME %} and string 
after.""")
'String before NAME and string after.'
 >>> link.link_to("""This is a {% link http://google.com/ as "link to 
google" %}.""")
'This is a http://google.com/; class="external" 
target="_blank">link to google.'
 >>> link.link_to("""This is a {% link myfile.pdf as "PDF File" %}.""")
'This is a PDF File.'
 >>> link.link_to("""This is a {% link files/myfile.pdf as "PDF File 
with subdirectory" %}.""")
'This is a PDF File with 
subdirectory.'
 >>> link.link_to("""This is a {% link 2 as "Random page" with 
class=internal %} with extra attribute.""")
'This is a Random page with 
extra attribute.'
 >>> link.link_to("""This is a {% link 2 as "Random page" with 
class=internal id=internal1 %} with attributes.""")
'This is a Random 
page with attributes.'

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



Re: how are you handling i18n and m10l content?

2006-11-08 Thread Kenneth Gonsalves


On 08-Nov-06, at 5:22 PM, fdb wrote:

> Note again that it's perfectly fine to add objects in another language
> than the default that don't have translations in the default language.
> One restriction: you cannot translate a page that doesn't have a
> default language version.

i took a look at this - it seems to imply that there is only one  
translateable field in the model (I may be wrong). But for me a  
typical page model would have several Char fields and more than one  
text field. How does one handle that? I was thinking having

1. languages table - longname and shortname
2. for each table a translate table with fk to languages table and fk  
to the translated table. This table will contain only translateable  
fields (char and text). The two fks are unique_together. Whenever the  
app sees a text or char field, it searches for a translation to insert.
3. Translation would be page independant and table independant. For  
any given language, the app searches for all untranslated text and  
char fields and displays them, one can select to translate.
4. Provision should be made for automatically translating strings,  
review of this and review of translations themselves.

-- 

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



syncdb through web interface

2006-11-08 Thread viestards

Because many hosting providers does not allow shell access, I decided
to create web version of syncdb. I made this simple function, and
looks like it works

def db_sync(request):
from django.core import management
management.syncdb()
return HttpResponse("Db sync in progress.")

Is it really so simple, or is there is something I'm missing besides
sys. messages?
If so maybe model creation interfacwe can be built?

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



Re: filter records without parent

2006-11-08 Thread serbaut

Try parent__isnull=True.

http://www.djangoproject.com/documentation/db_api/


--~--~-~--~~~---~--~~
 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: Order_by problem

2006-11-08 Thread serbaut

I dont know what get_list is but this should get you all words in
order:

words = Word.objects.order_by('Word')

http://www.djangoproject.com/documentation/db_api/#order-by-fields


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



Re: Django/Javascript string problem

2006-11-08 Thread Dagur Páll Ammendrup

[EMAIL PROTECTED] wrote:
> I'm still not exactly sure what you're trying to do, but if you should
> be able to add fields to the form object you cloned pretty easily with
> appendChild.
>
>
>   
I tried that and it works great. Thanks for the suggestion :-)

--~--~-~--~~~---~--~~
 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/Javascript string problem

2006-11-08 Thread [EMAIL PROTECTED]

I'm still not exactly sure what you're trying to do, but if you should
be able to add fields to the form object you cloned pretty easily with
appendChild.


Dagur Páll Ammendrup wrote:
> [EMAIL PROTECTED] wrote:
> > But here's a question... why are you trying to put this object into a
> > string? Seems like you'd be better off just keeping it an object.
> > Perhaps you'd be better off with a simple
> > test = document.getElementById('id_embeddedvideo.0.type'); or, if you
> > needed to do something with it, maybe something like
> > test.cloneNode(true)
> >
> > Just a thought. It seems to me that at BEST, trying to put it into a
> > string is going to be fragile.
> >
> >
> >
> The idea is to spit out more fields dynamically (I just increment the
> .0. part each time). It worked great for other stuff. Example:
>
> var next_file_no = 1;
>
> function getFileField(){
> var orig = 'Description{{
> form.fileattachment.0.description }}File{{
> form.fileattachment.0.image }}{{ form.fileattachment.0.image_file }}';
> var filefields = document.getElementById('filefields');
> orig = orig.replace(/\.0\./g,'.' + next_file_no + '.');
> next_file_no += 1;
> filefields.innerHTML += orig;
> }
>
> Your idea is a little more work but I think I'll attempt that rather
> than creating a filter.


--~--~-~--~~~---~--~~
 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 2.0.58 will not OBEY on OS X 10.4.8

2006-11-08 Thread sorrison

Can you tell us what your apache logs say?

hard to tell what is going on.

In the directory templates do you have your python code?

The way you've got it apache is expecting your settings file to be
/Users/kimvandenbroek/Sites/templates/mysite/settings.py
is that where it is?

Cheers,

Sam


On Nov 8, 12:51 pm, "kmr" <[EMAIL PROTECTED]> wrote:
> Running Apache 2.0.58 (Unix), mod_python 3.1.4, and Python 2.4.1 on Mac
> OS X 10.4.8
>
> I've been able to run Django using the Development Server, and I've run
> the tests to prove mod_python and Python work. However, when I try to
> configure Apache using the entries shown below, I get a 500 Internal
> Server Error when I go tohttp://django.loc/admin/
>
> 
> DocumentRoot /Users/kimvandenbroek/Sites/templates
>
> 
> SetHandler mod_python
> PythonHandler django.core.handlers.modpython
> PythonPath sys.path+['/Users/kimvandenbroek/Sites/templates']
> SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> 
> 
>
> In the above I've tried  and 
> 
> Must make Apache OBEY. Ideas? -- thanks in advance.
> --
> kmr


--~--~-~--~~~---~--~~
 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: Template Loader for PHP files

2006-11-08 Thread Jeremy Dunck

On 11/8/06, Waylan Limberg <[EMAIL PROTECTED]> wrote:
> >
> You want to focus on the "Loading Templates" [1] section, more
> specifically, the "Loader Types" [2] sub-section.  Add the new loader
> to the "TEMPLATE_LOADERS" setting in your settings.py file. Then
> you'll need to make sure that your TEMPLATE_DIRS [3] setting points to
>  the directory which contains your php templates.

I think you'll also need to add a bunch of environment variables to
the PHP sub-process.

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



Re: How to access manipulator from admin change_form?

2006-11-08 Thread [EMAIL PROTECTED]

Hi Mario,

you probably need something like this:

http://paste.e-scribe.com/2702/

Though i wouldn't know how to apply it to the admin interface if that's
what u want.

Lorenzo

On Nov 8, 4:43 pm, Mario Graziosi <[EMAIL PROTECTED]> wrote:
> Please,
>
> does anybody know how do I access the manipulator from withn the
> template of the admin change_form?
>
> Thanks.
>
> --
> Mario Graziosi, mailto:[EMAIL PROTECTED]
> FG srl (http://www.fgasoftware.com/)
> [EMAIL PROTECTED]: The agile PBX (http://www.voiceatwork.eu/)
> Tel: 02 9350-4780 interno 101, Fax: 02 9139-0172


--~--~-~--~~~---~--~~
 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: Running Django with Lighttpd on TextDrive...

2006-11-08 Thread Joseph Heck
Hi Tom,First - the last "nohup pythjon... manage.py runserver" *IS* running your development server. When running in a production setup, you don't want that in there at all.In general the TxtDrive setup has the 
django-fcgi.py script running the actual django code, and it talks across a named socket that you have defined with the --socket option.Your lighttpd.conf file should have that same socket defined in it's config file (I'd need to see it to tell you if you have it correctly set up), and it communicates to the python instances through that socket and presents the results on the port that it is configured to talk out.
The TxtDrive apache front end is generally set up with a proxy that re-routes the traffic from port 80 on your host setup to the port that lighttpd is running. That port was assigned by the TxtDrive staff.
-joeOn 11/8/06, Tom Smith <[EMAIL PROTECTED]> wrote:
Now I know that it is always hard to comment on specifics but I havejust discovered something very strange on my server and couldsomeone please help...I am running Django on Textdrive which requires Lightpd. I went
through the setup... and boy that was difficult, so many config filesand calls but eventually I got it running...But my server was reallyslow...I then tweaked my lighttpd.conf file and it all fell over... I was
panicking... but then noticed people were still accessing myserver... what? how?So.. what I have now discovered is that, because of an Apachedirective to map / onto /my_port_number... ACTUALLY, lighttpd isn't
serving the pages at all... apache is... and my django install isrunning in development mode!!! (I think)...I'd followed the Lighttp The Painless Way, http://
manuals.textdrive.com/read/chapter/62 , and somewhere, somehow I'vemessed it up...Could someone explain how the hell the django-fcgi.py,  main.fcgi,lighttpd.conf, apache and django work together or even better
help me...I had created some scripts to try toa. start the django-fcgi.py stuffb. start lighttpdc. start django...But they fail at b... giving me...[EMAIL PROTECTED]
$ 2006-11-08 11:07:16: (mod_fastcgi.c.1048) thefastcgi-backend /home/tomsmith/domains/burningahole.co.uk/web/public/django-fcgi.py failed to start:2006-11-08 11:07:16: (mod_fastcgi.c.1052) child exited with status 0 /
home/tomsmith/domains/burningahole.co.uk/web/public/django-fcgi.py2006-11-08 11:07:16: (mod_fastcgi.c.1055) if you try do run PHP asFastCGI backend make sure you use the FastCGI enabled version.You can find out if it is the right one by executing 'php -v' and it
should display '(cgi-fcgi)' in the output, NOT (cgi) NOR (cli)For more information check http://www.lighttpd.net/documentation/fastcgi.html#preparing-php-as-a-fastcgi-program
2006-11-08 11:07:16: (mod_fastcgi.c.1060) If this is PHP on Gentooadd fastcgi to the USE flags2006-11-08 11:07:16: (mod_fastcgi.c.1356) [ERROR]: spawning fcgi failed.2006-11-08 11:07:16: (server.c.834) Configuration of plugins failed.
Going down but at some point it DID work (even if it wasn't actuallyresponsible for serving the files)Any advice gratefully received...SHOULD my server.document-root be set to my django instance, with
port number? rather than.../home/tomsmith/domains/burningahole.co.uk/web/public/tomp.s my scripts were...python /users/home/tomsmith/domains/burningahole.co.uk/web/public/django-fcgi.py
 --projects=/users/home/tomsmith/domains/burningahole.co.uk/bah/ --settings=bah.settings--socket=/users/home/tomsmith/domains/burningahole.co.uk/tmp/django.socket --daemon
/usr/local/sbin/lighttpd -f /home/tomsmith/domains/burningahole.co.uk/lighttpd/lighttpd.confnohup python /users/home/tomsmith/domains/burningahole.co.uk/bah/manage.py runserver www.burningahole.com:port_number
 &

--~--~-~--~~~---~--~~
 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: Template Loader for PHP files

2006-11-08 Thread Waylan Limberg

On 11/8/06, Gerard Whittey <[EMAIL PROTECTED]> wrote:
>
> I saw the ticket for this Template Loader for PHP files
> http://code.djangoproject.com/ticket/2440
>
> I was wondering if someone could explain how you would integrate this
> into a django project. I read through the docs about templates but it
> was beyond me as I am just starting to learn python.
>
> I just need to be able to test out if this php template loader will work
>   so I can convince the "bosses" we need to switch from php to this.
>
You want to focus on the "Loading Templates" [1] section, more
specifically, the "Loader Types" [2] sub-section.  Add the new loader
to the "TEMPLATE_LOADERS" setting in your settings.py file. Then
you'll need to make sure that your TEMPLATE_DIRS [3] setting points to
 the directory which contains your php templates.


[1]: 
http://www.djangoproject.com/documentation/templates_python/#loading-templates
[2]: http://www.djangoproject.com/documentation/templates_python/#loader-types
[3]: 
http://www.djangoproject.com/documentation/templates_python/#the-template-dirs-setting

-- 

Waylan Limberg
[EMAIL PROTECTED]

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



Re: Order_by problems

2006-11-08 Thread Pythoni

Don,
Thank you very much for your help. You are right.
I added a comma and now it works!
L.


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



Order_by problem

2006-11-08 Thread Pythoni

I have this very simple model for a table

...
class Word(meta.Model):
  Word=meta.CharField(maxlength=50)
  def __repr__(self):
return self.Word
  class META:
  admin = meta.Admin()

.
Now when I try:
words.get_list(order_by=('Word'))

I will get the error:
OperationalError: (1054, "Unknown column 'mimi_words.W' in 'order
clause'")

Can anyone help/explain the problem?( mimi is a database)
Thank you
L.


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



Problem with ordering (ORDER_BY)

2006-11-08 Thread Pythoni

I have this very simple model for a table

...
class Word(meta.Model):
  Word=meta.CharField(maxlength=50)
  def __repr__(self):
return self.Word
  class META:
  admin = meta.Admin()

.
Now when I try:
words.get_list(order_by=('Word'))

I will get the error:
OperationalError: (1054, "Unknown column 'mimi_words.W' in 'order
clause'")

Can anyone help/explain the problem?( mimi is a database)
Thank you
L.


--~--~-~--~~~---~--~~
 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: repopulation of formfields with select fields not working

2006-11-08 Thread Mario Graziosi

Excuse me Patrick: is this a new question or a reply to my question?

 From within the change_form template I need to access the manipulator 
to be able to create the form data entry fields. I have no way to pass a 
Context from within my urls.conf since the template is instantiated and 
handled from within contrib.admin.

Anyone can help?


Patrick Lauber wrote:
> I have the following view and i want to prepulate the selected Country,
> City, and Languages
>
>
>
> def details(request):
> manipulator = UserPrefs.AddManipulator()
> if request.method == 'POST':
> ...
> ...
> else:
> cacheGeo(request)
> errors = {}
> # Prepolulate country, city, languages 
> new_data = {}
> new_data['city']=request.session['geo_city']  
> new_data['country_id'] = Countries.objects.get(
> name__exact=request.session['geo_country']).id
> print new_data
> # Create the FormWrapper, template, context, response.
> form = forms.FormWrapper(manipulator, new_data, errors)
> return render_to_response('accounts/register_details.html', {'form':
> form,'user':request.user})
>
>
> but there seams that the selection fields dont get selected how do i
> solve this problem?
>
> Cheers
>
> Pat
>
>
> >
>
>   


-- 
Mario Graziosi, mailto:[EMAIL PROTECTED]
FG srl (http://www.fgasoftware.com/)
[EMAIL PROTECTED]: The agile PBX (http://www.voiceatwork.eu/)
Tel: 02 9350-4780 interno 101, Fax: 02 9139-0172


--~--~-~--~~~---~--~~
 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: Order_by problems

2006-11-08 Thread Don Arbow

On Nov 8, 2006, at 12:13 AM, Pythoni wrote:
>
> 
> Now when I try:
> words.get_list(order_by=('Word'))
>
> I will get the error:
> OperationalError: (1054, "Unknown column 'mimi_words.W' in 'order
> clause'")



This is a basic Python error. You have a tuple with only one item, so  
you need to put a comma after it, otherwise Python thinks you're  
passing a tuple of letters ('W','o','r','d'), which is why you're  
seeing the field name as 'W'. Try this instead:

words.get_list(order_by=('Word',))

or use a list instead:

words.get_list(order_by=['Word'])

Don



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



How to access manipulator from admin change_form?

2006-11-08 Thread Mario Graziosi

Please,

does anybody know how do I access the manipulator from withn the 
template of the admin change_form?

Thanks.

-- 
Mario Graziosi, mailto:[EMAIL PROTECTED]
FG srl (http://www.fgasoftware.com/)
[EMAIL PROTECTED]: The agile PBX (http://www.voiceatwork.eu/)
Tel: 02 9350-4780 interno 101, Fax: 02 9139-0172


--~--~-~--~~~---~--~~
 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/Javascript string problem

2006-11-08 Thread [EMAIL PROTECTED]

But here's a question... why are you trying to put this object into a
string? Seems like you'd be better off just keeping it an object.
Perhaps you'd be better off with a simple
test = document.getElementById('id_embeddedvideo.0.type'); or, if you
needed to do something with it, maybe something like
test.cloneNode(true)

Just a thought. It seems to me that at BEST, trying to put it into a
string is going to be fragile.


--~--~-~--~~~---~--~~
 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/Javascript string problem

2006-11-08 Thread Dagur


Jay Parlar wrote:
> On 11/8/06, Dagur <[EMAIL PROTECTED]> wrote:
> >
> > Unfortunately that's exactly the filter I tried using when I got that
> >
> >  "Caught an exception while rendering: 'FormFieldWrapper' object has no
> > attribute 'replace'"
> >
> > error.
>
> Could you write your own filter to clean up the output to an acceptable level?
>
> That's maybe not an ideal solution from your point of view, but it should 
> work.
>
> Jay P.


I guess I could, but it will be like a wart on my beautiful 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
-~--~~~~--~~--~--~---



Template Loader for PHP files

2006-11-08 Thread Gerard Whittey

I saw the ticket for this Template Loader for PHP files
http://code.djangoproject.com/ticket/2440

I was wondering if someone could explain how you would integrate this 
into a django project. I read through the docs about templates but it 
was beyond me as I am just starting to learn python.

I just need to be able to test out if this php template loader will work 
  so I can convince the "bosses" we need to switch from php to 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-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: Re: Using admin js in template code

2006-11-08 Thread John Hwang

I figured it out...

the template needs:



the jsi18n file has the gettext() function

Hope that works for you too.

/JohnH

On 11/8/06, John Hwang <[EMAIL PROTECTED]> wrote:
> I'm trying the exact same thing but the widgets do not seem to
> display.  I'd like to display the date/time pickers but the event
> doesn't seem to be triggered.
>
> I'm also getting errors in firebug about gettext() function.
>
> Any help/suggestion would be great.
>
> Thanks,
>
> /John
>
> On 11/1/06, Guillermo Fernandez Castellanos
> <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > I've a model with a DateTimeField in it, and I'm creating a form to add 
> > objects.
> >
> > So, I create the form for the DateTimeField. Up to here, everything
> > ok, it works.
> >
> > Now I would like to add the js helpers we can find when we use the
> > admin to create an object (the little calendar and watch with 'Today'
> > and 'Now' besides).
> >
> > I add in the header the following:
> > 
> > 
> >  > src="/admin_media/js/core.js"> > src="/admin_media/js/admin/RelatedObjectLookups.js"> > type="text/javascript"
> > src="/admin_media/js/calendar.js"> > type="text/javascript"
> > src="/admin_media/js/admin/DateTimeShortcuts.js">
> > but it does not seem to work.
> >
> > I've surrounded the DateTimeField form with:
> > 
> > 
> > 
> > 
> > but it does not seem to work neither.
> >
> > Someone has an idea about how I could make it work?
> >
> > Thanks a lot,
> >
> > G
> >
> > > >
> >
>
>
> --
> John Hwang
>


-- 
John Hwang

--~--~-~--~~~---~--~~
 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: Order_by problems

2006-11-08 Thread Pythoni

Mike,
Yes, there is `Word` in words.get_list(order_by=('Word'))
because Word is a name of  the field.
Do you have any other idea where a problem could be?
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: Using admin js in template code

2006-11-08 Thread John Hwang

I'm trying the exact same thing but the widgets do not seem to
display.  I'd like to display the date/time pickers but the event
doesn't seem to be triggered.

I'm also getting errors in firebug about gettext() function.

Any help/suggestion would be great.

Thanks,

/John

On 11/1/06, Guillermo Fernandez Castellanos
<[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I've a model with a DateTimeField in it, and I'm creating a form to add 
> objects.
>
> So, I create the form for the DateTimeField. Up to here, everything
> ok, it works.
>
> Now I would like to add the js helpers we can find when we use the
> admin to create an object (the little calendar and watch with 'Today'
> and 'Now' besides).
>
> I add in the header the following:
> 
> 
>  src="/admin_media/js/core.js"> src="/admin_media/js/admin/RelatedObjectLookups.js"> type="text/javascript"
> src="/admin_media/js/calendar.js"> type="text/javascript"
> src="/admin_media/js/admin/DateTimeShortcuts.js">
> but it does not seem to work.
>
> I've surrounded the DateTimeField form with:
> 
> 
> 
> 
> but it does not seem to work neither.
>
> Someone has an idea about how I could make it work?
>
> Thanks a lot,
>
> G
>
> >
>


-- 
John Hwang

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



Re: how are you handling i18n and m10l content?

2006-11-08 Thread Aidas Bendoraitis

Hello, Frederik,

Your approach has one major problem. If the model has both
translatable and untranslatable content, just like boolean
is_published or foreign key to category, or price (if the object is a
product), then the original and it's translations must duplicate the
untranslatable data which makes the models harder to manage.

Regards,
Aidas Bendoraitis [aka Archatas]



On 11/8/06, fdb <[EMAIL PROTECTED]> wrote:
>
> I'd like to show you my approach, which I use for one of my clients.
>
> For every model that needs to have multi-lingual content, you add two
> fields: a "language" and a "translation_of" field.
>
> Objects are created in a default language (altough this is not
> required). To translate an object, you create a new page and set the
> translation_of field to the object in the default language that you are
> translating.
>
> A set of helper methods allow you to get the root version of the object
> (in the default language), all translations of an object, or a specific
> translation. These are useful for adding translation links.
>
> Here is the code:
>
> http://www.bigbold.com/snippets/posts/show/2979
>
> Note again that it's perfectly fine to add objects in another language
> than the default that don't have translations in the default language.
> One restriction: you cannot translate a page that doesn't have a
> default language version.
>
> Frederik
>
>
> >
>

--~--~-~--~~~---~--~~
 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/Javascript string problem

2006-11-08 Thread Jay Parlar

On 11/8/06, Dagur <[EMAIL PROTECTED]> wrote:
>
> Unfortunately that's exactly the filter I tried using when I got that
>
>  "Caught an exception while rendering: 'FormFieldWrapper' object has no
> attribute 'replace'"
>
> error.

Could you write your own filter to clean up the output to an acceptable level?

That's maybe not an ideal solution from your point of view, but it should work.

Jay P.

--~--~-~--~~~---~--~~
 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/Javascript string problem

2006-11-08 Thread Dagur

Unfortunately that's exactly the filter I tried using when I got that

 "Caught an exception while rendering: 'FormFieldWrapper' object has no
attribute 'replace'"  

error.


--~--~-~--~~~---~--~~
 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: Store uploaded image by id

2006-11-08 Thread Dirk Eschler

Am Mittwoch, 8. November 2006 02:06 schrieb Enrico:
> Hi Dirk,
>
> I'm the author of that Wiki page, I've put that code on
> '/util/'.
>
> You could put somewhere else in your python path if you plan to use it
> in more projects.
> But Django doesn't look for custom fields anywhere, you'll have to
> import in your code.
>
> Best regards.
> Enrico

Hi Enrico,

thanks for sharing the code. Import sounds reasonable, i guess too much 
automation easily gets counterproductive.

-- 
Dirk Eschler 
http://www.krusader.org

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



custom manipulator check if field is filling

2006-11-08 Thread Grigory Fateyev

Hello!

How can check if field is filling in the form using custom
manipuplator? The idia is, if user has permisson to edit article or has
authenticated field 'Publish' is visible in form, if not visible add
article with publish = 0. How to do this? My code is not working...

self.fields = (
forms.TextField(field_name='headline', is_required=True,
maxlength=100), 
forms.HiddenField(field_name='author'),
forms.LargeTextField(field_name='brief', is_required=True),
forms.LargeTextField(field_name='body'),
forms.IntegerField(field_name='publish', is_required=True),
)
def save(self, new_data):
obj = Article(
headline = new_data['headline'],
author = User.objects.get(pk=self.request.user.id),
brief = new_data['brief'],
body = new_data['body'],
if not new_data.has_key('publish'):
publish = 0,
else:
publish = new_data['publish'],
)
obj.save()

Thanks.

-- 
Всего наилучшего! Григорий
greg [at] anastasia [dot] ru
Письмо отправлено: 2006/11/08 15:58

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



image field with too long path names

2006-11-08 Thread Patrick Lauber

Hi i have a imagefield and if i upload a file i get:

"Data too long for column 'image' at row 1"

How can i increase the column length... maxlength seams not to work?

Cheers

Patrick Lauber


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



Re: Custom SQL/Paginator problems

2006-11-08 Thread soundseeker

> Hello soundseeker!
> On Mon, 06 Nov 2006 02:20:25 -0800 you wrote:
>
> > def show_categories(request, col, direction):
> > paginate_by = 15
> > paginator =
> > ObjectPaginator(VMergeDocsInfo.objects.all().by_categories(),
> > paginate_by)
>
> Maybe something like this: VMergeDocsInfo.objects.by_categories()?
>
hello grigory,

that's what happen:
Exception Type: AttributeError
Exception Value:'Manager' object has no attribute 'by_categories'

thank you,
robert


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



filter records without parent

2006-11-08 Thread Kamil Wdowicz

Hello,

I need all records of _Category_ that doesn't have _parent_:
In my model:

#
class Category(models.Model):

#... code here

parent = models.ForeignKey('self', blank=True, null=True,
related_name='child_set')
##

all_categorys = Category.objects.all().filter(parent=None)

this doesn't work - gives me empty []

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



Re: how are you handling i18n and m10l content?

2006-11-08 Thread fdb

I'd like to show you my approach, which I use for one of my clients.

For every model that needs to have multi-lingual content, you add two
fields: a "language" and a "translation_of" field.

Objects are created in a default language (altough this is not
required). To translate an object, you create a new page and set the
translation_of field to the object in the default language that you are
translating.

A set of helper methods allow you to get the root version of the object
(in the default language), all translations of an object, or a specific
translation. These are useful for adding translation links.

Here is the code:

http://www.bigbold.com/snippets/posts/show/2979

Note again that it's perfectly fine to add objects in another language
than the default that don't have translations in the default language.
One restriction: you cannot translate a page that doesn't have a
default language version.

Frederik


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



Running Django with Lighttpd on TextDrive...

2006-11-08 Thread Tom Smith

Now I know that it is always hard to comment on specifics but I have  
just discovered something very strange on my server and could  
someone please help...

I am running Django on Textdrive which requires Lightpd. I went  
through the setup... and boy that was difficult, so many config files  
and calls but eventually I got it running...But my server was really  
slow...

I then tweaked my lighttpd.conf file and it all fell over... I was  
panicking... but then noticed people were still accessing my  
server... what? how?

So.. what I have now discovered is that, because of an Apache  
directive to map / onto /my_port_number... ACTUALLY, lighttpd isn't  
serving the pages at all... apache is... and my django install is  
running in development mode!!! (I think)...

I'd followed the Lighttp The Painless Way, http:// 
manuals.textdrive.com/read/chapter/62 , and somewhere, somehow I've  
messed it up...

Could someone explain how the hell the django-fcgi.py,  main.fcgi,  
lighttpd.conf, apache and django work together or even better  
help me...

I had created some scripts to try to
a. start the django-fcgi.py stuff
b. start lighttpd
c. start django...
But they fail at b... giving me...

[EMAIL PROTECTED] 2006-11-08 11:07:16: (mod_fastcgi.c.1048) the  
fastcgi-backend /home/tomsmith/domains/burningahole.co.uk/web/public/ 
django-fcgi.py failed to start:
2006-11-08 11:07:16: (mod_fastcgi.c.1052) child exited with status 0 / 
home/tomsmith/domains/burningahole.co.uk/web/public/django-fcgi.py
2006-11-08 11:07:16: (mod_fastcgi.c.1055) if you try do run PHP as  
FastCGI backend make sure you use the FastCGI enabled version.
You can find out if it is the right one by executing 'php -v' and it  
should display '(cgi-fcgi)' in the output, NOT (cgi) NOR (cli)
For more information check http://www.lighttpd.net/documentation/ 
fastcgi.html#preparing-php-as-a-fastcgi-program
2006-11-08 11:07:16: (mod_fastcgi.c.1060) If this is PHP on Gentoo  
add fastcgi to the USE flags
2006-11-08 11:07:16: (mod_fastcgi.c.1356) [ERROR]: spawning fcgi failed.
2006-11-08 11:07:16: (server.c.834) Configuration of plugins failed.  
Going down.

... but at some point it DID work (even if it wasn't actually  
responsible for serving the files)

Any advice gratefully received...

SHOULD my server.document-root be set to my django instance, with  
port number? rather than.../home/tomsmith/domains/burningahole.co.uk/ 
web/public/


tom

p.s my scripts were...

python /users/home/tomsmith/domains/burningahole.co.uk/web/public/ 
django-fcgi.py --projects=/users/home/tomsmith/domains/ 
burningahole.co.uk/bah/ --settings=bah.settings
--socket=/users/home/tomsmith/domains/burningahole.co.uk/tmp/ 
django.socket --daemon

/usr/local/sbin/lighttpd -f /home/tomsmith/domains/burningahole.co.uk/ 
lighttpd/lighttpd.conf

nohup python /users/home/tomsmith/domains/burningahole.co.uk/bah/ 
manage.py runserver www.burningahole.com:port_number &





--~--~-~--~~~---~--~~
 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: what's the correct way to create object with ForeignKey?

2006-11-08 Thread Aidas Bendoraitis

Use either

e = Subgroup.objects.get(subGroupName="p1sub1")
e.save()
m = User(name="xxx", subGroup=e)
m.save()

or

e = Subgroup.objects.get(subGroupName="p1sub1")
e.save()
e.user_set.create(name="xxx")

or

e = Subgroup.objects.get(subGroupName="p1sub1")
e.save()
m = User(name="xxx")
m.save()
e.user_set.add(m)


Good luck!
Aidas Bendoraitis [aka Archatas]



On 11/8/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I know this maybe very simple, but I can't find the answers on the net,
> I'm using following method to create object with ForeignKey, this
> however works,
> but according to django document you should avoid using "_id"  column,
> what's the correct way to do this? any idea? (running django 0.95)
>
> =
> in shell/view:
>
> m = User()
> e = Subgroup.objects.get(subGroupName="p1sub1")
>
> m.name="xxx"
> m.subGroup_id=e.subGroupName
> m.save()
>
> =
> model.py:
>
> class User(models.Model):
> name = models.CharField(maxlength=255,primary_key=True)
> subGroup = models.ForeignKey('Subgroup')
>  .
>
> class Subgroup(models.Model):
> subGroupName = models.CharField(maxlength=255,primary_key=True)
> .
>
>
> >
>

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



what's the correct way to create object with ForeignKey?

2006-11-08 Thread [EMAIL PROTECTED]

I know this maybe very simple, but I can't find the answers on the net,
I'm using following method to create object with ForeignKey, this
however works,
but according to django document you should avoid using "_id"  column,
what's the correct way to do this? any idea? (running django 0.95)

=
in shell/view:

m = User()
e = Subgroup.objects.get(subGroupName="p1sub1")

m.name="xxx"
m.subGroup_id=e.subGroupName
m.save()

=
model.py:

class User(models.Model):
name = models.CharField(maxlength=255,primary_key=True)
subGroup = models.ForeignKey('Subgroup')
 .

class Subgroup(models.Model):
subGroupName = models.CharField(maxlength=255,primary_key=True)
.


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



Re: Custom SQL/Paginator problems

2006-11-08 Thread Grigory Fateyev

Hello soundseeker!
On Mon, 06 Nov 2006 02:20:25 -0800 you wrote:

> def show_categories(request, col, direction):
>   paginate_by = 15
>   paginator =
> ObjectPaginator(VMergeDocsInfo.objects.all().by_categories(),
> paginate_by)

Maybe something like this: VMergeDocsInfo.objects.by_categories()?

-- 
Всего наилучшего! Григорий
greg [at] anastasia [dot] ru
Письмо отправлено: 2006/11/08 13:54

--~--~-~--~~~---~--~~
 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: Nesh Thumbnail - Installation problem

2006-11-08 Thread Grigory Fateyev

Hello Mark Jarecki!
On Tue, 7 Nov 2006 18:27:26 +1100 you wrote:

> Thanks guys
> 
> Ended up that the Python Imaging Library was not correctly
> installed. It all works now!
> 
> Cheers

Thanks too from me.

Do you planing to do field type for custom manipulator?

-- 
Всего наилучшего! Григорий
greg [at] anastasia [dot] ru
Письмо отправлено: 2006/11/08 13:52

--~--~-~--~~~---~--~~
 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: Order_by problems

2006-11-08 Thread Mike

Hi L,

Could it be that the 'W' in 'Word' in your order_by attribute is in
upper-case?

- Mike


--~--~-~--~~~---~--~~
 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/Javascript string problem

2006-11-08 Thread Dagur

Sorry for the vague explanation. To make a long story short I'm trying
to put the output of {{ blah }} into a javascript string, but since {{
blah }} prints out multiple lines, it won't work.


--~--~-~--~~~---~--~~
 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: Model structure help requested

2006-11-08 Thread Vortexmind

So I assume I can, using object_id primary key and Content_Type,
identify all objects? And so, apart from the comments problem, this is
what I should use to associate one object generically to another?

For example I could write an app to attach "photos" (and not comments,
so we don't use the contrib app :) ... using the fields above to relate
to various objects... 

Thank you for your very clear response!


--~--~-~--~~~---~--~~
 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: Issues with FastCGI

2006-11-08 Thread [EMAIL PROTECTED]

I'll update PL and EN versions :)


--~--~-~--~~~---~--~~
 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: UnicodeEncodeError with templatetags

2006-11-08 Thread Ivan Sagalaev

David Abrahams wrote:
> Oh, wow; I may well be doing that all over.  Is it possible to
> instruct Python to make that an error rather than silently succeeding
> to do something that I shouldn't do?

I'm not sure but I remember reading that in Python 2.5 it becomes a 
Warning...

>> The question is in what byte encoding to encode. It 
>> looks obvious to convert it into settings.DEFAULT_CHARSET since it's an 
>> encoding of all your output. However if you set DEFAULT_CHARSET into 
>> some legacy encoding (i.e. other than 'utf-8') 
> 
> I don't set it to anything explicitly, so I have the default
> DEFAULT_CHARSET.

Then it's 'utf-8' which is how it should be anyway :-)

> Well, that's very instructive, thank you!  But again, my main concern
> is that I'm probably doing something bad all over, by combining byte
> strings with unicode strings.

Implicit combining is bad, yes. Explicit conversions are now required if 
you do some fancy string staff (uppercasing, lowercasing, getting 
length). If all you do is concatenation then it will work for byte 
strings without conversion. This is why I suggested it: your code seems 
to only do concatenation.

In some future (after hassle with current branches is over) Django will 
do automatic decoding of input bytes into unicode strings and apps will 
work with them exclusively.

> By the way, is there a reference that describes Python's string
> abstractions?

This one is good: http://docs.python.org/lib/encodings-overview.html

> I take it from your use of the terms "unicode string"
> and "byte string" that they are not in fact congruent to one another.
> Let me guess: a byte string (e.g. 'abcdef') is a semantically void
> container of bytes that might be used for ascii, utf-8, or something
> else... and a "unicode string" is a container of code points?

Yes, pretty much.

Byte strings are encoded representation intended for serialization, 
storing, transferring. Unicode strings are code points in the form of 2 
or 4 bytes digits (the latter is more common in todays Python 
installations) intended for working with actual letters.

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



Re: how are you handling i18n and m10l content?

2006-11-08 Thread Aidas Bendoraitis

Some time ago, I also wrote a few thoughts about implementation of
multilingual content:
http://groups.google.com/group/django-users/browse_frm/thread/13ae7f762d1d5d5e

Maybe that will help us to make the final decision.

Aidas Bendoraitis [aka Archatas]



On 11/8/06, Gonzalo Saavedra <[EMAIL PROTECTED]> wrote:
>
> On 11/7/06, Bill de hOra <[EMAIL PROTECTED]> wrote:
> > Hey,
> >
> > I know Django has solid i18n support for templates/strings and content
> > negotiation in the request. But I was wondering how people are going
> > about managing translations of content or having a multilingual website
> > - eg supporting features like "read this in newspeak", or "browse this
> > site in klingon". More realistic examples would be Wikipedia or Plone's
> > ability to set the portal language.
> >
> > There's no direct support for this kind of thing in the core (that's
> > afaik, I haven't been following the trunk in the last couple of months).
> > And, if there's no standard patterns or models for this, is this worth
> > thinking about at as an extension app? In my part of the world, being
> > able to run a multilingual site is often a 'checkbox' requirement.
> >
> > cheers
> > Bill
>
> I'd been reserching and trying to come up with some ideas on this
> matter, hoping to get to an elegant and simple solution since I'm
> involved with two django projects which will need content translation.
>
> Some months ago a similar thread was discused on this list:
> http://groups.google.com.uy/group/django-users/browse_thread/thread/ef78a6787a98bc68/2aabccc699388fad
> I think there are some interesting ideas there... so I took Georg
> ideas as a starting point, what do you think about his aproach?
>
> I'm definitely interested on working with others to see this feature
> in django in the future.
>
> gonz.
> --
> Gonzalo Saavedra <[EMAIL PROTECTED]>
>
> >
>

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



Order_by problems

2006-11-08 Thread Pythoni


I have this very simple model for a table

...
class Word(meta.Model):
  Word=meta.CharField(maxlength=50)
  def __repr__(self):
return self.Word
  class META:
  admin = meta.Admin()

.
Now when I try:
words.get_list(order_by=('Word'))

I will get the error:
OperationalError: (1054, "Unknown column 'mimi_words.W' in 'order
clause'")

Can anyone help/explain the problem?( mimi is a database)
Thank you
L.


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