HOT PICS OF INDIAN BABES

2007-03-02 Thread hot babe
HOT PICS OF BOLLYWOOD ACTRESS
http://bollywoodactress.blogspot.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-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: Customizing the class returned by newforms.form_for_model()

2007-03-02 Thread brooks

One option would be to simply re-assign the value for that field in
the form instance/class base_fields, ala:

Model_Form = forms.models.form_for_model(Model)
Model_Form.base_fields['multi_field'] = forms.CharField(maxlength=150,
initial=Model_Form.base_fields['multi_field'].initial)

Hope that helps.

On Jan 15, 9:08 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> I am looking for a way to modify certain aspects of a Form class
> returned by newforms.form_for_model().  I have a ManyToManyField(Tag)
> attribute in my model and form_for_model() makes that a multiple
> select.  I was wondering if it was possible to change just that field
> to a CharField (and then I'd modify save() to use get_or_create).
>
> Thank you very much


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



Re: Weird session

2007-03-02 Thread Malcolm Tredinnick

On Fri, 2007-03-02 at 14:37 +, Seth Buntin wrote:
> I would love to tackle this issue, since it is to my advantage, but
> really don't know where to start.  Any ideas?

I would start with the Session object itself -- have a look in
django/contrib/sessions/ -- since any general solution will need to work
whether sessions are created by middleware or directly by users.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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 would cause CookieError: Illegal Key Value?

2007-03-02 Thread Malcolm Tredinnick

On Fri, 2007-03-02 at 18:40 +, [EMAIL PROTECTED] wrote:
> I've gotten a handful of admin emails from my site that are reporting
> errors while parsing cookies because of illegal key values. What would
> cause this to happen? The site has been live for a month and gets a
> decent amount of traffic, and this is the first I've seen of it. Not
> sure if it's a fluke or something to be concerned with.
> 
> --
> 
> Traceback (most recent call last):
> 
>   File "/home/code/django/core/handlers/base.py", line 62, in
> get_response
> response = middleware_method(request)
> 
>   File "/home/code/django/middleware/sessions.py", line 69, in
> process_request
> request.session =
> SessionWrapper(request.COOKIES.get(SESSION_COOKIE_NAME, None))
> 
>   File "/home/code/django/core/handlers/modpython.py", line 74, in
> _get_cookies
> self._cookies =
> httpwrappers.parse_cookie(self._req.headers_in.get('cookie', ''))
> 
>   File "/home/code/django/utils/httpwrappers.py", line 140, in
> parse_cookie
> c.load(cookie)
> 
>   File "/opt/python-2.4.4/lib/python2.4/Cookie.py", line 621, in load
> self.__ParseString(rawdata)
> 
>   File "/opt/python-2.4.4/lib/python2.4/Cookie.py", line 652, in
> __ParseString
> self.__set(K, rval, cval)
> 
>   File "/opt/python-2.4.4/lib/python2.4/Cookie.py", line 574, in __set
> M.set(key, real_value, coded_value)
> 
>   File "/opt/python-2.4.4/lib/python2.4/Cookie.py", line 453, in set
> raise CookieError("Illegal key value: %s" % key)
> 
> CookieError: Illegal key value: ZEDOPOP16200151/105/1

It's not clear why your site is receiving this sort of cookie. Maybe it
is expected, maybe not -- that is something you need to work out (it
could be caused by something else at the same domain name setting a very
loose path specification, for example).

However, I suspect you may have come across a limitation in the Python
Cookie module here (so it's not really something Django can fix without
a lot of duplciated code): in the original (informal) Netscape cookie
spec, the "name" portion of a "name=value" pair in a cookie could
consist of any characters except semi-colon, whitespace and comma. It's
not clear from a quick read of RFC 2965 (the latest cookie RFC) if this
is still the case. However, the Cookie module that ships with Python
2.4, at least, has a much more restricted set of characters that it
allows in the "name" field. And a slash is not one of those characters.

I don't know what the solution is here. We've had at least one other
case of Python's cookie module not being fully spec-compliant in the
past, but replacing it with our own hacked version would be a lot of
extra maintenance. The proper solution is to work out the real spec
requirements and file a bug against Python.

Regards,
Malcolm


--~--~-~--~~~---~--~~
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: Avoiding trailing slash in links in templates

2007-03-02 Thread Malcolm Tredinnick

On Fri, 2007-03-02 at 06:52 -0800, Sambhav wrote:
> Hi,
> 
> I want to use this http://www.example.com/2007/mar/02/?time=2100
> instead of http://www.example.com/2007/mar/02/2100/
> 
> But when I use this in the template I get this- 
> http://ww.example.com/2007/mar/02/?time=2100/

What do you mean by "when I use this in a template"? Do you mean that
the generated HTML contains the trailing slash in the URL, or that when
you click on the link you are ultimately redirected to the trailing
slash version? In the latter case, it is probably because you are using
the APPEND_SLASH setting in the Django common middleware (it's on by
default).

The APPEND_SLASH directive is a little all-or-nothing in this respect,
so you may need to disable it (and handle redirection to canonical URLs
yourself -- see design-philosophy.txt and middleware.txt for what it is
doing).

Regards,
Malcolm


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



Problems witn order_by

2007-03-02 Thread Pedro Muñoz

Hi!!

I just join to this group, i am delighted to take part of a group of
django users, i am a newbie one but i love to learn. As you has guess
mi native language is not english ;)

I want to make a question, i have the following code

ord_p = Orden_pago.objects.order_by('caja_pagos.fecha_emision') #the
name of the table is caja_pagos

Where the model is:

class Pagos(models.Model):
  ..
  fecha_emision = models.DateField()

class Orden_pago(models.Model):
  pago = models.ForeignKey(Pagos)
  monto = models.FloatField(max_digits=8,decimal_places=2)
  cant_benef = models.PositiveIntegerField()

And the outcome was:

FAILURE: Lacks the table «caja_pagos» in FROM SELECT
caja_orden_pago"."codigo","caja_orden_pago"."pago_id",
"caja_orden_pago"."monto","caja_orden_pago"."cant_benef" FROM
"caja_orden_pago" ORDER BY "caja_pagos"."fecha_emision" ASC

I guess that i have to write the name of the table caja_pagos after
FROM but how i can do that ?

Thanks.


pd:

This is the original in spanish:

ERROR: falta una entrada para la tabla «caja_pagos» en la cláusula
FROM SELECT caja_orden_pago"."codigo","caja_orden_pago"."pago_id",
"caja_orden_pago"."monto","caja_orden_pago"."cant_benef" FROM
"caja_orden_pago" ORDER BY "caja_pagos"."fecha_emision" ASC)

-- 
Pedro Muñoz a.k.a Droper
UTPINUX: http://www.utpinux.com
APESOL: http://www.apesol.org
Blog: http://droper.utpinux.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: newform: Post_add Submission not working

2007-03-02 Thread Honza Král
On 3/3/07, johnny <[EMAIL PROTECTED]> wrote:
>
> I did place form.errors in the template.  If I type the invalid data,
> then it displays the errors.  Problem is when I type in valid data, it
> doesn't display anything and brings me back to the form with the data
> I have entered.  Every frustrating problem.

without more information, nobody will be able to help you...

you can try working with the form from command line to see what's going wrong...

>
>
> >
>


-- 
Honza Kr�l
E-Mail: [EMAIL PROTECTED]
ICQ#:   107471613
Phone:  +420 606 678585

--~--~-~--~~~---~--~~
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 filter to retrieve the MEDIA_URL

2007-03-02 Thread ashwoods

context processor would be better :) its just included in the context,
while here you are "parsing" text.


On Mar 3, 3:16 am, "Henrik Lied" <[EMAIL PROTECTED]> wrote:
> Hi there, Sean!
>
> Thanks for the different methods --
>
> I went for a different approach, though. I simply created a simple
> filter like this:
> def mediaurl(value):
> import re
> from project.setting import MEDIA_URL
> "Replaces the string MEDIAURL with the MEDIA_URL"
> return value.replace('MEDIAURL', MEDIA_URL)
>
> ...and use it like this: {{ object|mediaurl }}
>
> Is this a bad way to resolve the problem?


--~--~-~--~~~---~--~~
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 filter to retrieve the MEDIA_URL

2007-03-02 Thread Henrik Lied

Hi there, Sean!

Thanks for the different methods --

I went for a different approach, though. I simply created a simple
filter like this:
def mediaurl(value):
import re
from project.setting import MEDIA_URL
"Replaces the string MEDIAURL with the MEDIA_URL"
return value.replace('MEDIAURL', MEDIA_URL)

...and use it like this: {{ object|mediaurl }}

Is this a bad way to resolve the problem?


--~--~-~--~~~---~--~~
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: Weird session

