Re: flatpages

2006-02-21 Thread Mary Adel

really this path will be constant to all flatpages and all what i need
is how i could get the path from the database and put it in the template
is their a way for that

On Tue, 2006-02-21 at 20:02 -0500, Tom Tobin wrote:
> On 2/22/06, Mary Adel <[EMAIL PROTECTED]> wrote:
> >
> > how to call in flatpage aa content i have saved in the database
> > ex i saved the path of the css and java script in the database and i
> > need to call it in my flatpage so how i could do this
> 
> If those files change on a flatpage-by-flatpage basis, you might be
> better off making your own version of Flatpages with fields for the
> CSS/JS locations; you could then pass those into the template as
> appropriate.
> 
> 


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



Re: How to implement this fucntionality ? (current page higlighting)

2006-02-21 Thread coulix

Giving each menu item an id : OK
"and in each section of the site, assign a class to
the body tag based on the section you're in."

i cant't do that i use a template which follow this way :
---


[...]



{% include "header" %}
{% include "menu" %}
{% block content %}{% endblock %}
{% include "footer" %}



---

The only part gettng updated when i go to contact or other, is the
block content,
so unless i start to also change the menu style for each link i dont
see how.

if i a m wrong a example would be nice,
thank you

Wilson Miner wrote:
> You can also do this with CSS and not change your navigation HTML at
> all. Just give each of your navigation items an id (#nav-about,
> #nav-contact, etc.) and in each section of the site, assign a class to
> the body tag based on the section you're in.
>
> Then you can create CSS rules for the "current" section something like this:
>
> .about #nav-about, .contact #nav-contact { font-weight:bold; }
>
> On 2/21/06, coulix <[EMAIL PROTECTED]> wrote:
> >
> > i have this website :
> > http://ozserver.no-ip.com:345/cefinban/recette/1
> > i would like to highlight the menu link representing the current page,
> > for example if its "contacts" , the ">> contacts link in the menu
> > should be bold.
> >
> > using template i could load a different menu block for each  page ? :/
> > any other way ?
> >
> > thank you.
> >
> >
> >
> >


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



Re: freebsd 5.4 mysql problem

2006-02-21 Thread mateja

I am running Ubuntu 5.10, Python 2.4.2, MySQL 4.1.12, and MySQLdb
1.2.1c3, and I have the same problem.  It may be that this is a problem
introduced in a recent release, because all three of us have brought it
up around the same time.  I will post a solution if I find one, but for
now, I have to keep digging!

Mateja


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



Re: freebsd 5.4 mysql problem

2006-02-21 Thread Arthaey Angosii

Dmitry Medvedev wrote:
> i've encountered really weird problem on FreeBSD 5.4 , python 2.4.2 ,
> py24-MySQL-db-1.2.0 and mysql , i've moved my project from Gentoo Linux,
>  used subversion to get latest branch of django,  created mysql
> database, set correct values in setting.py , mysql client logs in with
> this values, but, when i try to  do something like 'python2.4 manage.py
> init' or for example 'inspectdb' results in
>
> Error: The database couldn't be initialized.
> an integer is required

I'm running Mandrake 10.1, Python 2.3.4, MySQL 4.1.5, and MySQLdb
1.2.0. I get the same error message as you. So far, none of the #django
Freenode IRC logs at http://simon.bofh.ms/logger/django/ fixed the
problem.


--
AA


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



how to implement RequiredIfOtherFieldEquals validation?

2006-02-21 Thread gizo

Hiya.

I am completely lost. I want to use the standard AddManipulators
provided. They are cool.
But, I also want to make use of the RequiredIfOtherFieldEquals
validator from django.core.validators.py.

I have searched and searched, but I can't seem to find any reference to
how to implement it (or any of those validators..?)

i have tried adding it in the view like this:
manipulator.fields[3]=formfields.IntegerField(field_name="monthDay",validator_list=[
RequiredIfOtherFieldEquals("periodType","Month")]
and in the model like this:
monthDay = meta.IntegerField(null=True, blank=True,
validator_list=[RequiredIfOtherFieldEquals('periodType','Month')])

and I've tried prefixing with "validators."

Am I trying to do something which can't be done? And if not, how do I
access and use all those validators?

Lost in confusion, 
gizo.


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



Re: admin-logout + opera8.52?

2006-02-21 Thread Julio Nobrega

  When I click "logout" I get a blank screen but I am logged out,
because if I try to access an admin url the login form appears. Opera
8.5, Windows XP.

On 2/21/06, gabor <[EMAIL PROTECTED]> wrote:
>
> hi,
>
> is there anyone using opera8?
>
> because for me it seems that i am unable to log out using opera8.* from
> the admin interface.
>
> so before i start digging deeper...does anyone else has this problem?
>
> thanks,
> gabor
>
>
>


--
Julio Nobrega - http://www.inerciasensorial.com.br

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



Re: filter object_list in generic views

2006-02-21 Thread char

Sorry for the bump. I'm still trying to figure this out. The
extra_lookup_kwargs field of the info_dict seems like it comes close to
doing what I want to do but I can't drive it from a search form so I'm
still stumped. Do I really need to make a custom view if I want to
filter the list results via a search form? Thanks, any help would 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
-~--~~~~--~~--~--~---



Re: flatpages

2006-02-21 Thread Tom Tobin
On 2/22/06, Mary Adel <[EMAIL PROTECTED]> wrote:
>
> how to call in flatpage a content i have saved in the database
> ex i saved the path of the css and java script in the database and i
> need to call it in my flatpage so how i could do this

If those files change on a flatpage-by-flatpage basis, you might be
better off making your own version of Flatpages with fields for the
CSS/JS locations; you could then pass those into the template as
appropriate.

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



Re: Css and Javascript

2006-02-21 Thread Tom Tobin
On 2/22/06, Mary Adel <[EMAIL PROTECTED]> wrote:
>
> I need to save the Css and the Java script file in the database so as i
> can make the user change it easily so how i can do this in an easy way

You could clone Flatpages for the other file types and ForeignKey each
flatpage to a CSS entry and a Javascript entry; make sure you consider
the potential performance issues if you go that route, though. 
(There's a reason people tend to serve CSS and Javascript from static
media servers even if the site itself is dynamic.)  :-)

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



Re: generic views - object_detail and info_dict

2006-02-21 Thread Glenn Tenney

On Tue, Feb 21, 2006 at 09:22:25PM -, Jan Rademaker wrote:
> The 'archive_day' you see in urlpatterns is the name of the view, eg.
> django.views.generic.date_based.archive_day and not some string that's
> appended to the module's name. 

Thanks... for some reason, I had the perception that the urlpatterns
specified the template not the view.  Knowing it's the view I went
to the source code and now understand.  It's amazing how one reads
things when you have an incorrect perception to begin with :-)