2007-03-02 Thread Nebojša Đorđević

On Mar 2, 2007, at 04:35 , Seth Buntin wrote:

> I have this:
>
> request.session["order_items"] = []
>
> and on certain views I have:
>
> request.session["order_items"].append(order_item.id)

Maybe is just shoot in the dark, but...

Looking at SessionWrapper.__setitem__ your request.session 
["order_items"].append(order_item.id) newer sets session modified  
flag because __setitem__ newer gets called. I was bitten many times  
by the similar problem.

Try:

request.session["order_items"] = request.session["order_items"] +  
[order_item.id]

this way SessionWrapper.__setitem__ will be called and session will  
be marked as modified.

Hope that helps.

IIRC Quixote had a set of the special list/tuple/dict/whatever  
classes which interact with the "set dirty" machinery and set "dirty"  
flag when content is modified (ZODB related).

-- 
Nebojša Đorđević - nesh, ICQ#43799892
Studio Quattro - Niš - Serbia
http://studioquattro.biz/ | http://code.google.com/p/django-utils/
Registered Linux User 282159 [http://counter.li.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
-~--~~~~--~~--~--~---



Other errors in template rendering

2007-03-02 Thread checco

Hi again,

unfortunately I seem to get another couple of mistakes in template
rendering.
The first one is in "snippet_detail.html" and the error message is the
following:

'comment' is not a valid tag library: Could not load template library
from django.templatetags.comment,
No module named comment
Error in:template: C:/html/templates\cab/snippet_detail.html, error at
line 55
55  {% load comment %}
Exception Location: c:\Python25\lib\site-packages\django\template
\defaulttags.py in load, line 740


The second error in template rendering is the following:

Template 'base_user.html' cannot be extended, because it doesn't exist
In template C:/html/templates\cab/add_snippet_form.html, error at line
1
1   {% extends "base_user.html" %}Exception Location:   C:\Python25\lib
\site-packages\django\template\loader_tags.py in get_parent, line 58

I don't know how to solve them. In the second error I really don't
know where I'm supposed to find base_user.thml which doesn't seem to
come with the django distribution.

Again any help will be very appreciated
Checco


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



Using the Admin GUI for a linked list

2007-03-02 Thread rh

Hi,
I've a model which I want to implement as a linked-list.

The model has a pointer to itself:
prev = models.ForeignKey('self', blank=True, null=True)

Now, my question is about the GUI.
I want to use the Admin GUI with a small modification: when a user
edits an existing instance of the model and saves it, I would like to
generate a new instance and link it to the previous one.

The "Save as new" button seems to be the closest to my needs but how
can I set the prev pointer?

Any ideas anyone?

Reuven.


--~--~-~--~~~---~--~~
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 filter to retrieve the MEDIA_URL

2007-03-02 Thread Sean De La Torre
Henry,

I do the same thing in my project.  There are a couple of ways you can use
to expose the media url.  If you won't be using the it very often, you can
do the following:

from django.shortcuts import render_to_response
from django.conf import settings

def example(request):
return render_to_response('example.html', {'media_url':
settings.MEDIA_URL})

Then, in your template, you would access the media url like any other
variable:



The second way is to create a custom context processor.  I find it easier to
do it this way because the media url is auto populated for me and I don't
have to remember to do it for every response.  Here's an example:

First, create a context_processors.py file at the base of your app. You can
call this whatever you want and place it wherever you want as long as django
can find it later.

In that file, create a function to populate the context with the relevant
information:

def media_url(request):
from django.conf import settings
return {'media_url': settings.MEDIA_URL}

You then have to let django know how to find the context processor you just
wrote.  This is done in your settings.py file using the
"TEMPLATE_CONTEXT_PROCESSORS" value (the 'path.to' portion should be
replaced with your project specific info):

TEMPLATE_CONTEXT_PROCESSORS = ('path.to.context_processors.media_url' ,)

To use the context processor, you have to include a context with your
response information:

from django.shortcuts import render_to_response
from django.template import RequestContext

def example(request):
context = RequestContext(request)
return render_to_response('example.html', context_instance=context)

Now the media url is available in your templates:



More information about the RequestContext can be found
here
.

Let me know if you have any questions.

Sean


On 3/2/07, Henrik Lied <[EMAIL PROTECTED]> wrote:
>
>
> Hi there,
>
> I'm just wondering what the best way of retrieving the MEDIA_URL for
> an object is.
>
> Let's say I'm writing a blog post with some images. Instead of writing
> http://media.mydomain.com/image.gif";>, I'd write  src="_MEDIA_URL_/image.gif"> or something equivalent.
>
> So if I change my domain, I wouldn't have to rewrite a ton of blog
> posts to change the domain.
>
> --
>
> Have anyone tried 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: connecting to multiple databases

2007-03-02 Thread Ewout ter Haar

> You need to read what Jacob said. The condition for multi-db being
> accepted into trunk is for someone to take control of it - not just
> for the immediate term (finishing docs, etc), but for the medium to
> long term (maintenance of the code).

I understand. For branches which are not supported by principals it is
a vicious circle: less motivation for people to use and test them, which means
less chance to get incorporated, the original branch owner cannot wait anymore,
etc. As I said, I am not questioning the process or criticizing anybody
or have any better ideas.

Anyway,  back to the question: do think there is a way with standard django
to access two databases (maybe sequentially, changing database connections)
in one script? Or is the only way to use intermediate storage like a file?

--~--~-~--~~~---~--~~
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: Admin customisation

2007-03-02 Thread James Bennett

On 3/2/07, Fes <[EMAIL PROTECTED]> wrote:
> I have a model which has fields that have been set using a form.
> However I would like to incorporate this model into the admin
> interface. I would like to know if it is possible for this model to
> only have the "Change" rights. For example when the user is at the
> admin interface this model can only be changed rather than the usual
> add and delete functions usually attached to a model. Is this
> possible?

No. The admin application is intended for fully trusted members of
your site staff, not for users whose actions need to be constrained.

If you want to show a change form for a model instance, use the
'update_object' generic view.

-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



Admin customisation

2007-03-02 Thread Fes

Hi,

I have a model which has fields that have been set using a form.
However I would like to incorporate this model into the admin
interface. I would like to know if it is possible for this model to
only have the "Change" rights. For example when the user is at the
admin interface this model can only be changed rather than the usual
add and delete functions usually attached to a model. Is this
possible?

Thanks
Fes


--~--~-~--~~~---~--~~
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: newform: Post_add Submission not working

2007-03-02 Thread johnny

I did place form.errors in the template.  If I type the invalid data,
then it displays the errors.  Problem is when I type in valid data, it
doesn't display anything and brings me back to the form with the data
I have entered.  Every frustrating problem.


--~--~-~--~~~---~--~~
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 Filebrowser and more than one TinyMCE instance

2007-03-02 Thread patrick k.

try playing around with:

 relative_urls : false,
 remove_script_host : true,

we´re using absolute_urls and we don´t remove the script_host.
if the URL is inserted into the tinymce_popup correctly, it doesn´t  
seem to be a problem with the filebrowser but a problem with  
tiny_mce. therefore, you may search the tinymce forum for more details.

Am 02.03.2007 um 23:16 schrieb Dirk Eschler:

> On Freitag, 2. März 2007, patrick k. wrote:
>> we´re also using more than one tinymce instance and we don´t have any
>> problems.
>> could you give more details about your specifications, e.g. how do
>> you init tinymce?
>>
>> patrick.
>
> Hello Patrick,
>
> thanks for your reply. In the model TinyMCE is loaded like:
>
> class Admin:
>   # ...
> js = (
> 'js/tiny_mce/tiny_mce.js',
> 'js/textareas.js',
> )
>
> For the filebrowser integration i followed:
> http://trac.dedhost-sil-076.sil.at/trac/filebrowser/
>
> I had some problems getting the Filebrowser popup to send the link  
> into the
> TinyMCE popup. Clicking the arrow simply did nothing. I ended up  
> with two
> different files:
> - js/tiny_mce/tiny_mce_popup.js
> - js/tiny_mce/tiny_mce_popup_fb.js

for the filebrowser, the installation guide says that you should use  
tiny_mce_popup_fb.js with line 80 commented out, because otherwise  
there´s a mix of styles and the filebrowser popup just looks awful.  
this has nothing to do with the functionality of the filebrowser.

please let me know if you solved the problem ...

patrick.

>
> Both have the same content. The first file is sent when the TinyMCE  
> popup is
> loaded, the second when the Filebrowser popup comes (i've traced  
> this with
> LiveHttpHeaders). It was the only way to get it working at all.
>
> In templates/filebrowser/index.html the second JavaScript file is  
> referenced
> this way:
>
> {% ifequal is_popup '2' %}
> [...]
> 
> [...]
> {% endifequal %}
>
> I have attached my textareas.js, which also contains the  
> Filebrowser callback
> i'm using. Please let me know if you need more information.
>
> Best Regards.
>
> -- 
> 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
-~--~~~~--~~--~--~---



Re: connecting to multiple databases

2007-03-02 Thread Russell Keith-Magee

On 3/3/07, Ewout ter Haar <[EMAIL PROTECTED]> wrote:
> I read this as saying that that the multi-db will never be incorporated
> in trunk, because even if all the bugs would be worked out, even if there
> would be documation, etc, etc, there is no commiter that wants to maintain
> it. If it will never be in trunk, I don't want to use it.

You need to read what Jacob said. The condition for multi-db being
accepted into trunk is for someone to take control of it - not just
for the immediate term (finishing docs, etc), but for the medium to
long term (maintenance of the code).

Multi-db is a neat enough feature, but it's not an important enough
feature for any of the existing core developers to take control.
Therefore, someone else has to step up for the task, and the core
developers have to be convinced that this person is capable of the
task.

That person isn't just someone that puts their hand up and says "I'll
do it" - that approach is what has left us with half a dozen unmerged
branches. Enthusiasm is great, but persistence is what gets the job
done. Case in point - the test framework that was recently committed
took about a week of actual development time, but it took 8 months to
get it all accepted in trunk. And that was a relatively simple
feature.

What we will be looking for is a person with a track record of fixing
nasty bugs, and contributing in a meaningful way to the community. In
short, if the core developers don't recognize your name as a result of
your previous contributions, you probably won't get the job.

Yours,
Russ Magee %-)

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



Re: Django Filebrowser and more than one TinyMCE instance

2007-03-02 Thread Dirk Eschler
On Freitag, 2. März 2007, patrick k. wrote:
> we´re also using more than one tinymce instance and we don´t have any
> problems.
> could you give more details about your specifications, e.g. how do
> you init tinymce?
>
> patrick.

Hello Patrick,

thanks for your reply. In the model TinyMCE is loaded like:

class Admin:
# ...
js = (
'js/tiny_mce/tiny_mce.js',
'js/textareas.js',
)

For the filebrowser integration i followed:
http://trac.dedhost-sil-076.sil.at/trac/filebrowser/

I had some problems getting the Filebrowser popup to send the link into the 
TinyMCE popup. Clicking the arrow simply did nothing. I ended up with two 
different files:
- js/tiny_mce/tiny_mce_popup.js
- js/tiny_mce/tiny_mce_popup_fb.js

Both have the same content. The first file is sent when the TinyMCE popup is 
loaded, the second when the Filebrowser popup comes (i've traced this with 
LiveHttpHeaders). It was the only way to get it working at all.

In templates/filebrowser/index.html the second JavaScript file is referenced 
this way:

{% ifequal is_popup '2' %}
[...]
 
[...]
{% endifequal %}

I have attached my textareas.js, which also contains the Filebrowser callback 
i'm using. Please let me know if you need more information.

Best Regards.

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



textareas.js
Description: JavaScript source


Re: Django Filebrowser and more than one TinyMCE instance

2007-03-02 Thread patrick k.

we´re also using more than one tinymce instance and we don´t have any  
problems.
could you give more details about your specifications, e.g. how do  
you init tinymce?

patrick.

Am 02.03.2007 um 16:48 schrieb Dirk Eschler:

>
> Hi,
>
> i'm using the Django filebrowser together with TinyMCE in one of my  
> projects.
> Inserting a adv_link from the file browser into the TinyMCE popup  
> only works
> in the first TinyMCE instance.
>
> In the second instance the link becomes #mce_temp_url#. Oddly  
> enough, the link
> is displayed correctly in the TinyMCE popup, but after hitting  
> update to
> apply the link and close the popup, it is rendered into  
> #mce_temp_url#.
>
> Is there any way around this problem?
>
> Best Regards.
>
> -- 
> 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
-~--~~~~--~~--~--~---



Re: how to user generic views (object_list) to show dynamic list ?

2007-03-02 Thread Henrik Lied

Yeah, just pass an extra argument in the urls.py, like /files/(?
P[-\w]+), and filter your queryset. Take a look at
http://www.b-list.org/weblog/2006/11/16/django-tips-get-most-out-generic-views


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



Exception in template rendering

2007-03-02 Thread checco

Hi,

I was playing with the django application djangosnippets (the released
source code of www.djangosnippets.org) and I got the following error:

"Caught an exception while rendering: no such column: count"
(it refers to the following snippet of code taken from the template
snippets_list.html):

{% block sidebar %}
{{ object_list.count }} snippet{{object_list.count|pluralize }}
posted so far.
{% endblock %}

I don't know if that would cause the error but, please, note that the
object_list is not empty. Does anyone know why the error? I'm quite
new to django so any help will be highly appreciated.

Thanks and regards
Cesco


--~--~-~--~~~---~--~~
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: Getting up and running

2007-03-02 Thread Joseph Heck
it looks like you don't have the prerequisites that Django needs already
installed. Check  the docs at
http://www.djangoproject.com/documentation/install/ - it'll point you to
http://initd.org/tracker/psycopg where you can get the libraries for python
to talk with PostgreSQL.

-joe

On 3/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> Adrian
>
> I have tried to follow both the django book and the tutorial
>
> and i can't get past the beginning python manage.py syncdb.
>
> i have tried setting it up on my mac for both versions 2.4
>
> and 2.5 and still doesn't work. I also tried to do Jacob's
>
> tutoirals from his PYCON and OSCON tutorials and I am
>
> stuck at the same point.
>
> I keep getting the following error when i syncdb
>
> raise ImproperlyConfigured, "Error loading psycopg2 module: %s" % e
> django.core.exceptions.ImproperlyConfigured: Error loading psycopg2
> module: No module named psycopg2
>
> Also is it possible to get the code from Jacobs jellyroll app
>
> that he says is suppose to be available in his tutorial here
>
> http://toys.jacobian.org/presentations/2006/oscon/tutorial/
>
>
> >
>

--~--~-~--~~~---~--~~
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: "cannot import" errors when doing an import of an app's models

2007-03-02 Thread Joseph Heck
So with that setup, I'd expect that if you have an application named
"wilbur", that you'd have an entry named "mysite.wilbur" in
settings.pyunder INSTALLED_APPLICATIONS and that you'd have a
directory
c:\temp\mysite\wilbur that had a __init__.py file and a models.py file at a
minimum.

If you added an application named "register", then from that setup I'd
expect the INSTALLED_APPLICATIONS entry to be "mysite.register" and the
models code to live in c:\temp\mysite\register\models.py

Does that match up with what you have set?

-joe

On 2/28/07, CosyGlow42 <[EMAIL PROTECTED]> wrote:
>
>
>
>
> On Mar 1, 11:51 am, "Joseph Heck" <[EMAIL PROTECTED]> wrote:
> > I got a bit lost on what paths changed where - post your PYTHONPATH,
> > DJANGO_SETTINGS_MODULE, and the path to where your code is and it should
> > become more clear.
> >
> > -joe
> >
> > On 2/28/07, CosyGlow42 <[EMAIL PROTECTED]> wrote:
> >
> > Here's my path's, as stated after making all other modifications:
>
> PYTHONPATH = c:\temp\;c:\temp\mysite,
> DJANGO_SETTINGS_MODULE = mysite.settings
> System PATH = c:\temp;c:\temp\mysite (at the end of the line)
>
> Thanks
>
>
> >
> >
> >
> > > I'm a newbie to the Django/Python world and are looking for answers to
> > > a problem when Importing models from an app. I've already looked at
> > > all advice given by the experts helping others in this group and
> > > nothing worked. I've also worked through the Django documentation
> > > multiple times.
> >
> > > My Interactive Python import worked perfectly until I've checked out
> > > (with svn) a complete "Registration" app into the directory I've
> > > created for my first app. My appliction directory has changed as
> > > such:
> >
> > > Before:
> > > C:\temp\mysite\tst  - this is my first directory which worked in the
> > > beginning. Then I've added the registration app which is: C:\temp
> > > \mysite\registration.
> >
> > > After:
> > > This app was placed before the \tst\ app (alphabetically, as usual).
> C:
> > > \temp\mysite\registration and then \tst\ under it. This is correct and
> > > shouldn't be a problem.
> >
> > > I added the new app in my settings.py file under the 'INSTALL_APP = ('
> > > setting.
> > > The SYNCDB command created all modules beautifully in my DB for the
> > > new app (registration)  and I also added the provided url into my root
> > > URLconf. Everything to the book.
> >
> > > I think my problem is that Django and/or Python get confused when the
> > > registration app is added. Maybe this is corrupting the path to my TST
> > > app,  I don't know. I've also removed all PYTHONPATH entries, SYSPATH
> > > entries and DJANGO_SETTINGS_MODULE entries related to my apps,
> > > rebooted, re-added them all again, rebooted, started the server
> > > (Python manage.py runserver) and retried the Interactive import again,
> > > but no luck.
> >
> > > Why can't I import the individual models from either of the apps in
> > > Python Interactive mode? I haven't tried running my apps in Windows
> > > Explorer windows yet, but believe it won't work there either.
> >
> > > What am I doing wrong or am I missing something somewhere?
> >
> > > Thanks in advance.
> >
> > > CosyGlow42- Hide quoted text -
> >
> > - Show quoted text -
>
>
> >
>