Perhaps that might need to be more clear in the docs?

> The default template names for date
> based views happen to be the same as  the name of the corresponding
> view. The default template name for the object_detail view is
> _detail, so in this case entries_detail.
> 
> See
> http://www.djangoproject.com/documentation/generic_views/#using-date-based-generic-views

Except that it's not IN the docs... :-)

At least, searching for "_detail" did not show any such explanation.
The docs for archive_ all have a line like:
   "Uses the template app_label/module_name_archive_day by default."
but the description of object_detail (for both date_based and list_based)
does not have anything to say how the template name is derived.

On a related note... I find it a bit confusing to see something like
"module_name_archive_day" to mean (in my syntax)
"_archive_day" (i.e. the contents of the variable named
"module_name" will be followed by the string "_archive_day").

What with so many things taking 'variables' and strings and combining
them, I would suggest SOME demarcation in the docs when using the name
of a variable in a string along with other characters.  For me,
placing a variable name between <...> is clear since that doesn't show
up as real text, but something is really needed for clarity.  In part,
this did add to my misunderstandings.

-- 
Glenn

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



Re: Bug report [admin]

2006-02-21 Thread limodou

On 2/22/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
>
>
> On 2/21/06, limodou <[EMAIL PROTECTED]> wrote:
> >
> > I don't know if it's a bug in Admin.
> >
> > Any suggestion?
>
> Have you checked the bug database? There are a few bugs logged with the
> Admin system, and a few more with one-to-one fields - the error trace you
> mention seems vaguely familiar to me.
>
> Yours,
> Russ Magee %-)
>

Yes I do. But I can not found something relative to my question. And
if I test the model it is no promblem at all. Just like:

say a = UserProfile object

when I use a.user is no problem.

But if I click UserProfile in admin, the error is complained. So I can
only see the UserProfile model in the first page of admin, but I
cannot go into it.

I'll check bug reports carefully.

Thanks.

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

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



Re: Bug report [admin]

2006-02-21 Thread Russell Keith-Magee
On 2/21/06, limodou <[EMAIL PROTECTED]> wrote:
I don't know if it's a bug in Admin.Any suggestion?Have you checked the bug database? There are a few bugs logged with the Admin system, and a few more with one-to-one fields - the error trace you mention seems vaguely familiar to me.
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  -~--~~~~--~~--~--~---


Re: only show something(form) if javascript-enabled

2006-02-21 Thread gabor

Jason F. McBrayer wrote:
> On Tue, 2006-02-21 at 23:52 +0100, gabor wrote:
> 
>> i wanted to have in the user-manager form a way to do the normal 
>> password-thing (2 password fields, check if they are equal, and so on).
>>
>> so, i created a page-template, put it to the right place so that it 
>> overrides the django-users-manager template,
>> and started some javascript hacking :)
>>
>> i added the password fields to that page, and used javascript to:
>> -when submitting: check if the 2 passwords are equal, and if they are, 
>> calculate the password-has, set it into the password-hash input-field 
>> (which i made hidden), and allow the form to be submitted. otherwise do 
>> not allow the form to be submitted.
> 
> Don't do that.  Calculate the password hash on the server side.
> 
> You're trying to do something in the template that ought to be done in
> the view.  So write a view that does what you want, rather than trying
> to use client-side code to generate stuff to be sent to an existing
> view.
> 

i understand that, but the problem is that such thing is quite hard to 
integrate into the admin-framework.

because i do not control the model (the model is django.models.auth.users).

my previous solution was like you mentioned. i had my own view, with all 
the code entered, but i kept fighting with things like the history for 
the model object, permissions, custom links in the admin-index-page, 
things like that.

in other words, the current solution (javascript based) is an 
implementation-hack, but integrates cleanly with the admin-framework. 
the old solution was a clean implementation the integration of which was 
a hack :))

but if you have an idea how such a custom view can be nicely integrated 
into the admin-framework, just tell me (i still have the sources for 
that view).

gabor

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



Re: only show something(form) if javascript-enabled

2006-02-21 Thread Jason F. McBrayer

On Tue, 2006-02-21 at 23:52 +0100, gabor wrote:

> i wanted to have in the user-manager form a way to do the normal 
> password-thing (2 password fields, check if they are equal, and so on).
> 
> so, i created a page-template, put it to the right place so that it 
> overrides the django-users-manager template,
> and started some javascript hacking :)
> 
> i added the password fields to that page, and used javascript to:
> -when submitting: check if the 2 passwords are equal, and if they are, 
> calculate the password-has, set it into the password-hash input-field 
> (which i made hidden), and allow the form to be submitted. otherwise do 
> not allow the form to be submitted.

Don't do that.  Calculate the password hash on the server side.

You're trying to do something in the template that ought to be done in
the view.  So write a view that does what you want, rather than trying
to use client-side code to generate stuff to be sent to an existing
view.

-- 
++
| Jason F. McBrayer [EMAIL PROTECTED]  |
|  "If you wish to make Pythocles wealthy, don't give him more   |
|   money; rather, reduce his desires."-- Epicurus   |

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



flatpages

2006-02-21 Thread Mary Adel

how to call in flatpage a content i have saved in the database 
ex i saved the path of the css and java script in the database and i
need to call it in my flatpage so how i could do 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
-~--~~~~--~~--~--~---



Css and Javascript

2006-02-21 Thread Mary Adel

I need to save the Css and the Java script file in the database so as i
can make the user change it easily so how i can do this in an easy way 

Thanks,
Mary 


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



Re: only show something(form) if javascript-enabled

2006-02-21 Thread gabor
Jason F. McBrayer wrote:
> Gábor Farkas <[EMAIL PROTECTED]> writes:
> 
>> at the end, i did the followin:
>>
>> - no javascript-visibility tricks
>> - the form's submit buttons are written out using document.write
>> - i added a  tag to warn the user to enable javascript
>>
>> this way, if javascript is disabled, the user cannot submit the form. he 
>> can still see it, but cannot submit (so cannot break anything).
> 
> Unless they, say, save it to disk, edit it, reopen it, and submit the
> form.  Which would be a perfectly logical thing for a user to do when
> presented with a trivially broken form that they legitimately want to
> submit.  I know you know that you can't rely on client-side
> validation, but I just want to say, you _really_ can't rely on
> client-side validation.
> 

i am not relying on client-side validation... in fact i am not doing any 
(well, a little) validation on the client side.

here's the deal:

django, admin interface.

i wanted to have in the user-manager form a way to do the normal 
password-thing (2 password fields, check if they are equal, and so on).

so, i created a page-template, put it to the right place so that it 
overrides the django-users-manager template,
and started some javascript hacking :)

i added the password fields to that page, and used javascript to:
-when submitting: check if the 2 passwords are equal, and if they are, 
calculate the password-has, set it into the password-hash input-field 
(which i made hidden), and allow the form to be submitted. otherwise do 
not allow the form to be submitted.

but if the user has javascript disabled, then the password-hash will not 
  be calculated, the hidden password-field will not be populated, and he 
gets an error message which he will not understand because it is about a 
form field that is not visible :))

i know that this is a hack, but if you know a cleaner and/or simpler way 
to have sane password-handling in the admin-interface, tell me :)