--~--~-~--~~~---~--~~
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: Getting up and running

2007-03-02 Thread ScottB

On Mar 2, 5:49 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I keep getting the following error when i syncdb
>
> raise ImproperlyConfigured, "Error loading psycopg2 module: %s" % e
> django.core.exceptions.ImproperlyConfigured: Error loading psycopg2
> module: No module named psycopg2

It looks like you don't have the psycopg2 package installed.  Psychopg
lets Python talk to the Postgres database and it's what Django uses
when your settings file has database engine set like:

DATABASE_ENGINE = 'postgresql_psycopg2'

To check if it's installed you can go in to Python and do:

import psycopg2

If you get an error, it's not installed.  I use Ubuntu and Debian, so
I installed using apt-get python-psycopg2.  If you're using Fink,
there's probably a package for it.  Alternatively, download and
install.  Once installed you should have a psycopg2 directory in
Python's site-packages.  In my case this is at:

/usr/lib/python2.4/site-packages/psycopg2

Scott



--~--~-~--~~~---~--~~
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 filter to retrieve the MEDIA_URL

2007-03-02 Thread Henrik Lied

Hi there,

I'm just wondering what the best way of retrieving the MEDIA_URL for
an object is.

Let's say I'm writing a blog post with some images. Instead of writing
http://media.mydomain.com/image.gif";>, I'd write  or something equivalent.

So if I change my domain, I wouldn't have to rewrite a ton of blog
posts to change the domain.

--

Have anyone tried 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
-~--~~~~--~~--~--~---



Play the fantasy game of CricMasti and win NOKIA N70

2007-03-02 Thread AKKy

Dear Recepient,

Your friend has invited you to play the amazing fantasy game of
cricket for the ICC World Cup 2007.

You have to register and create your team at www.cricmasti.com. Once
you have create your team you can then become a selector and choose
players in your team. The better the players perform, the more your
team scores. The winner at the end of the world cup will win a brand
new Nokia N-70 mobile.

For registration and more information please visit www.cricmasti.com
Have fun!

Best wishes,
CricMasti Team.


--~--~-~--~~~---~--~~
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 user generic views (object_list) to show dynamic list ?

2007-03-02 Thread lee
Hi
   I have a problem
   how to use generic views (object_list) to show dynamic list ?
   for exaple, my model is a movie with a category ,
   I want to accomplish this :
when I access http://.../action  , in which  action is a category
name, then  it display all the movie objects in the action category,
when access http://../sci-fi , then it displays  the science-fiction
movie  list

  can list_views.object_list do this ? use some tricks ?

  need your help

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



What would cause CookieError: Illegal Key Value?

2007-03-02 Thread [EMAIL PROTECTED]

I've gotten a handful of admin emails from my site that are reporting
errors while parsing cookies because of illegal key values. What would
cause this to happen? The site has been live for a month and gets a
decent amount of traffic, and this is the first I've seen of it. Not
sure if it's a fluke or something to be concerned with.

--

Traceback (most recent call last):

  File "/home/code/django/core/handlers/base.py", line 62, in
get_response
response = middleware_method(request)

  File "/home/code/django/middleware/sessions.py", line 69, in
process_request
request.session =
SessionWrapper(request.COOKIES.get(SESSION_COOKIE_NAME, None))

  File "/home/code/django/core/handlers/modpython.py", line 74, in
_get_cookies
self._cookies =
httpwrappers.parse_cookie(self._req.headers_in.get('cookie', ''))

  File "/home/code/django/utils/httpwrappers.py", line 140, in
parse_cookie
c.load(cookie)

  File "/opt/python-2.4.4/lib/python2.4/Cookie.py", line 621, in load
self.__ParseString(rawdata)

  File "/opt/python-2.4.4/lib/python2.4/Cookie.py", line 652, in
__ParseString
self.__set(K, rval, cval)

  File "/opt/python-2.4.4/lib/python2.4/Cookie.py", line 574, in __set
M.set(key, real_value, coded_value)

  File "/opt/python-2.4.4/lib/python2.4/Cookie.py", line 453, in set
raise CookieError("Illegal key value: %s" % key)

CookieError: Illegal key value: ZEDOPOP16200151/105/1