ps: (page-template attached. yes, it's quite ugly :)
ps2: i'm only overriding when the user is not superuser. superusers get 
the "standard" user-manager page.

best regards,
gabor farkas



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
{%extends "admin/change_form" %}
{% load i18n admin_modify adminmedia %}

{% block extrahead %}{{ block.super }}

{% endblock %}



{% block content %}




  
	
		{% if change %}{% if not is_popup %}
		  {% trans "History" %}
		  {% if bound_manipulator.has_absolute_url %}{% trans "View on site" %}{% endif%}
		  
		{% endif %}{% endif %}

{% block form_top %}{% endblock %}

	{% if form.error_dict %}
	
	{% blocktrans count form.error_dict.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
	
	{% endif %}

	{% for bound_field_set in bound_manipulator.bound_field_sets %}


		{% ifequal forloop.counter 1 %}
		   
		{% if bound_field_set.name %}{{ bound_field_set.name }}{% endif %}
		{% for bound_field_line in bound_field_set %}
{% ifequal forloop.counter 2 %}{% endifequal %}
		{% admin_field_line bound_field_line %}
			{% for bound_field in bound_field_line %}
		{% filter_interface_script_maybe bound_field %}
		{% endfor %}
{% ifequal forloop.counter 2 %}{% endifequal %}
		{% endfor %}
		
			
			Password: 
			  
	
		
			
			Password: 
			  
	
		
			
		{% endifequal %}



		{% ifequal forloop.counter 2 %}
		   
		{% if bound_field_set.name %}{{ bound_field_set.name }}{% endif %}
		{% for bound_field_line in bound_field_set %}
		{% admin_field_line bound_field_line %}
			{% for bound_field in bound_field_line %}
		{% filter_interface_script_maybe bound_field %}
		{% endfor %}
		{% endfor %}
			
		{% endifequal %}
		


		{% ifequal forloop.counter 3 %}
		
		   
		{% if bound_field_set.name %}{{ bound_field_set.name }}{% endif %}
		{% for bound_field_line in bound_field_set %}
		{% admin_field_line bound_field_line %}
			{% for bound_field in bound_field_line %}
		{% filter_interface_script_maybe bound_field %}
		{% endfor %}
		{% endfor %}
			
		
		{% endifequal %}
		
		


		{% ifequal forloop.counter 4 %}
		
		   
		{% if bound_field_set.name %}{{ bound_field_set.name }}{% endif %}
		{% for bound_field_line in bound_field_set %}
		{% admin_field_line bound_field_line %}
			{% for bound_field in bound_field_line %}
		{% filter_interface_script_maybe bound_field %}
		{% endfor %}
		{% endfor %}
			
		

admin-logout + opera8.52?

2006-02-21 Thread gabor

hi,

is there anyone using opera8?

because for me it seems that i am unable to log out using opera8.* from 
the admin interface.

so before i start digging deeper...does anyone else has this problem?

thanks,
gabor

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



Re: Subclassing user and OneToOneField

2006-02-21 Thread Kirk McDonald

Kirk McDonald wrote:
> PS: The following hackish thing occurs to me:
> 
> class User(users.User):
>  node = meta.OneToOneField(Node, db_column='id')
>  id = meta.IntegerField(db_column='id', editable=False)
>  class META:
>  replaces_module = 'auth.users'
>  module_name = 'users'
> 
> Is this a completely terrible idea? I haven't tested it yet, though 
> instinct tells me I'll almost certainly have to set the db table up 
> myself...

I'm still not sure what to think of this, but it works in exactly the 
right way. I can now log in to the admin with my User model.

-Kirk McDonald

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



Re: adding page

2006-02-21 Thread Mary Adel

It is working now thanks
On Wed, 2006-02-22 at 03:36 +, Mary Adel wrote:
> I did and i have the tables in the database
> :(
> On Tue, 2006-02-21 at 11:24 +, coulix wrote:
> > did you run pythob manage.py install flatpage ?
> > 
> > 
> > 
> > 
> 
> 
> 
> 


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



Re: generic views - object_detail and info_dict

2006-02-21 Thread Jan Rademaker

Glenn,

The 'archive_day' you see in urlpatterns is the name of the view, eg.
django.views.generic.date_based.archive_day and not some string that's
appended to the module's name. The default template names for date
based views happen to be the same as  the name of the corresponding
view. The default template name for the object_detail view is
_detail, so in this case entries_detail.

See
http://www.djangoproject.com/documentation/generic_views/#using-date-based-generic-views

-janr


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



Re: mod_python & devserver & apache restart

2006-02-21 Thread patrick k

thanks - that worked.

patrick


> 
> On Tue, Feb 21, 2006 at 08:12:30PM +0100, patrick k wrote:
>> 1. is the django development-server only meant for local use? i?m asking
>> because i tried to use it with dreamhost and it doesn?t seem to work.
> 
> You need to specify the hostname and port with runserver.
> 
> i.e. python manage.py runserver hostname:port
> 
> It defaults to 127.0.0.1.
> 
> Nate
> 
> 


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



Re: mod_python & devserver & apache restart

2006-02-21 Thread nate-django

On Tue, Feb 21, 2006 at 08:12:30PM +0100, patrick k wrote:
> 1. is the django development-server only meant for local use? i?m asking
> because i tried to use it with dreamhost and it doesn?t seem to work.

You need to specify the hostname and port with runserver.

i.e. python manage.py runserver hostname:port

It defaults to 127.0.0.1.

Nate

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



Re: prefill admin forms

2006-02-21 Thread Dodger

Hi David,

I have a solution for you that works for everything except ManyToMany
fields (I believe).  If there's an easier way to do this, I'd love to
hear about it, and if anyone has an idea how I could push further to
tackle ManyToMany fields I'd love to hear it.

from: /contrib/admin/views/main.py copy "def add_stage" to your view
(renaming it would probably be smart - I called mine addMainPage).

in your urls.py add something along the lines of:
(r'^admin/mainpage/(?P[^/]+)/add/',
('fashion18.views.addMainPage')),

(notice here that I've hard coded "mainpage", so in "def add_stage" I
also hard coded app_label:

def addMainPage(request, module_name, show_delete=False, form_url='',
post_url='../', post_url_continue='../%s/', object_id_override=None):
 app_label = "mainpage"

between "# Add default data" and "# Override the defaults with GET
params, if they exist" add what you need to, in mine the important part
looked like:

new_data.update(dict({"subscription":latest_page.subscription,"poll_id":latest_page.p

oll_id,"button_ad_id":latest_page.button_ad_id,"win_id":latest_page.win_id,"online_only":latest_p
   age.online_only}))

Since no object has been created at this point, I'm unable to copy the
data for the ManyToMany field (or, I suspect, a ManyToOne field).  If
anyone could point me in the right direction for copying the ManyToMany
relationships for the new object I'd appreciate it.

For your author example, you could simply modify the add function to
accept your author object (or just the field you need), then manually
set it like I have (and yours would probably be quite a bit easier).

Cheers,

John


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



Re: mod_python & devserver & apache restart

2006-02-21 Thread Peter Harkins

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Tue, Feb 21, 2006 at 08:12:30PM +0100, patrick k wrote:
> 1. is the django development-server only meant for local use? i´m asking
> because i tried to use it with dreamhost and it doesn´t seem to work.

No, it can be used publicly. I've run it on Dreamhost and accessed it
from home, as have outside clients. You'll need to remember to use a
port above 1024 and include this in your URL: eg.
http://example.com:1025/


- --
Peter Harkins  -  http://push.cx


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: If you don't know what this is, it's OK to ignore it.

iD8DBQFD+3Xaa6PWv6+ALKoRArfFAJ0dhfMlLF/ZYMC6lW1cBqFbweTOKQCcDT/u
T95/MSEJPiIsFfmPnw34gCQ=
=Gta3
-END PGP SIGNATURE-

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



some django how-to-do-this queries

2006-02-21 Thread Alan Bailey

Hi there,

In my existing application, I have a user object/table to track all of our
users.  Users optionally have a foreign_info object with them too, if
they are foreigners.

So it's a one-to-one relationship.  Here's simplified:

class User:
userbase_id = ... the primary key
lots of other fields

class ForeignInfo:
userbase_id = ... also primary key
lots of other fields

My current goal is making the admin page look like I want it to, and I
want to be able to look at the foreign information while editing the user
object.

In my current framework, I had a functionality for a ForeignField, in the
User class, so the foreign fields simply appeared as fields in the User
object.  Is there a way to do that in django, something like:

class User:
country_of_birth = ForeignField(ForeignInfo)
passport_number = ForeignField(ForeignInfo)

So then it just gets the field from the other object.  Right now it just
seems that I can do:

foreign_info = OneToOneField(ForeignInfo)

But then there's weirdness because it expects foreign_info_id to be the ID
field.  Is there a way to get around that, because that's a pretty huge
assumption??  For existing applications.

The difference between this and the Place/Restaurant example on the
website is that I never care solely about the ForeignInfo, it's only as
additional information to the "parent object" User.

And then how on the admin site do I make the foreign information editable
along with the User object?  I want it to look like the Poll/Choices
example in the tutorial, but that's of course with a one-many relation.
It can look like that but with num_in_admin=1.

I'm using the magic-removal branch.  Speaking of, does num_in_admin
work differently in that branch?

Thanks
Alan

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



mod_python & devserver & apache restart

2006-02-21 Thread patrick k

1. is the django development-server only meant for local use? i´m asking
because i tried to use it with dreamhost and it doesn´t seem to work.

2. with using apache/mod_python in production, one has to restart apache
when changing stuff (e.g. models). with my current customers, there are
changes almost everyday. would you still recommend using mod_python? (sorry,
but i don´t have much experience with any apache-issues)

thanks,
patrick


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



Re: using the devel-webserver for production?

2006-02-21 Thread Jason F. McBrayer

gabor <[EMAIL PROTECTED]> writes:

> i'll set up something "serious" then there. i think i'll go with the 
> lighttpd+fcgi approach.

You can also build mod_fastcgi for Apache 1.3.

-- 
++
| Jason F. McBrayer [EMAIL PROTECTED]  |
|  "If you wish to make Pythocles wealthy, don't give him more   |
|   money; rather, reduce his desires."-- Epicurus   |

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



generic views - object_detail and info_dict

2006-02-21 Thread Glenn Tenney

After the tutorials I was looking over the source code for the djangoproject.com
site.  

(1) in djangoproject.com/apps/blog/urls/blog.py I see:

from django.conf.urls.defaults import *

info_dict = {
'app_label': 'blog',
'module_name': 'entries',
'date_field': 'pub_date',
}

urlpatterns = patterns('django.views.generic.date_based',
   (r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(?P\w+)/$', 
'object_detail', dict(info_dict,
 slug_field='slug')),
   (r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/$', 'archive_day', 
info_dict),
   (r'^(?P\d{4})/(?P[a-z]{3})/$', 'archive_month', info_dict),
   (r'^(?P\d{4})/$', 'archive_year', info_dict),
   (r'^/?$', 'archive_index', info_dict),
)


(2) And in djangoproject.com/templates/blog/ are the files:

entries_archive.htmlentries_archive_month.html  
entries_detail.html
entries_archive_day.htmlentries_archive_year.html


I see how "archive_day" (or month or year) gets converted to
"entries_archive_day", but I have no clue how / why / when
"object_detail" gets converted to "entries_detail".  For consistency I
would expect to see just "detail" in urlpatterns and THAT gets the
module_name prepended, but I don't see how the "object" part gets
dropped but the "archive" part doesn't.   ???

-- 
Glenn

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



Re: adding page

2006-02-21 Thread Rock

Mary,

In your templates directory you need a template named default.html.
Here is what mine looks like:

http://www.w3.org/TR/REC-html40/loose.dtd";>


{{ flatpage.title }}


{{ flatpage.content }}




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



Re: only show something(form) if javascript-enabled

2006-02-21 Thread Jason F. McBrayer

Gábor Farkas <[EMAIL PROTECTED]> writes:

>
> at the end, i did the followin:
>
> - no javascript-visibility tricks
> - the form's submit buttons are written out using document.write
> - i added a  tag to warn the user to enable javascript
>
> this way, if javascript is disabled, the user cannot submit the form. he 
> can still see it, but cannot submit (so cannot break anything).

Unless they, say, save it to disk, edit it, reopen it, and submit the
form.  Which would be a perfectly logical thing for a user to do when
presented with a trivially broken form that they legitimately want to
submit.  I know you know that you can't rely on client-side
validation, but I just want to say, you _really_ can't rely on
client-side validation.

-- 
++
| Jason F. McBrayer [EMAIL PROTECTED]  |
|  "If you wish to make Pythocles wealthy, don't give him more   |
|   money; rather, reduce his desires."-- Epicurus   |

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



Re: Data Flow for an App to Another

2006-02-21 Thread iGL

Thanks for the hint ;-)


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



Calling an OtherField-style validator on an inline/stacked field

2006-02-21 Thread Zanchey

Hi everyone,

I've had a good search on the web, the wiki and the list archives, as
well as asking on IRC, and I'm yet to come up with a good solution to
this problem.

Basically, I'm trying to run a custom validator on a field which is
part of a model linked by a ForeignKey and set to
edit_inline=meta.STACKED.

The custom validator is almost completely the same as
RequiredIfOtherFieldDoesNotEqual, but is posted at the link below just
in case I've missed something obvious.

I am trying to attach this validator to a field which is part of a
model (as seen in the link below) that has a ForeignKey relationship to
another model (representing a person), and that can be edited from
within the parent model's admin pages.

However, in order to get this validator to run, I have to pass the
other_field name as 'parent.n.child' - in this case, payment.0.method -
in order to get the validator to run correctly. I don't have a way to
pass the field name without the number, and I'm not sure of a good way
to derive it (how can I tell which number this payment is?).

Google will no doubt mangle my code beautifully, so if you've got any
idea what I'm on about I'd really appreciate it if you could have a
look at http://django.pastebin.com/565256

Thanks in advance,

David Adam
[EMAIL PROTECTED]
[EMAIL PROTECTED]


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



Re: How to implement this fucntionality ? (current page higlighting)

2006-02-21 Thread Wilson Miner

You can also do this with CSS and not change your navigation HTML at
all. Just give each of your navigation items an id (#nav-about,
#nav-contact, etc.) and in each section of the site, assign a class to
the body tag based on the section you're in.

Then you can create CSS rules for the "current" section something like this:

.about #nav-about, .contact #nav-contact { font-weight:bold; }

On 2/21/06, coulix <[EMAIL PROTECTED]> wrote:
>
> i have this website :
> http://ozserver.no-ip.com:345/cefinban/recette/1
> i would like to highlight the menu link representing the current page,
> for example if its "contacts" , the ">> contacts link in the menu
> should be bold.
>
> using template i could load a different menu block for each  page ? :/
> any other way ?
>
> thank you.
>
>
>
>

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



Admin list filters / searches on foreign keys?

2006-02-21 Thread Daniel

Hello list,

Newbie question: I wonder how I can filter or search lists by foreign
keys. Assuming a 0.91 model like:

class Country( meta.Model):
name  = meta.CharField( _("Name"), maxlength=255)

class City( meta.Model):
name  = meta.CharField( _("Name"), maxlength=255)
country   = meta.ForeignKey( Country)

I would like to either search the city list by country, or to filter
it. The difficulty here is that searches assume CharField behaviour, so
just adding search_fields = ('country', ) predictably fails. Adding a
list_filter has no effect whatsoever.

Assuming that we have several thousand City rows, list drill-down
becomes crucial for usability. (For the hypothetical example above,
probably inline editing would be sufficient.) A hackish way of making
the search work is to replace the table with a view and throw in some
Postgres rules to handle inserts/updates etc. This works OK but it
looks terrible and is hard to maintain because the Django DB magic
cannot be used. Any other solution?

A related note: When adding foreign keys to the list_display, sorting
by clicking on the column header appears to be in order of the
*numerical* foreign key rather than the display name. Any ideas how to
get around 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
-~--~~~~--~~--~--~---



Re: adding page

2006-02-21 Thread coulix

how come it is looking for a template, is it wanted ?


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



Bug report [admin]

2006-02-21 Thread limodou

I have some model just like:

EDITOR_TYPES = (
(1, 'Text Editor'),
(2, 'Rich Text Editor'),
)

class BlogProfile(models.Model):
blog_editor = models.IntegerField(_('Editor'), choices=EDITOR_TYPES)
blog_name = models.CharField(_('Blog name'), maxlength=100)
blog_short_description = models.CharField(_("Blog's short
description"), maxlength=100)

def __repr__(self):
return self.blog_name

class Admin: pass


class UserProfile(models.Model):
user = models.OneToOneField(User)
portrait = models.ImageField(_('Photo'), upload_to='photo', blank=True)
joined_groups = models.ManyToManyField(UserGroup, blank=True)
blog_setting = models.ForeignKey(BlogProfile)

def __repr__(self):
return 'user profile'

class Admin: pass

And manage.py install user_profile is ok. But as I enter admin and
click user_profile, I got an exception:

Exception Type: OperationalError
Exception Value:no such column: auth_user.username

And I check the sql that created by admin is:

'SELECT 
"user_profile_userprofile"."user_id","user_profile_userprofile"."portrait","user_profile_userprofile"."blog_setting_id"
FROM "user_profile_userprofile" ORDER BY "auth_user"."username" DESC'

There is exactly not auth_user and user_profile_userprofile table name
in from clause.

I don't know if it's a bug in Admin.

Any suggestion?

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

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



Re: adding page

2006-02-21 Thread Mary Adel

I did and i have the tables in the database
:(
On Tue, 2006-02-21 at 11:24 +, coulix wrote:
> did you run pythob manage.py install flatpage ?
> 
> 
> 
> 


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



Re: Data Flow for an App to Another

2006-02-21 Thread Tom Tobin
On 2/21/06, iGL <[EMAIL PROTECTED]> wrote:
>
> Hi,
> As I suppose, the Django's concept of separation of application from
> a project, when several apps form the latter, is a very nice
> abstraction of the traditional MVC. It would enable one to re-use apps
> in an extent exceeding what is provided with the "classic" MVC.
>
> However, to do so, one has to organize the model of an app in such a
> way that the app mustn't know anything (or, more precisely, as few as
> needed) about its "neighbors".
>
> That's my question: is there a documentation, or informal blog
> postings, describing how different apps can share data via
> django.core.Site? Browsing django.contrib source is a good way, but the
> aforementioned (docs, blog postings) would also help.

Using Site is the same as using any other external model module; once
you import it, you can refer to parts of it (e.g., through
ForeignKeys) just like parts defined in your local model module.  Site
isn't "special" in this respect.  :-)

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



Re: django problem at dreamhost

2006-02-21 Thread Julio Nobrega

  It looks like something wrong with your code: appname =
'taravar.apps.pages', No module named apps...

On 2/20/06, Lachlan Cannon <[EMAIL PROTECTED]> wrote:
>
> I've been having 500 errors at Dreamhost too. The week before last I finished 
> my
> site, had it up and running and everything was fine. Then checked it on the 
> next
> Monday, and having not changed anything I was getting
>  this mess. Dreamhost say they haven't changed
> anything on the server... I've tried redownloading django fresh from svn and
> that hasn't cleared it up. Has anyone else had a problem like this?
>
> Thanks.
> --
> Lach
> Personal: http://illuminosity.net/
> Business: http://taravar.com/
>
>
>
>
>
>


--
Julio Nobrega - http://www.inerciasensorial.com.br

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



Re: adding page

2006-02-21 Thread coulix

did you run pythob manage.py install flatpage ?


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



Re: How to implement this fucntionality ? (current page higlighting)

2006-02-21 Thread coulix

thanks ! thats cool


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



Re: Manipulator and views problem, where to save object ?

2006-02-21 Thread coulix

I manage to save the image,

first make sure to have :
picture: {{form.image_file}} {{
form.image }} 
in your template

then the view :


#post a form
def create_recette(request):
manipulator = recettes.AddManipulator()
#12 being image_fil , recettes.AddManipulator().fields
manipulator.fields[12].validator_list.append(isValideImageWeight)
manipulator.fields[11].validator_list.append(isValideImageWeight)


if request.POST:
# If data was POSTed, we're trying to create a new Place.
new_data = request.POST.copy()

# Check for errors.
errors = manipulator.get_validation_errors(new_data)

if not errors:
# that was the line to add
new_data.update(request.FILES)

# No errors. This means we can save the data!
manipulator.do_html2python(new_data)
new_recette = manipulator.save(new_data)
# Redirect to the object's "edit" page. Always use a 
redirect
# after POST data, so that reloads don't accidently 
create
# duplicate entires, and so users don't see the 
confusing
# "Repost POST data?" alert box in their browsers.
return HttpResponseRedirect("/cefinban/recette/%i/" %
new_recette.id)
else:
# No POST, so we want a brand new form without any data or 
errors.
errors = new_data = {}

# Create the FormWrapper, template, context, response.
form = formfields.FormWrapper(manipulator, new_data, errors)
return render_to_response('recettes/recettes_form', {'form': form})

--
BUT,
the validator for image is still not called, even if i upload a non
picture file it will not complain, even
if i make the validator to raise an error as follow

def isValideImageWeight(field_data, all_data):
raise validators.ValidationError, "!!RAISED!!"

so  it is clear that no validator are called.
why ? how to make it work ? to finally have a working form including an
image field.


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



Re: adding page

2006-02-21 Thread Mary Adel

I am still having problem with Django flatepages and here is the error:
I am using appach server and i didn't write anything in the url.py or
even in the view.py i just added in the setting.py file the 
in the middle class:
   "django.contrib.flatpages.middleware.FlatpageFallbackMiddleware",

and in the installed applicatins:
'django.contrib.flatpages',
what else should i do :(


Mod_python error: "PythonHandler django.core.handlers.modpython"

Traceback (most recent call last):

  File "/usr/lib64/python2.4/site-packages/mod_python/apache.py", line 299, in 
HandlerDispatch
result = object(req)

  File 
"/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/core/handlers/modpython.py",
 line 165, in handler
return ModPythonHandler()(req)

  File 
"/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/core/handlers/modpython.py",
 line 139, in __call__
response = self.get_response(req.uri, request)

  File 
"/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/core/handlers/base.py",
 line 95, in get_response
return callback(request, **param_dict)

  File 
"/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/views/defaults.py",
 line 58, in page_not_found
t = loader.get_template(template_name)

  File 
"/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/core/template/loader.py",
 line 73, in get_template
return get_template_from_string(*find_template_source(template_name))

  File 
"/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/core/template/loader.py",
 line 66, in find_template_source
raise TemplateDoesNotExist, name

TemplateDoesNotExist: 404






On Mon, 2006-02-20 at 23:40 +, kmh wrote:
> Mary Adel wrote:
> > I have anither questions on the flatepage
> > Does the flat page need any configuration for the url.py file or no
> > cause i made a faltepage but it didn't appear in the browser so i really
> > don't know the steps to make it appear in the browser
> 
> If you've added:
> 
> django.contrib.flatpages.middleware.FlatpageFallbackMiddleware
> 
> to your middleware list as in the documentation then that is all you
> need.  There is no URL hook because flatpages work as middleware by
> catching 404 responses and seeing if there is a corresponding flatpage
> and serving that instead.  It's been a while since I used them but I
> think you need to make sure you have a trailing slash on the URL in the
> admin.
> 
> If you are running Django from SVN then there is a chance that you are
> seeing the bug that Tom caught in #1376.  It is now fixed so just do
> svn update
> 
> Kieran
> 
> 
> 
> 


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



Re: How to implement this fucntionality ? (current page higlighting)

2006-02-21 Thread akaihola

A simple solution is to indicate the current page (or section) in the
context. You can do it in your urls.py (see
http://www.djangoproject.com/documentation/url_dispatch/#passing-extra-options-to-view-functions
) or in views.py.

Let's say you have inserted {'section': 'ajouter'} in your context.
Then in your menu template you can do:

{% ifequal section "ajouter" %}
Ajouter une recette
{% else %}
Ajouter une recette
{% endifequal %}


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



Re: only show something(form) if javascript-enabled

2006-02-21 Thread Gábor Farkas

Brett Parker wrote:
> On Mon, Feb 20, 2006 at 10:36:38PM +, Graham King wrote:
>>   You could make the form invisible using css:
>>
>> #theFormId {
>>display: none;
>> }
>>
>>   then use Javascript to change this to display = block. If they don't 
>> have Javascript the form won't appear.
>>
>>   Or you could use Javascript to write the form out, as in:
>> 
>> document.write('
'); >> >> but the CSS version is much cleaner. >> >> And yes, you should also make sure you check the data on the server >> side, otherwise something nasty is bound to happen. > > Unfortunate side effect of the CSS method, however, is what happens when > the user isn't using a browser that supports CSS, say a text based > browser. You'll then get the form displayed, which probably isn't the > right way to go ;) > > The javascript, although not the cleanest way, is probably best for the > case that you really do not want the form to be displayed. > thanks for the help. at the end, i did the followin: - no javascript-visibility tricks - the form's submit buttons are written out using document.write - i added a tag to warn the user to enable javascript this way, if javascript is disabled, the user cannot submit the form. he can still see it, but cannot submit (so cannot break anything). gabor --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---

How to implement this fucntionality ? (current page higlighting)

2006-02-21 Thread coulix

i have this website :
http://ozserver.no-ip.com:345/cefinban/recette/1
i would like to highlight the menu link representing the current page,
for example if its "contacts" , the ">> contacts link in the menu
should be bold.

using template i could load a different menu block for each  page ? :/
any other way ?

thank you.


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



Subclassing user and OneToOneField

2006-02-21 Thread Kirk McDonald

I have expanded auth.User (gosh that seems to be a popular thing to do) 
according to the instructions here:
 http://code.djangoproject.com/wiki/ExtendedUserModel
The particulars are more complicated to explain than the code itself:

class User(users.User):
 id = meta.OneToOneField(Node, db_column='id')
 class META:
 replaces_module = 'auth.users'
 module_name = 'users'

The first question you're probably asking (beyond "What the hell are you 
thinking?") is "What's Node?" The short answer is:

class Node(meta.Model):
 title = meta.CharField(maxlength=255, blank=False)
 nodetype = meta.CharField(maxlength=30)

 def __repr__(self):
 return self.title

I also have a Document model that is likewise very simple:

class Document(meta.Model):
 node = meta.OneToOneField(Node)
 content = meta.TextField()

Every Document is-a Node. Every User is-a Node. Assume I have various 
other kinds of things that are also Nodes. If I want the User to also 
have a Document tied to its Node (say, for a bio or whatnot), that is 
quite simple to arrange.

This is all fine and dandy, but changing the id field like this isn't 
doing precisely what I want: The normal, default, AutoField id field is 
named 'id', i.e.:

 >>> from django.models.node import nodes
 >>> n = nodes.get_object(pk=3)
 >>> n.id
3

But with my User model:

 >>> from django.models.auth import users
 >>> u = users.get_object(pk=3)
 >>> u.id
Traceback (most recent call last):
   File "", line 1, in ?
AttributeError: 'User' object has no attribute 'id'
 >>> u.id_id
3

Duh! The magic turns id into id_id. It's just what OneToOneField does. 
This difference in the interfaces of my User class and the standard one 
rears its ugly head when I try to log in to the admin:

[snip]
Exception Value:'User' object has no attribute 'id'
[snip]
/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/contrib/admin/views/decorators.py
 
in _checklogin

   85. request.session[users.SESSION_KEY] = user.id
[snip]

Oh dear.

I have two options as I see it: I can either edit the admin code (not 
preferable for any number of reasons), or I can somehow convince an id 
attribute to spring into existance. Being relatively new to Django, I am 
not sure of the best way to do either of these.

-Kirk McDonald

PS: The following hackish thing occurs to me:

class User(users.User):
 node = meta.OneToOneField(Node, db_column='id')
 id = meta.IntegerField(db_column='id', editable=False)
 class META:
 replaces_module = 'auth.users'
 module_name = 'users'

Is this a completely terrible idea? I haven't tested it yet, though 
instinct tells me I'll almost certainly have to set the db table up 
myself...

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



Re: only show something(form) if javascript-enabled

2006-02-21 Thread Brett Parker

On Mon, Feb 20, 2006 at 10:36:38PM +, Graham King wrote:
> 
>   You could make the form invisible using css:
> 
> #theFormId {
>display: none;
> }
> 
>   then use Javascript to change this to display = block. If they don't 
> have Javascript the form won't appear.
> 
>   Or you could use Javascript to write the form out, as in:
> 
> document.write('');
> 
>   but the CSS version is much cleaner.
> 
>   And yes, you should also make sure you check the data on the server 
> side, otherwise something nasty is bound to happen.

Unfortunate side effect of the CSS method, however, is what happens when
the user isn't using a browser that supports CSS, say a text based
browser. You'll then get the form displayed, which probably isn't the
right way to go ;)

The javascript, although not the cleanest way, is probably best for the
case that you really do not want the form to be displayed.

Cheers,
Brett.

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



Data Flow for an App to Another

2006-02-21 Thread iGL

Hi,
As I suppose, the Django's concept of separation of application from
a project, when several apps form the latter, is a very nice
abstraction of the traditional MVC. It would enable one to re-use apps
in an extent exceeding what is provided with the "classic" MVC.

However, to do so, one has to organize the model of an app in such a
way that the app mustn't know anything (or, more precisely, as few as
needed) about its "neighbors".

That's my question: is there a documentation, or informal blog
postings, describing how different apps can share data via
django.core.Site? Browsing django.contrib source is a good way, but the
aforementioned (docs, blog postings) would also help.

Please, give me links to them, if they are available.
Thanks in advance,
Giorgi


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



filter object_list in generic views

2006-02-21 Thread char


I'd like to have a search form drive a generic list/detail view. Is
there a way to filter the db query that generates object_list based on
a search form? It doesn't seem like I should have to write a custom
view just to filter list results.

Thanks

Charlie


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