,
POST:,
COOKIES:,
META:{'AUTH_TYPE': None,
 'CONTENT_LENGTH': 0L,
 'CONTENT_TYPE': None,
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT': '*/*',
 'HTTP_ACCEPT_LANGUAGE': 'en',
 'HTTP_CONNECTION': 'keep-alive',
 'HTTP_COOKIE': 'ZEDOPOP16200151/105/1=1; s_cc=true; s_sq=',
 'HTTP_EXTENSION': 'Security/Remote-Passphrase',
 'HTTP_HOST': 'www2.tbo.com',
 'HTTP_UA_CPU': 'PPC',
 'HTTP_UA_OS': 'MacOS',
 'HTTP_USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC)',
 'HTTP_VIA': '1.0 ics_server.pinellas.k12.fl.us (ICS 2.2.0.3.26)',
 'PATH_INFO': '/snap-most-popular/',
 'PATH_TRANSLATED': None,
 'QUERY_STRING': 'js',
 'REMOTE_ADDR': '168.213.1.133',
 'REMOTE_HOST': None,
 'REMOTE_IDENT': None,
 'REMOTE_USER': None,
 'REQUEST_METHOD': 'GET',
 'SCRIPT_NAME': None,
 'SERVER_NAME': 'www2.tbo.com',
 'SERVER_PORT': 0,
 'SERVER_PROTOCOL': 'HTTP/1.0',
 'SERVER_SOFTWARE': 'mod_python'},
user:AnonymousUser>


--~--~-~--~~~---~--~~
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 update and recover on-line a Django site

2007-03-02 Thread mamcxyz

I'm using lighttpd and fastcgi (sorry to forget the detail)


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



Getting up and running

2007-03-02 Thread [EMAIL PROTECTED]

Adrian

I have tried to follow both the django book and the tutorial

and i can't get past the beginning python manage.py syncdb.

i have tried setting it up on my mac for both versions 2.4

and 2.5 and still doesn't work. I also tried to do Jacob's

tutoirals from his PYCON and OSCON tutorials and I am

stuck at the same point.

I keep getting the following error when i syncdb

raise ImproperlyConfigured, "Error loading psycopg2 module: %s" % e
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2
module: No module named psycopg2

Also is it possible to get the code from Jacobs jellyroll app

that he says is suppose to be available in his tutorial here

http://toys.jacobian.org/presentations/2006/oscon/tutorial/


--~--~-~--~~~---~--~~
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: Newbie: Admin / Model help

2007-03-02 Thread DuncanM

On top of the above post, I've come accross an error when trying to
sync my db (with having simplified list_displays not those from
above).  When ever I order my classes in the model file like

Fixture
...
Result
...

I run syncdb and get this:

$ python2.4 manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 11, in ?
execute_manager(settings)
  File "/home2/duncanm/lib/python2.4/django/core/management.py", line
1319, in execute_manager
execute_from_command_line(action_mapping, argv)
  File "/home2/duncanm/lib/python2.4/django/core/management.py", line
1243, in execute_from_command_line
action_mapping[action]()
  File "/home2/duncanm/lib/python2.4/django/core/management.py", line
463, in syncdb
sql, references = _get_sql_model_create(model, seen_models)
  File "/home2/duncanm/lib/python2.4/django/core/management.py", line
145, in _get_sql_model_create
rel_field = f.rel.get_related_field()
  File "/home2/duncanm/lib/python2.4/django/db/models/fields/
related.py", line 730, in get_related_field
return self.to._meta.get_field(self.field_name)
  File "/home2/duncanm/lib/python2.4/django/db/models/options.py",
line 100, in get_field
raise FieldDoesNotExist, '%s has no field named %r' %
(self.object_name, name)
django.db.models.fields.FieldDoesNotExist: Fixture has no field named
'Fixture'

however when I have:
Result
...
Fixture
...

and run syncdb I get:
$ python2.4 manage.py syncdb
Error: Couldn't install apps, because there were errors in one or more
models:
htafc.teams: name 'Fixture' is not defined

Which I understand because i'm referring to an object that has yet to
be created, however I do not understand why I am getting the error
from the first scenario.  The 2 classes are shown below:



# 
# Result Class
# 

class Result(models.Model):
  fixture = models.OneToOneField(Fixture, core=True, help_text="Select
the fixture this is the result from.")
  howdenscore = models.IntegerField("Howden Score", core=True,
help_text="Score obtained by the Howden Team e.g. 3")
  opponentscore = models.IntegerField("Opponent Score", core=True,
help_text="Score obtained by the opposition team e.g. 0")
  class Admin:
pass
list_display = ('howdenscore', 'opponentscore',) list_filter =
['howdenscore',]
search_fields = ['howdenscore']

  # -
  # Accessors
  # -

  #String method
  def __str__ (self):
return self.howdenscore

# -
# Fixture Class
# -
class Fixture(models.Model):
  team = models.ForeignKey(Team, "Team", core=True, help_text="The
Howden team involved in the fixture e.g. Under 8's or Senior 1st
Team.")
  venue = models.CharField("Venue", maxlength=1,
choices=Fixture_Choices, core=True, help_text="Home or Away.")
  date = models.DateField("Date", core=True, help_text="Date of
fixture DD/MM/YY.")
  opponent = models.CharField("Opponent", maxlength=100, core=True,
help_text="Name of Opposition to be played.")
  kickoff = models.TimeField("Kick Off Time", help_text="Time of Kick
Off in 24 hour clock format, e.g. 10:00, or 14:00")
  competition = models.ForeignKey(Competition, "Competition",
core=True, help_text="Competition fixture is for e.g. East Riding
County League 4.")
  class Admin:
pass
list_display = ('date', 'team', 'opponent', 'venue', 'kickoff',
'competition')
list_filter = ['date', 'team', 'competition']
search_fields = ['date']

  # -
  # Accessors
  # -

  #String method
  def __str__ (self):
return str('Date: ' + str(self.date) + ', Venue: ' + self.venue +
', Vs: ' + self.opponent)


Thanks for any help, its much needed, and very much appreciated.

DuncanM


On Mar 2, 2:43 pm, "DuncanM" <[EMAIL PROTECTED]> wrote:
> Hi I'm having a problem with some of my modelling for an app I'm
> building.
>
> The 2 models of interest i'm using are
>
> class Fixture(models.Model):
>   team = models.ForeignKey(Team, "Team", core=True, help_text="The
> Howden team involved in the fixture e.g. Under 8's or Senior 1st
> Team.")
>   venue = models.CharField("Venue", maxlength=1,
> choices=Fixture_Choices, core=True, help_text="Home or Away.")
>   date = models.DateField("Date", core=True, help_text="Date of
> fixture DD/MM/YY.")
>   opponent = models.CharField("Opponent", maxlength=100, core=True,
> help_text="Name of Opposition to be played.")
>   KO = models.TimeField("Kick Off Time", help_text="Time of Kick Off
> in 24 hour clock format, e.g. 10:00, or 14:00")
>   competition = models.ForeignKey(Competition, "Competition",
> core=True, help_text="Competition fixture is for e.g. East Riding
> County League 4.")
>   class Admin:
> pass
> list_display = ('date', 'team', 'opponent', 'venue', 'KO',
> 'competition')
> list_filter = ['date', 'team', 'competition']
> search_fields = ['date']
>
> 
>
> class Result(models.Model):
>   result = models.OneToOneField(Fixture, "Fixture from", core=True,
> help_text="Selec

ImageWithThumbsField for multiple thumbnails

2007-03-02 Thread omat * gezgin.com

I came across several approaches for managing thumbnails of images and
then I wrote mine to allow user to specify any number of thumbnail
images to be created.

When initializing the field class, specify the dimensions that you
want to have like:

photo = ImageWithThumbsField(upload_to = 'path', dims = ((60, 60),
(120, 120), (600, 600)))


And this class takes care of creation and deletion of the images:

class ImageWithThumbsField(models.ImageField):
def __init__(self, dims = None, *args, **kwargs):
super(ImageWithThumbsField, self).__init__(*args, **kwargs)
self.dims = dims

def save_file(self, new_data, new_object, original_object, change,
rel, save):
super(ImageWithThumbsField, self).save_file(new_data,
new_object, original_object, change, rel, save)
directory = self.get_directory_name()
im = Image.open('%s%s/%s' % (settings.MEDIA_ROOT,
 directory,
 new_data['image_file']
['filename']))
for dim in self.dims:
# resize image
scale = min(float(dim[0])/im.size[0], float(dim[1])/
im.size[1])
if scale > 1:
newim = im
else:
width = int(im.size[0] * scale)
height = int(im.size[1] * scale)
newim = im.resize((width, height), Image.ANTIALIAS)
newim.save('%s%s/%dx%d_%s' % (settings.MEDIA_ROOT,
  directory,
  dim[0], dim[1],
  new_data['image_file']
['filename']), im.format)

def delete_file(self, instance):
super(ImageWithThumbsField, self).delete_file(instance)
(directory, filename) = os.path.split(instance.image)
for dim in self.dims:
try:
os.unlink('%s%s/%dx%d_%s' % (settings.MEDIA_ROOT,
 directory,
 dim[0], dim[1],
 filename))
except (IOError, OSError):
pass

def get_url(self, dim, filename):
return '%s/%s/%dx%d_%s' % (settings.MEDIA_URL,
   self.get_directory_name(),
   dim[0], dim[1],
   filename)


What I couldn't do is to dynamically add methods to return the url of
a resized image when its dimensions are given. I want the image urls
to be accessible like img.image_60x60_url(), if a thumb with
dimensions 60x60 exists.

So, I added the get_url method that returns the url for that purpose
and tried setattr in the loop in the save_file to add those methods as
follows:

for dim in self.dims:
setattr(self, 'image_%dx%d_url' % (dim[0], dim[1]),
self.get_url(dim, new_data['image_file']['filename']))

and I couldn't access it in the views and templates. Then I tried
contribute_to_class but I couldn't find clear documentation of this
method and after some trial and error, I decided to ask for help.

Thanks for any suggestions...

oMat


--~--~-~--~~~---~--~~
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 HTML/CSS as templates

2007-03-02 Thread [EMAIL PROTECTED]


On Feb 28, 5:56 am, "MattW" <[EMAIL PROTECTED]> wrote:
>
> The change from dev to production seems like it might be a pain.
>

I agree somewhat. Speaking as a person transitioning from Tomcat to
Django. Dealing with static files is one of the things about Django
that
does take some getting used to. I have it mostly figured out now but

Being curious to see how the experts handle this issue, I looked at
the
Cheeserater example source code.

Firstly, he uses this code in urls.py:

if settings.DEBUG:
urlpatterns += patterns('',
(r'^m/(?P.*)$', serve, {'document_root' :
Path(__file__).parent.child("media")})
)

No problems here. Makes perfect sense.

But when I took a look at the base template, a bit of ugliness reveals
itself:




http://media.jacobian.org/
cheeserater/reset.css" type="text/css">
http://media.jacobian.org/
cheeserater/cheeserater.css" type="text/css">
...

Note the fixed URL for the link to the CSS. In the author's case, he
seems to be fortunate that
the URLs for the media are the same in both production and development
environments.
In general however, the URLs may have to be modified - although this
ought to be easy since
this is within a template.

Rangachari Anand


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



connecting to multiple databases

2007-03-02 Thread Ewout ter Haar

I have two legacy databases which I can connect to
django separately without problems. I would like to read data from
one, wrangle the data a bit, and write them to the other.

How would I go about that, given that, as I understand it, I can
import the settings only once. I would seem that in principle it would
not be difficult to make a new database connection in mid-script
(I don't need the admin interface necessarily)

I tried to use the multi-db branch, and it worked very nice. But I had
to switch back to trunk because of a bug I encountered, and there are
other django applications running on the same machine, for which
I cannot risk to use a non-production quality branch.

Also, I gave up on the multi-db branch after reading this from Jacob:
(http://groups.google.com.br/group/django-developers/browse_thread/thread/ae4261bb3aa4ea01/)
 "A maintainer/champion: for any big feature to have longevity, someone
needs to commit to maintaining the code for the foreseeable future.
Nothing would be worse than to merge in something big like multi-db
and have it break in three months because nobody understands it.  If
the maintenance plan for a big feature involves forcing me or another
committer to do more work, it's just not gonna work out."

I hate having to say "no" to cool features like multi-db, but since
this is a volunteer-run project, we have a limited amount of time
available.  "

I read this as saying that that the multi-db will never be incorporated
in trunk, because even if all the bugs would be worked out, even if there
would be documation, etc, etc, there is no commiter that wants to maintain
it. If it will never be in trunk, I don't want to use it.

(Am I being controversial here? I don't want to be. I am not
criticizing anybody,
just making explicit my personal reasoning. I don't know how to better manage
branches or contributions in general, and the django developers are doing a
wonderful job in open-source community management. That said, given the
above quote, I do wonder how any branch not developed by commiters
will ever make it into trunk.)

--~--~-~--~~~---~--~~
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 Filebrowser and more than one TinyMCE instance

2007-03-02 Thread Dirk Eschler

Hi,

i'm using the Django filebrowser together with TinyMCE in one of my projects. 
Inserting a adv_link from the file browser into the TinyMCE popup only works 
in the first TinyMCE instance.

In the second instance the link becomes #mce_temp_url#. Oddly enough, the link 
is displayed correctly in the TinyMCE popup, but after hitting update to 
apply the link and close the popup, it is rendered into #mce_temp_url#.

Is there any way around this problem?

Best Regards.

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



Re: Recursion in templates... again

2007-03-02 Thread Chris Moffitt

I've implemented a similar hierarchy for categories in Satchmo using 
elementtree.  You can see my example here-
http://www.satchmoproject.com/trac/browser/satchmo/trunk/satchmo/shop/templatetags/category_display.py

-Chris

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



Re: Rich text editor

2007-03-02 Thread leland

i agree - tiny_mce is SUPER easy to implement. also - check out your
line:

js = 'media/js/admin/AddRichTextEditing.js'

view the source on your admin page and look at the src attribute of
the 

Re: Recursion in templates... again

2007-03-02 Thread Adrián Ribao Martínez

Sorry, I didn't find a perfect solution, but I think that it can be done.
You can use the "unordered list" filter in the template and fill an array in 
the view using recursive methods. Then you pass the array to the filter and 
it's done. You can also create your own filter tag, is not difficult, you can 
find some info in the section "extending the template system"
http://www.djangoproject.com/documentation/templates_python/#extending-the-template-system
and in the several files under the django installation path:
 They're in django/template/defaultfilters.py and 
django/template/defaulttags.py, respectively.

I hope this help you.

Adrian Ribao.

El Viernes, 2 de Marzo de 2007 15:14, Jens Diemer escribió:
> Grupo Django schrieb:
> > Hello, I have been looking around about some information about how to
> > do recursion in templates but what I found didn't help me.
> > ...
> >
> > And the plan is to create a menu like this:
> > - Entry 1
> > -- Subentry 1_1
> > -- Subentry 1_2
> >  sub_Subentry 1_2_1
> > - Entry 2
> > ...
>
> I have the same Problem:
> http://groups.google.com/group/django-users/browse_thread/thread/3bd2812a3d
>0f7700/e97a9cd4348b0471?#e97a9cd4348b0471
>
> Did you find a solution?
>
>
> I found this:
> https://svn.greenpeace.org/projects/custard/browser/production/trunk/melt/a
>pps/custard/templatetags/customtags.py But the code is for an older django
> version. I don't know how to update it...
>
>
> So, if there is no solution, i must use jinja...

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



Avoiding trailing slash in links in templates

2007-03-02 Thread Sambhav

Hi,

I want to use this http://www.example.com/2007/mar/02/?time=2100
instead of http://www.example.com/2007/mar/02/2100/

But when I use this in the template I get this- 
http://ww.example.com/2007/mar/02/?time=2100/
Note the trailing slash. And I can't use it as a GET parameter.

This time parameter is calculated in the view and passed to the
template to use in the link.

Am I doing this totally wrong?
Any way I can avoid that? Can I do this using some other way?

Any help will be appreciated.


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



Newbie: Admin / Model help

2007-03-02 Thread DuncanM

Hi I'm having a problem with some of my modelling for an app I'm
building.

The 2 models of interest i'm using are

class Fixture(models.Model):
  team = models.ForeignKey(Team, "Team", core=True, help_text="The
Howden team involved in the fixture e.g. Under 8's or Senior 1st
Team.")
  venue = models.CharField("Venue", maxlength=1,
choices=Fixture_Choices, core=True, help_text="Home or Away.")
  date = models.DateField("Date", core=True, help_text="Date of
fixture DD/MM/YY.")
  opponent = models.CharField("Opponent", maxlength=100, core=True,
help_text="Name of Opposition to be played.")
  KO = models.TimeField("Kick Off Time", help_text="Time of Kick Off
in 24 hour clock format, e.g. 10:00, or 14:00")
  competition = models.ForeignKey(Competition, "Competition",
core=True, help_text="Competition fixture is for e.g. East Riding
County League 4.")
  class Admin:
pass
list_display = ('date', 'team', 'opponent', 'venue', 'KO',
'competition')
list_filter = ['date', 'team', 'competition']
search_fields = ['date']



class Result(models.Model):
  result = models.OneToOneField(Fixture, "Fixture from", core=True,
help_text="Select the fixture this is the result from.")
  howdenscore = models.IntegerField("Howden Score", core=True,
help_text="Score obtained by the Howden Team e.g. 3")
  opponentscore = models.IntegerField("Opponent Score", core=True,
help_text="Score obtained by the opposition team e.g. 0")
  class Admin:
pass
list_display = ('result', 'howdenscore', 'opponentscore',)
list_filter = ['result',]
search_fields = ['result']

I was wondering in the admin panel for the result, I have list_display
= ('result', 'howdenscore', 'opponentscore')
Is there anyway I can get that admin page to show some of the details
from the fixture class? e.g.
list_display = ('fixture.date', 'fixture.team', 'fixture.venue',
'fixture.opponent', 'howdenscore', 'opponentscore')


TIA (again)
DuncanM


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

2007-03-02 Thread DuncanM

Thanks for the quick reply Tim,
I dont think people entering m/d/y instead of d/m/y will be a problem
as Its what I think to be the common form in the UK (although I
realise americans often use m/d/y).

I was referring to my model when using the admin page to add a date so
that it only accepts date in the dd/mm/yy format.  And again only
displays that date format to the user.
DuncanM

On Mar 2, 2:18 pm, Tim Chase <[EMAIL PROTECTED]> wrote:
> > In my models I use DateField quite a few times, is there any
> > way I can adjust it so it stores information in the database
> > as dd/mm/yy and retrieves/handles it in this way too rather
> > then its current -mm- dd format?
>
> I'm not sure this question makes a whole lot of sense without
> some clarification...dates should be handled transparently as
> date objects all over the place.  They have year/month/day
> properties that can be accessed, and timedelta objects can be
> added or subtracted from them.  They have no inherent "format"
> other than a tuple of values (or as a *nix timestamp or what have
> you).
>
> The only time the format of a date should come into question is
> on actually presenting it to the user (and when reading it from
> the user).  For presenting the date, there's the "date" filter
> which allows you to format the date in all sorts of ways:
>
> {{ mydatefield|date:"d-m-Y" }}
>
> Reading back the date, one reason for the -MM-DD format is
> that it's internationally unambiguous.  If you get a date in the
> format 1-2-2006, should that be interpreted as Feb 1st or as Jan
> 2nd?  It depends on where you are.  Clearly if one of the first
> two fields is > 12, you have a definite answer.  But when both
> are 1<=N<=12  you have an ambiguity that's better to ensure that
> the person entering data means what the program interprets.  If
> you must allow your data-entry folks to use d/m/y you may be able
> to employ the time.strptime() function to extract what you want.
>  Just be prepared to get folks entering m/d/y instead of d/m/y
>
> -tkc


--~--~-~--~~~---~--~~
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: Weird session

2007-03-02 Thread Seth Buntin

I would love to tackle this issue, since it is to my advantage, but
really don't know where to start.  Any ideas?

Seth

On Mar 1, 10:59 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2007-03-01 at 20:17 -0800, Graham Dumpleton wrote:
>
> [...]
>
>
>
> I wrote:
> > > > I'm wondering if this may lead to race conditions along the lines of:
>
> > > > thread A creates a session
>
> > > > thread B creates a session
>
> > > > thread A stores "foo = 6" in session
>
> > > > thread B stores "blah = 1" in its session
>
> > > > thread A stores session (which contains foo=6)
>
> > > > thread B stores session (which does NOT have 
> > > > foo=6)
>
> > > > might be happening if you are doing lots of partial updates.
>
> > This doesn't make sense.
>
> Actually it makes a lot of sense now that I look at the code.
>
> > Normally the way sessions work, a second
> > request is usually locked out until the first request has finished
> > with the session object and released it. Thus there can be no
> > overlapping changes unless you are doing silly things like unlocking/
> > locking them yourself during a request. At least this is how
> > mod_python sessions work. How Django sessions (which don't actually
> > use mod_python sessions) work I don't know.
>
> Just to keep things on the right track for debugging Set's problem, I'll
> note that this isn't correct for Django sessions. As can be seen from
> the code in django/contrib/sessions/middleware.py and models.py, we
> don't do any cross-thread or cross-process locking when creating a
> session instance. Maybe we well should be doing something like that for
> people who want to do simultaneous updates -- as might happen in an AJAX
> driven site -- but, right now, we do not.
>
> A lot of Django enhancements like this are historically driven by usage
> patterns: the whole framework was written for one -- fairly broad --
> purpose and is gradually and carefully extended to handle other
> reasonable uses as they come up. This would be a good mini-project for
> somebody to look at doing if they felt so inclined. A bit of design work
> would be required, not just a one-line patch, I supsect, but it's not
> going to be of the "cure cancer" level of difficulty.
>
> Regards,
> Malcolm


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

2007-03-02 Thread Tim Chase

> In my models I use DateField quite a few times, is there any
> way I can adjust it so it stores information in the database
> as dd/mm/yy and retrieves/handles it in this way too rather
> then its current -mm- dd format?

I'm not sure this question makes a whole lot of sense without
some clarification...dates should be handled transparently as
date objects all over the place.  They have year/month/day
properties that can be accessed, and timedelta objects can be
added or subtracted from them.  They have no inherent "format"
other than a tuple of values (or as a *nix timestamp or what have
you).

The only time the format of a date should come into question is
on actually presenting it to the user (and when reading it from
the user).  For presenting the date, there's the "date" filter
which allows you to format the date in all sorts of ways:

{{ mydatefield|date:"d-m-Y" }}

Reading back the date, one reason for the -MM-DD format is
that it's internationally unambiguous.  If you get a date in the
format 1-2-2006, should that be interpreted as Feb 1st or as Jan
2nd?  It depends on where you are.  Clearly if one of the first
two fields is > 12, you have a definite answer.  But when both
are 1<=N<=12  you have an ambiguity that's better to ensure that
the person entering data means what the program interprets.  If
you must allow your data-entry folks to use d/m/y you may be able
to employ the time.strptime() function to extract what you want.
 Just be prepared to get folks entering m/d/y instead of d/m/y

-tkc





--~--~-~--~~~---~--~~
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 modify form error messages.

2007-03-02 Thread Honza Král
On 3/2/07, Michael Lake <[EMAIL PROTECTED]> wrote:
>
> Malcolm Tredinnick wrote:
> > On Fri, 2007-03-02 at 15:27 +1100, Michael Lake wrote:
> >
> >>Hi all
> >>
> >>I see in the documentation for forms that the HTML output will include the 
> >>validation
> >>errors as a  near the field. How does one change that? I would like the 
> >>errors to
> >>be after the form field similar to this below irrespective of whether im 
> >>rendering it
> >>as_p or asdefault table layout.
> >>
> >>Name: [ ] < This field is required
> >>
> >>rather than
> >>
> >>* This field is required
> >>Name: [ ]
> >
> >
> > Have a look at the errors_on_separate_row parameter in the html_output()
> > method of the newsforms.form.Form class. Passing that in as True should
> > do what you want. It means you will need to write your own version of
> > as_ul() or as_table() if you want to use those methods, but they're only
> > convenience methods in any case -- overriding or using your own wrapper
> > is encouraged for anything funky.
> >
> > So either call html_output() and pass in your format strings manually,
> > with a trailing True parameter, or write your own wrapper for this in
> > your Form subclass.
>
> Thanks, that gives me a starting point for lots more investigation. I can see 
> in
> forms.py on the Django site where as_table() and _html_output() are defined.
> It will take me a day to digest it. Searching for 'errors_on_separate_row' 
> also gives
> me a few links to follow.

if everything fails, you can still return to the hard way and use:

{{ form.field1 }} {% if form.field1.errors %} {{
form.field1.errors|join:"" }}{% endif %}

>
> Thanks
> --
> Michael Lake
>
>
>
>
> >
>


-- 
Honza Kr�l
E-Mail: [EMAIL PROTECTED]
ICQ#:   107471613
Phone:  +420 606 678585

--~--~-~--~~~---~--~~
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: newform: Post_add Submission not working

2007-03-02 Thread Honza Král
it would seem that the form still have some errors, try outputting
form.errors in the template to see if its empty

On 3/2/07, johnny <[EMAIL PROTECTED]> wrote:
>
> When I submit the information with the form, for some reason, I keep
> coming back to the form, with data I entered.  I am not sure why this
> is the case.  It should take the data, and save to the file.
>
> def add_post(request):
> if request.method == 'POST':
> form = forms.postForm(request.POST)
> if form.is_valid():
> new_post= Post(
> title = form.clean_data['title'],
> description = form.clean_data['description'],
> created_at =
> datetime.utcnow(),
> )
>
> new_post.save()
> return HttpResponseRedirect(new_post.get_absolute_url())
> else:
> form = forms.postForm()
> return render_to_response('post/post_add.html',
>   { 'form': form,
>   'html_head': ''
>   },
>   context_instance=RequestContext(request))
>
>
> >
>


-- 
Honza Kr�l
E-Mail: [EMAIL PROTECTED]
ICQ#:   107471613
Phone:  +420 606 678585

--~--~-~--~~~---~--~~
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: Generate a tree List...

2007-03-02 Thread Jeremy Dunck

On 3/2/07, Jens Diemer <[EMAIL PROTECTED]> wrote:
>
> I thought with django i would choose a full features framework :(

It works pretty well for me and many others.  Writing a template tag
is a reasonable solution, IMHO.  :-/

--~--~-~--~~~---~--~~
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: Generate a tree List...

2007-03-02 Thread Jens Diemer

Jeremy Dunck schrieb:
> If you want recursion in templates, why not just use Jinja?

Jinja is super cool. But I would like to keep the PyLucid package small.

I thought with django i would choose a full features framework :(

-- 
Mfg.

Jens Diemer



CMS in pure Python CGI: http://www.pylucid.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: Recursion in templates... again

2007-03-02 Thread Jens Diemer

Grupo Django schrieb:
> Hello, I have been looking around about some information about how to
> do recursion in templates but what I found didn't help me.
> ...
> 
> And the plan is to create a menu like this:
> - Entry 1
> -- Subentry 1_1
> -- Subentry 1_2
>  sub_Subentry 1_2_1
> - Entry 2
> ...

I have the same Problem:
http://groups.google.com/group/django-users/browse_thread/thread/3bd2812a3d0f7700/e97a9cd4348b0471?#e97a9cd4348b0471

Did you find a solution?


I found this:
https://svn.greenpeace.org/projects/custard/browser/production/trunk/melt/apps/custard/templatetags/customtags.py
But the code is for an older django version. I don't know how to update 
it...


So, if there is no solution, i must use jinja...


-- 
Mfg.

Jens Diemer



CMS in pure Python CGI: http://www.pylucid.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
-~--~~~~--~~--~--~---



Navigations with django

2007-03-02 Thread Sulo

hi guys,

im sorry if this question is frequently asked but what is the right
way to make a navigation in django ... when a database backend is used
for site content storage...

the first question is ... how to link to the sites ... the first idea
is to but an encoded form of the content title in the url ... but this
is some kind of stupid cause if the title changes the search engines
will no longer find the site ... but this is just a minor question ...

the main thing is ... how to put the navigation as an item into
django ... i tried to put it as a template tag inside ... and wrote a
navigation template tag ... but if one wants a section/category/item
navigation this thing ends up kind of messy ...

so the question is is there any std way to build a navigation or how
do you build navigations ... so that i can learn from you ... im kind
of new to django so please be gentil ;-)

thanks for your attention ;-)

regards


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



DateField

2007-03-02 Thread DuncanM

In my models I use DateField quite a few times, is there any way I can
adjust it so it stores information in the database as dd/mm/yy and
retrieves/handles it in this way too rather then its current -mm-
dd format?

Thanks


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



Re: Generate a tree List...

2007-03-02 Thread Jeremy Dunck

On 3/2/07, Jens Diemer <[EMAIL PROTECTED]> wrote:
>
> Jeremy Dunck schrieb:
> >> I found this:
> >> https://svn.greenpeace.org/projects/custard/browser/production/trunk/melt/apps/custard/templatetags/customtags.py
> >>
> >> But i don't know how i can use this.
>
> Hm :(
> The code is for an older django version.

If you want recursion in templates, why not just use Jinja?

--~--~-~--~~~---~--~~
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: Rich text editor

2007-03-02 Thread Kenneth Gonsalves


On 02-Mar-07, at 6:51 PM, Alessandro Ronchi wrote:

> Is there some other better editor?

try tiny_mce - well documented in django wiki and mailing list

-- 

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



Rich text editor

2007-03-02 Thread Alessandro Ronchi

Hi to all.
I'm trying to add a rich text editor to a field of my model, following
the tutorial on
http://code.djangoproject.com/wiki/AddDojoEditor

I have this directory structure:

./
./gallery
./gallery/locale
./gallery/locale/it
./gallery/models.py
./gallery/views.py
./locale
./locale/it
./manage.py
./media
./media/dojo (with all the contents of dojo-0.4.1-kitchen_sink.tar.gz )
./media/dojo/dojo.js
./media/js
./media/js/admin
./media/js/admin/AddRichTextEditing.js
./settings.py
./urls.py

into
i have a class with

description = models.TextField(_("description"),help_text='Rich Text
Editing.', blank=True, null=True)
and
class Admin:
js = ['media/js/admin/AddRichTextEditing.js']
pass


The problem is that it doesn't replace the "Rich Text Editing." with the
 editor.

maybe my mistake is on media settings or directory structure?
Must I have something in urls?

in my settings.py I have:

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT =
 '/home/aronchi/documenti/sviluppo/workspace/Brunori/museobrunori/media/'

# URL that handles the media served from MEDIA_ROOT.
# Example: "http://media.lawrence.com";
MEDIA_URL = 'http://localhost:8000/media'

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use
 a # trailing slash.
# Examples: "http://foo.com/media/";, "/media/".
ADMIN_MEDIA_PREFIX = '/media/'


Is there some other better editor?

Thanks in advance.

-- 
Alessandro Ronchi
Skype: aronchi - Wengo: aleronchi
http://www.alessandroronchi.net - Il mio sito personale
http://www.soasi.com - Sviluppo Software e Sistemi Open Source

--~--~-~--~~~---~--~~
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: hosting single static files at root? (modpy + apache)

2007-03-02 Thread Bram - Smartelectronix

Michael Cuddy wrote:
>> how can I host a few single files at root level, like for example a 
>> crossdomain.xml file. Using Apache2 + mod_python.
>>
>> ( http://www.moock.org/asdg/technotes/crossDomainPolicyFiles/ )
>>
>> thx for any hints,
> 
> Here's what I'm doing.  My (django pertinent part of) apache configuration
> looks like this:

thanks Michael,

that helped a bit!

  - bram

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



HOT PICS OF INDIAN BABES

2007-03-02 Thread hot babe
HOT PICS OF BOLLYWOOD ACTRESS
http://bollywoodactress.blogspot.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-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
-~--~~~~--~~--~--~---



Clean permission table

2007-03-02 Thread Dirk Eschler

Hi,

during development apps are sometimes removed or renamed. What's a good way to 
clean the leftovers from the permissions table without breaking something?

Best Regards.

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



Re: Generate a tree List...

2007-03-02 Thread Jens Diemer

Jeremy Dunck schrieb:
>> I found this:
>> https://svn.greenpeace.org/projects/custard/browser/production/trunk/melt/apps/custard/templatetags/customtags.py
>>
>> But i don't know how i can use this.

Hm :(
The code is for an older django version.

-- 
Mfg.

Jens Diemer



CMS in pure Python CGI: http://www.pylucid.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
-~--~~~~--~~--~--~---



Transfer-Encoding: chunked =? Content-Length

2007-03-02 Thread meledictas

Hi all,

Don't know this is a right place to ask this question :(

I got problem when I used django to serve xml-rpc request. By
definetion, The Content-Length of request must be specified and must
be correct (http://www.xmlrpc.com/spec). But some client, they siad
that Transfer-Encoding: chunked." is a valid alternative to Content-
Length. I think this confict to xml-rpc spec. Some web test tools make
a request this way (jmeter) and the problem is django server doesn't
understand it and raise xml.parsers.expat.ExpatError:no element found:
line 1, column 0 exception

If I use Apache instead of django server, will problem be solved?

Any sugguestion is welcomed

Regards


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



hi

2007-03-02 Thread engin kaya

Hey!  Check out this page I published using Google Page Creator.

AGLOCO
http://ebibanzai.googlepages.com/home

--~--~-~--~~~---~--~~
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: Filtering a blank date field

2007-03-02 Thread Phil Powell

Well, to answer my own question, it turned out that the Q object was
the key to this.  It allows me to use a more complex OR statement,
rather than the usual AND.  So I've ended up with:

class ActiveManager(models.Manager):
  def get_query_set(self):
objects = super(ActiveManager, self).get_query_set()
objects = objects.filter(Q(active_from__isnull = True) |
Q(active_from__lte = datetime.datetime.today()))
objects = objects.filter(Q(active_to__isnull = True) |
Q(active_to__gte = datetime.datetime.today()))
return objects

On 02/03/07, Phil Powell <[EMAIL PROTECTED]> wrote:
> I'm writing a custom Manager to only return objects which fall within
> dates set for Active From and Active To fields.  It currently looks
> like this:
>
> class ActiveManager(models.Manager):
>   def get_query_set(self):
> objects = super(ActiveManager, self).get_query_set()
> objects = objects.exclude(active_from__lt = datetime.datetime.today())
> objects = objects.exclude(active_to__gt = datetime.datetime.today())
> return objects
>
> Here's the gotchya though: if either of those dates aren't set, I want
> the object to still be returned.  i.e. if Active From isn't set, then
> it's date should be treated as the beginning of time.
>
> An easy fix would be for me to make these required fields, but I'd
> quite like them to be optional.  Is there any way I can do this
> without writing a custom query?
>
> -Phil
>

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



Filtering a blank date field

2007-03-02 Thread Phil Powell

I'm writing a custom Manager to only return objects which fall within
dates set for Active From and Active To fields.  It currently looks
like this:

class ActiveManager(models.Manager):
  def get_query_set(self):
objects = super(ActiveManager, self).get_query_set()
objects = objects.exclude(active_from__lt = datetime.datetime.today())
objects = objects.exclude(active_to__gt = datetime.datetime.today())
return objects

Here's the gotchya though: if either of those dates aren't set, I want
the object to still be returned.  i.e. if Active From isn't set, then
it's date should be treated as the beginning of time.

An easy fix would be for me to make these required fields, but I'd
quite like them to be optional.  Is there any way I can do this
without writing a custom query?

-Phil

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



hi

2007-03-02 Thread engin kaya

Hey!  Check out this page I published using Google Page Creator.

AGLOCO
http://ebibanzai.googlepages.com/home

--~--~-~--~~~---~--~~
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: newforms: no attribute 'form_for_instance'

2007-03-02 Thread Benedict Verheyen

stevelewis schreef:
> So I've developed on my laptop, and am trying to deploy to a unix box,
> and most things work fine, but I'm using the newforms form for
> instance method, and it can't find it:
> 
> 'module' object has no attribute 'form_for_instance'
> 
> It appears to be there, but I'm not sure why I can't see it. Is there
> something I'm doing wrong? When I do a print dir(forms.models) all I
> get is this:
> 
> ['__all__', '__builtins__', '__doc__', '__file__', '__name__',
> 'form_for_fields', 'form_for_model']
> 
> The code I'm calling is the following:
> 
> order = Order.objects.get(pk=order_id)
> OrderForm = forms.models.form_for_instance(order)
> 
> Any ideas? Thanks!
> Steve

Steve,

are you importing the correct forms?

from django import newforms as forms

I forgot to change my import once and i got a similar error until
i fixed the import statement.

Regards,
Benedict


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



hi

2007-03-02 Thread engin kaya

Hey!  Check out this page I published using Google Page Creator.

Home How AGLOCO Works AGLOCO Referrals SIGN UP TODAY!
http://ebibanzai.googlepages.com/home

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



Home How AGLOCO Works AGLOCO Referral

2007-03-02 Thread engin kaya

Hey!  Check out this page I published using Google Page Creator.

Home How AGLOCO Works AGLOCO Referrals SIGN UP TODAY!
http://ebibanzai.googlepages.com/home

--~--~-~--~~~---~--~~
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: Generate a tree List...

2007-03-02 Thread Jens Diemer

Jens Diemer schrieb:
> Jeremy Dunck schrieb:
>>> I found this:
>>> https://svn.greenpeace.org/projects/custard/browser/production/trunk/melt/apps/custard/templatetags/customtags.py
>>>
>>> But i don't know how i can use this.
>> Yeah, I'd be careful about the license.  I don't see one.
>> You might contact one of these folks:
>> https://svn.greenpeace.org/projects/custard/browser/doc/copyright.html
> 
> No problem, the source is under the GPL and PyLucid is under GPL, too ;)

Sorry i forgot the link to the license:

https://svn.greenpeace.org/projects/custard/browser/production/trunk/melt/COPYING
 


;)

-- 
Mfg.

Jens Diemer



CMS in pure Python CGI: http://www.pylucid.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
-~--~~~~--~~--~--~---