Re: Using HttpResponseNotModified

2007-03-11 Thread shevken

Ignore.

On Mar 12, 12:39 pm, "shevken" <[EMAIL PROTECTED]> wrote:
> Hi Guys,
>
> I do not want a certain view to refresh my html page.
>
> so I got this method,
>
> def silent_update():
># Do secret stuff
>return HttpResponseNotModified()
>
> ---
> But i got this error:
>
> Traceback (most recent call last):
>
>   File "C:\Python24\lib\site-packages\django\core\servers
> \basehttp.py", line 272, in run
> self.result = application(self.environ, self.start_response)
>
>   File "C:\Python24\lib\site-packages\django\core\servers
> \basehttp.py", line 614, in __call__
> return self.application(environ, start_response)
>
>   File "C:\Python24\lib\site-packages\django\core\handlers\wsgi.py",
> line 193, in __call__
> response = middleware_method(request, response)
>
>   File "C:\Python24\lib\site-packages\django\contrib\sessions
> \middleware.py", line 74, in process_response
> patch_vary_headers(response, ('Cookie',))
>
>   File "C:\Python24\lib\site-packages\django\utils\cache.py", line
> 104, in patch_vary_headers
> if response.has_header('Vary'):
>
> TypeError: unbound method has_header() must be called with
> HttpResponseNotModified instance as first argument (got str instance
> instead)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: Any known issues with ChangeManipulators and large objects?

2007-03-11 Thread Malcolm Tredinnick

On Mon, 2007-03-12 at 05:00 +, [EMAIL PROTECTED] wrote:
> I was just wondering if there were any known issues regarding speed
> with ChangeManipulators and large objects?
> 
> I'm using custom ChangeManipulators successfully on about 50 pages
> right now... but when I did an edit page for one of my largest
> database tables ( about 50 columns... and about 20 of them are foreign
> keys to other objects that also contain foreign keys ), my page load
> time shot up to about 30 seconds.
> 
> If I comment out the line where I instantiate the custom change
> manipulator..and just pass None in for the Form ... it loaded fast
> (obviously blank forms load fast..heh).  So then I decided to rewrite
> the page using old fashioned forms where I set the values on each
> field in the template via the object...and it went really fast then
> too.
> 
> I could paste the code in here..but I wasn't doing anything fancy.. I
> was just flattening the data from all of the objects...then loading
> the form...so thought I'd ask on the off chance if others had seen
> this happen?

Unfortunately there is a problem in that case (foreign keys with lots of
related data). It is ticket #2638.

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: Reversed edit_inline?

2007-03-11 Thread simonbun

Indeed, this feature is important to me too. I'm planning to implement
it myself, but obviously only after the newforms admin is finished.
I'll post it as a patch when it's done.

regards,
Simon

On Mar 12, 1:11 am, "jfagnani" <[EMAIL PROTECTED]> wrote:
> > I could add two foreignkey fields to Address referencing Person and
> > Company respectively and allow both to be null. Or I could just remove
> > the Address class and move all address fields into both Person and
> > Company instead. But both these solutions are IMO uglier.
>
> I'm in the exact same position as you. I use Address for quite a few
> tables: Orders, Shipments, Customers, People, Warehouses. It only
> makes sense to have an Address object to hold this information.
> Especially when an Order has three addresses.
>
> I'm not worried about the admin interface so much though, so my first
> solution was to write my own Manipulator, adding each address field
> individually. This was a royal pain. I then tried some hacks to get it
> to automatically happen, but realized that this was futile with the
> pending newforms changeover.
>
> I really think this usage case should be addressed in Django. There is
> a basic clash between the relational and object-oriented side of the
> Django ORM. In OOP you expect the parent object to have a pointer to
> the child, and in relational models it's usually the other way. Django
> so far has pre-determined that you must follow the relational model,
> even though it strives to hide that with an OO layer.
>
> I posted about this on the dev list and pretty much got ignored. I'm
> not sure why the devs don't consider this important.
>
> -Justin


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: Apache2 displays django app as a file list

2007-03-11 Thread Mikey

No, that didn't work either - I guess it would be helpful if someone
could give me the correct settings for appache2 to run django 0.95
apps.- can someone point me to some examples? I've tried searching the
net, but nothing seems to cover the basics...

On Mar 11, 8:45 am, "Nathan R. Yergler" <[EMAIL PROTECTED]> wrote:
> I don't do tons of mod_python, but one thing that I immediately notice
> is that you're mod_python to handle the "/' location, but requesting
> the "/python" location.  Does it work if you dohttp://mydom.net/?
>
> On 3/11/07, Mikey <[EMAIL PROTECTED]> wrote:
>
>
>
> > I have mod-python working - I got a test page to work, but I can't
> > seem to get apache to execute python code with in my django app. This
> > is what I get when browsing to the django app..http://www.mydom.net/python
>
> > [DIR] Parent Directory -
> > [   ] __init__.py 11-Mar-2007 08:230
> > [   ] __init__.pyc11-Mar-2007 08:25  123
> > [   ] manage.py   11-Mar-2007 08:23  546
> > [   ] settings.py 11-Mar-2007 08:25  2.8K
> > [   ] settings.pyc11-Mar-2007 08:25  1.8K
> > [DIR] test/   11-Mar-2007 08:54-
> > [   ] urls.py 11-Mar-2007 08:23  225
> > [   ] urls.pyc11-Mar-2007 08:55  220
>
> > I'm a new linux user and probably don't have something configured
> > properly.
>
> > I've followed as much of the online documentation and google help as I
> > can. I have this in a file under sites-enabled
>
> > 
> > ServerName surface
> > DocumentRoot /home/mike/www/
> > 
> > SetHandler python-program
> > PythonHandler django.core.handlers.modpython
> > PythonPath "['/home/mike/downloads/trunk/'] + sys.path"
> > SetEnv DJANGO_SETTINGS_MODULE python.settings
> > PythonDebug On
> > 
> > 
> > SetHandler None
> > 
> > 
>
> > Is is something in this file that I haven't configured properly? I did
> > a 'django-admin.py startproject python in the /home/mike/www/
> > directory
> > Does that mean my DJANGO_SETTINGS_MODULE is python.settings? Any help
> > would be greatly appreciated :)
>
> > Mike.


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



django install on mac osx 10.4.8

2007-03-11 Thread [EMAIL PROTECTED]

Hi everybody,

i'm trying to install django, i followe dthe instruction on the django
web site but it doesn't work
been looking around and the only tutorial that i yet understand
( sorry it's al a bit complicated for me ) require to install macport,
which i'm not really keen on ( tried earlier for other reasons and got
only trouble ).

playing around i installed the latest release of python 2.5

then i downloaded again the latest release of django but when i do the
install command

sudo python setup.py install

Downloading 
http://cheeseshop.python.org/packages/2.5/s/setuptools/setuptools-0.6c1-py2.5.egg
Traceback (most recent call last):
  File "setup.py", line 2, in 
ez_setup.use_setuptools()
  File "/Users/zapata/Desktop/django/Django-0.95.1/ez_setup.py", line
72, in use_setuptools
egg = download_setuptools(version, download_base, to_dir,
download_delay)
  File "/Users/zapata/Desktop/django/Django-0.95.1/ez_setup.py", line
126, in download_setuptools
src = urllib2.urlopen(url)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/urllib2.py", line 121, in urlopen
return _opener.open(url, data)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/urllib2.py", line 380, in open
response = meth(req, response)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/urllib2.py", line 491, in http_response
'http', request, response, code, msg, hdrs)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/urllib2.py", line 418, in error
return self._call_chain(*args)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/urllib2.py", line 353, in _call_chain
result = func(*args)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/urllib2.py", line 499, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found

And i can't do anything,

has anybody any idea how to solve this?

thanks in advance


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: User id foreign key

2007-03-11 Thread [EMAIL PROTECTED]

You have to do something like this in your model:
user_created = models.ForeignKey(User, related_name="user_created")

Then instead of saying User.entry_set .. I think its just
user_created_set ... but not positive on that.

You have to do this normally when you have two ForeignKeys on the same
class both referencing User  ( don't ask me why.. I haven't figured
that part out yet )

On Mar 11, 4:30 pm, Christian Hoeppner <[EMAIL PROTECTED]> wrote:
> Thanks a whole bunch!
>
> I got another error, saying like so:
>
> blog.entry: Accessor for field 'user_created' clashes with related field
> 'User.entry_set'. Add a related_name argument to the definition for
> 'user_created'.
>
> But I guess I can find out on my own. If anyone wants to reply for the
> sake of completeness, it would also be great.
>
> Thanks!
>
> El dom, 11-03-2007 a las 06:48 +1100, Malcolm Tredinnick escribi?:
>
> > On Sat, 2007-03-10 at 18:07 +, Christian Hoeppner wrote:
> > > Hi there!
>
> > > I wonder if there's a way to link a user to some kind of database entry
> > > using a foreign key field. The problem is, how would I define something
> > > like this? What's the actual name/path/something I use to reference the
> > > auth_user objects?
>
> > Just import the User model and reference it in a ForeignKey field, just
> > like you would for any other model. There's nothing special about that
> > model.
>
> > Malcolm
>
> --
> Chris M. Hoeppner
> Web design & consultancy.
> Passionate about experience. Faithfull about copy.
>  [EMAIL PROTECTED]
> www.chrishoeppner.com/www.pixware.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
-~--~~~~--~~--~--~---



Any known issues with ChangeManipulators and large objects?

2007-03-11 Thread [EMAIL PROTECTED]

I was just wondering if there were any known issues regarding speed
with ChangeManipulators and large objects?

I'm using custom ChangeManipulators successfully on about 50 pages
right now... but when I did an edit page for one of my largest
database tables ( about 50 columns... and about 20 of them are foreign
keys to other objects that also contain foreign keys ), my page load
time shot up to about 30 seconds.

If I comment out the line where I instantiate the custom change
manipulator..and just pass None in for the Form ... it loaded fast
(obviously blank forms load fast..heh).  So then I decided to rewrite
the page using old fashioned forms where I set the values on each
field in the template via the object...and it went really fast then
too.

I could paste the code in here..but I wasn't doing anything fancy.. I
was just flattening the data from all of the objects...then loading
the form...so thought I'd ask on the off chance if others had seen
this happen?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



address book imports of hotmail and aol

2007-03-11 Thread mobil

Hello guys

I m trying to find a django/python address book export import tool for
hotmail and aol
thanks for any pointers

Mobil


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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 HttpResponseNotModified

2007-03-11 Thread shevken

Hi Guys,

I do not want a certain view to refresh my html page.

so I got this method,

def silent_update():
   # Do secret stuff
   return HttpResponseNotModified()

---
But i got this error:

Traceback (most recent call last):

  File "C:\Python24\lib\site-packages\django\core\servers
\basehttp.py", line 272, in run
self.result = application(self.environ, self.start_response)

  File "C:\Python24\lib\site-packages\django\core\servers
\basehttp.py", line 614, in __call__
return self.application(environ, start_response)

  File "C:\Python24\lib\site-packages\django\core\handlers\wsgi.py",
line 193, in __call__
response = middleware_method(request, response)

  File "C:\Python24\lib\site-packages\django\contrib\sessions
\middleware.py", line 74, in process_response
patch_vary_headers(response, ('Cookie',))

  File "C:\Python24\lib\site-packages\django\utils\cache.py", line
104, in patch_vary_headers
if response.has_header('Vary'):

TypeError: unbound method has_header() must be called with
HttpResponseNotModified instance as first argument (got str instance
instead)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: debugging/breakpointing

2007-03-11 Thread [EMAIL PROTECTED]

I'm probably be getting way deep over my head in this since I'm not a
Django user and stuff like command completion is a little bit open-
ended.

However pydb (http://bashdb.sf.net/pydb) has some support for command
completion and at least tries to save it's history across sessions in
a file called ~/.pydbhist if you have "set history save on".

It also has some support for ipython; possibly it will be a little
better in the next releases of ipython and pydb.

In recent pydb releases "set_trace" is called "debugger", since I
think that's a more natural name. (However for die-hard Pythonistas,
"set_trace" will still work.) But having put in a plug for pydb,  I'm
not sure I'd recommend this unless you are willing to dig in to fix
problems you find really annoying. Hopefully pydb may be a little
better organized for fixing problems, but probably not by much and it
could stand quite a bit of rewrite.

Some of the issues in command completion have been written about
here:
http://mail.python.org/pipermail/python-ideas/2007-February/000202.html

And I'll add to the above one other practical issues regarding command
completion: it's been a real pain to deal with the surrounding
context. For example, if invoked via Emacs gud you have one set of
protocols and if ipython another, and if a regular term another, and
if Emacs calling ipython calling pydb..., you get the idea.

If you want to not deal with pydb but  want to  improve pdb instead,
probably adding history across sessions is the easiest thing to fix.
Basically you'd need to add calls to readline.read_history_file() and
readline.write_history_file().  (Of course, you could consult the pydb
code for how to do that.)

Lastly, I don't have any time to work on pydb, so I hope this helps.
Good luck.

On Mar 10, 12:44 am, "Greg Donald" <[EMAIL PROTECTED]> wrote:
> On 3/9/07, Ned Batchelder <[EMAIL PROTECTED]> wrote:
>
> >  PDBlets you do what you want.
>
> Yup.. thanks.
>
> Is there a way to get tab completion working?  Or make it use ipython?
>  I seem to have command history, but not across sessions?
>
> --
> Greg Donaldhttp://destiney.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: Reversed edit_inline?

2007-03-11 Thread chasfs

ORM has been contentious for many years - for more background on the
problems of
ORM, check out Ted Neward's blog entry -
http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx

Peace,
-chasfs




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Chaining ManyToMany Filters Update

2007-03-11 Thread Boris Smus

Dear Djangoites,

I ran into problems trying to chain multiple filters on a QuerySet
with models in a many-to-many relationship. Based on the word from
irc, and from perusal of the mailing list, it seems that this is a
known issue. But the last ML post on it (that I could find) dates back
to 2006-08. Has any progress been made, and is there a workaround? I'm
on the latest svn.

For reference, an illustration of the problem:

In [54]:cs.filter(default_recipe__ingredients__ingredient__id=1)
Out[54]:[, ]

In [55]:cs.filter(default_recipe__ingredients__ingredient__id=3)
Out[55]:[]

In
[56]:cs.filter(default_recipe__ingredients__ingredient__id=3).filter(default_recipe__ingredients__ingredient__id=1)
Out[56]:[]

Thanks,
B


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: VB help!!

2007-03-11 Thread akonsu

i think i am going insane.

On Mar 11, 9:19 pm, "Cynthia" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I am very new in developing systems. So I am seeking help on how to
> complete my system step-by-step. I am using Visual Basic 6.
> Currently,
> I have a form. In that form, I will need to input a Part Number (eg:
> 54556769) in the text box. Then I should tick to select in which
> database file I want to look for my matching Part Number. Please do
> note that more than 1 database files can be selected. Then the
> matching part number output should appear in Ms Excel format. Please
> do note that the source database file is in a FTP. Please do help.
>
> Thank You.


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



VB help!!

2007-03-11 Thread Cynthia

Hello,

I am very new in developing systems. So I am seeking help on how to
complete my system step-by-step. I am using Visual Basic 6.
Currently,
I have a form. In that form, I will need to input a Part Number (eg:
54556769) in the text box. Then I should tick to select in which
database file I want to look for my matching Part Number. Please do
note that more than 1 database files can be selected. Then the
matching part number output should appear in Ms Excel format. Please
do note that the source database file is in a FTP. Please do help.


Thank You.


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



Re: Django Automatic Page Refreshing

2007-03-11 Thread James Bennett

On 3/11/07, johnny <[EMAIL PROTECTED]> wrote:
> I have an online seminar booking application.  What I want to know is,
> if 100 people are currently
> viewing a room that holds max 200 people, and one person out of 100
> books the seat in the room, how do
> I refresh all the 100 pages so that they all have an updated version?

In general, you don't -- this is a limitation of HTTP, because once
you send out the response, you've sent out the response. You don't get
to send any more data until a new client request comes in.

Using a meta refresh is somewhat hackish, but would force a periodic
reload for anyone who's just sitting there looking at the page.
Similarly, firing off an occasional XMLHttpRequest to fetch updated
data will work, and is a bit cleaner.

There's also Comet, which is a method coming out of the folks behind
the Dojo JavaScript toolkit, and which is based on servers keeping
long-lived HTTP connections open so they can keep sending data down
the wire, but unfortunately the load of supporting even a few clients
in that fashion can quickly murder your server.

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

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



Re: Reversed edit_inline?

2007-03-11 Thread jfagnani


> I could add two foreignkey fields to Address referencing Person and
> Company respectively and allow both to be null. Or I could just remove
> the Address class and move all address fields into both Person and
> Company instead. But both these solutions are IMO uglier.

I'm in the exact same position as you. I use Address for quite a few
tables: Orders, Shipments, Customers, People, Warehouses. It only
makes sense to have an Address object to hold this information.
Especially when an Order has three addresses.

I'm not worried about the admin interface so much though, so my first
solution was to write my own Manipulator, adding each address field
individually. This was a royal pain. I then tried some hacks to get it
to automatically happen, but realized that this was futile with the
pending newforms changeover.

I really think this usage case should be addressed in Django. There is
a basic clash between the relational and object-oriented side of the
Django ORM. In OOP you expect the parent object to have a pointer to
the child, and in relational models it's usually the other way. Django
so far has pre-determined that you must follow the relational model,
even though it strives to hide that with an OO layer.

I posted about this on the dev list and pretty much got ignored. I'm
not sure why the devs don't consider this important.

-Justin


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: Unique_together question

2007-03-11 Thread Ramiro Morales

On 3/11/07, Rob J Goedman <[EMAIL PROTECTED]> wrote:

>
> Any reason I can't combine these 2 fields to get a valid 'isUniqueday_sch'
> in the AddManipulator? Full traceback at the end of the email.
>

This is a problem already reported. See tickets #526 and #2470, there is a
workaround described in the comments that involves changing the order of the
fields  in unique_together.

Regards,

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: catalog of django apps?

2007-03-11 Thread Jan Claeys

[Sorry for this late e-mail, I'm catching up with a mail backlog]

On vr, 2007-02-16 at 17:42 +, James Tauber wrote:
> Another aspect of this proposed "Hot Club of France" site would be a 
> catalog of open-source sites. 

If anyone ever makes such a site, then at least name it "Hot Club de
France"...  ;-)

See: 


-- 
Jan Claeys


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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, choices and models

2007-03-11 Thread Massimiliano Ravelli

On 11 Mar, 15:09, enquest <[EMAIL PROTECTED]> wrote:
> I'm using/learning the newforms... I got a model, in this model I have a
> choices list ( ('1', 'foo'), ('2', 'bar' ) that are reprensented as
> select box in the admin...
> However when I import this class to the newforms
> "forms.form_for_model(Gadget)" the choices arn't coming along and the
> field is reprented as a normal textfield... How come?

There is an open ticket about this argument: #3268.

I wrote a simple work-around:

choices = ( ('1', 'foo'), ('2', 'bar' ) )
myform = form_for_model(Gadget)
myform.fields['field_name'] = ChoiceField(choices=choices)

If you need to use form_for_instance remember to update
the initial value or you will not see the saved value pre-selected
on the select box.

choices = ( ('1', 'foo'), ('2', 'bar' ) )
myform = form_for_instance(Gadget_instance)
initial = myform.fields['field_name'].initial
myform.fields['field_name'] = ChoiceField(choices=choices,
initial=initial)

Hope this helps.

Massimiliano


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: User id foreign key

2007-03-11 Thread Christian Hoeppner

Thanks a whole bunch!

I got another error, saying like so:

blog.entry: Accessor for field 'user_created' clashes with related field
'User.entry_set'. Add a related_name argument to the definition for
'user_created'.

But I guess I can find out on my own. If anyone wants to reply for the
sake of completeness, it would also be great.

Thanks!

El dom, 11-03-2007 a las 06:48 +1100, Malcolm Tredinnick escribi�:
> On Sat, 2007-03-10 at 18:07 +, Christian Hoeppner wrote:
> > Hi there!
> > 
> > I wonder if there's a way to link a user to some kind of database entry
> > using a foreign key field. The problem is, how would I define something
> > like this? What's the actual name/path/something I use to reference the
> > auth_user objects?
> 
> Just import the User model and reference it in a ForeignKey field, just
> like you would for any other model. There's nothing special about that
> model.
> 
> Malcolm
> 
> 
> 
> > 
-- 
Chris M. Hoeppner
Web design & consultancy.
Passionate about experience. Faithfull about copy.
 [EMAIL PROTECTED]
 www.chrishoeppner.com / www.pixware.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: (x)html tags used to render newforms

2007-03-11 Thread James Bennett

On 3/11/07, Frédéric Roland <[EMAIL PROTECTED]> wrote:
> I was discussing about layout of forms using CSS and heard that there
> was some tags such as fieldset, label and legend that should allow us to
> make the layout of forms without tables. Is there a reason these tags
> aren't used to render forms in Django ? Does it is hard to add them ?
> (Something like as_label() for example.)

If you have Django print out the entire form's HTML in one go, it will
automatically add 'label' elements for each field. It will not (at the
moment) add fieldsets and legends.

It's also quite easy to output these yourself in a template, and only
have Django print the various 'input'/'select'/'textarea' elements,
allowing unlimited control over the organization and structure of the
form.


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

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



Re: (x)html tags used to render newforms

2007-03-11 Thread anders conbere
You can layout forms in django in which ever way you want. By default
the generic views don't use tables, and newforms has several
convenience functions that will display forms in a number of different
styles (as_p, as_ul). These are all standard html (as well as xhtml)
tags that should be supported by all browsers.

~ Anders

On 3/11/07, Fr�d�ric Roland <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I was discussing about layout of forms using CSS and heard that there
> was some tags such as fieldset, label and legend that should allow us to
> make the layout of forms without tables. Is there a reason these tags
> aren't used to render forms in Django ? Does it is hard to add them ?
> (Something like as_label() for example.)
>
> Are these tags well supported by browsers ?
>
> CC.
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: Api and user auth

2007-03-11 Thread Grupo Django

Thank you for your help!
I think I'll create a form to intorduce the news.
Thank you.

On 10 mar, 08:26, "risomt" <[EMAIL PROTECTED]> wrote:
> Actually, what I said is a bit wrong.
>
> To fill the author field correctly you should use a foreign key that
> points to the User model (again, assuming you're using the builtin
> django.contrib.auth User).
>
> On Mar 10, 2:21 am, "risomt" <[EMAIL PROTECTED]> wrote:
>
> > While I thoroughly agree with the above two, I'll go one step further
> > and say you should probably never put any code that sets admins
> > (superusers, or even straight access to django admin console) into
> > code whatsoever.
>
> > To help you out with a direct answer:
>
> > django has no difference between admin and regular user except a few
> > flags that grant the ability to login to admin (or edit it).  While
> > those flags arent the subject, what you're looking for is part of the
> > request.
>
> > "request.user" will allow access to any *basic* information (assuming
> > you're using the django.contrib.auth module) the author may have
>
> > "request.user.username" is the login name of the current user, and the
> > actual information you want for the author field (I do this for a
> > picture upload app for a local project)


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



Unique_together question

2007-03-11 Thread Rob J Goedman
Earlier I noticed the problem with edit_inline which is now fixed in  
svn.
By the way, this was the very 1st time in 5 months a daily sync with  
svn caused
an issue. Hats off to the developers!

As I mentioned, I am trying to make 'day' and 'sch' unique_together in
class ScheduleDayOfTheWeek.

Any reason I can't combine these 2 fields to get a valid  
'isUniqueday_sch'
in the AddManipulator? Full traceback at the end of the email.

Thanks,
Rob

On Mar 9, 2007, at 2:14 PM, Rob J Goedman wrote:
> Hi,
>
> If I upgrade to revision 4693 (or higher) I get below error.  
> Revision 4692 works fine.
>
> Any hints? I did start to play with unique_together earlier today  
> when I noticed it,
> but don't think that's the reason. It's currently (and has been for  
> several months)
> commented out.
>
> Another small issue, if I try to make an IP address field and port  
> number 'unique_together'
> Django creates an exception with a hint to insert a typecast. It's  
> not clear to me where to
> do that. My workaround is simply to use CharField for the IP address.
>
> Thanks,
> Rob
>
> -- 
> --
>
> The models are:
>
> class Schedule(models.Model):
>   """The Schedule class."""
>   
>   name = models.CharField(maxlength=40, unique=True)
>   sch_excs = models.ManyToManyField(ScheduleHolidayException,  
> null=True, blank=True,
>   filter_interface=models.HORIZONTAL)
>   
>   def __str__(self):
>   return self.name
>   
>   def employees(self):
>   return 'Employees' % 
> self.id
>   employees.allow_tags = True
>   
>   class Admin:
>   fields = (
>   ('Name', {'fields': ('name',), }),
>   ('Holiday exceptions', {'fields': 
> ('sch_excs',), 'classes' :  
> 'collapse'}),
>   )
>   list_display = ('__str__', 'employees')
>   save_on_top = True
>   
>   class Meta:
>   db_table = 'sch'
>
>
> class ScheduleDayOfTheWeek(models.Model):
>   """Access times at days of the weeks
>   """
>   
>   day_choices = (
>   ('0', 'Sunday'),
>   ('1', 'Monday'),
>   ('2', 'Tuesday'),
>   ('3', 'Wednesday'),
>   ('4', 'Thursday'),
>   ('5', 'Friday'),
>   ('6', 'Saturday')
>   )
>   
>   day = models.CharField(maxlength=1, choices=day_choices)
>   sch = models.ForeignKey(Schedule, edit_inline=models.TABULAR,
>   num_in_admin=7, min_num_in_admin=7, max_num_in_admin=7)
>   start_time = models.TimeField(core=True, default = datetime.time 
> (0, 0, 0))
>   end_time = models.TimeField(core=True, default = datetime.time(0,  
> 0, 0))
>   
>   def __str__(self):
>   return self.day + ' of schedule ' + self.sch.name
>   
>   class Meta:
>   unique_together = (('day', 'sch'),)
>   ordering = ('day',)
>   db_table = 'sch_dow'
>   verbose_name_plural = 'Days of the week in schedules'
>

AttributeError at /admin/Application_Settings/schedule/add/
'AddManipulator' object has no attribute 'isUniqueday_sch'

Request Method:
GET
Request URL:
http://localhost:8000/admin/Application_Settings/schedule/add/
Exception Type:
AttributeError
Exception Value:
'AddManipulator' object has no attribute 'isUniqueday_sch'
Exception Location:
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- 
packages/django/db/models/fields/__init__.py in  
get_manipulator_fields, line 239
Traceback (innermost last)

Switch to copy-and-paste view

/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- 
packages/django/core/handlers/base.py in get_response
 response = callback(request, *callback_args,  
**callback_kwargs)
...
▶ Local vars
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- 
packages/django/contrib/admin/views/decorators.py in _checklogin
 return view_func(request, *args, **kwargs)
...
▶ Local vars
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- 
packages/django/views/decorators/cache.py in _wrapped_view_func
 response = view_func(request, *args, **kwargs)
...
▶ Local vars
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- 
packages/django/contrib/admin/views/main.py in add_stage
 manipulator = model.AddManipulator()
...
▶ Local vars
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- 
packages/django/db/models/manipulators.py in __init__
 self.fields.extend(f.get_manipulator_fields 
(self.opts, self, self.change, fol))
...
▶ Local vars
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- 
packages/django/db/models/related.py in 

Search Swish

2007-03-11 Thread Mary

I read on one of the posts here
> At World Online, the search engine (lawrence.com/search,
> ljworld.com/search) uses swish-e (http://swish-e.org/) to index files.

[snip]

> Hope that helps! It would be pretty cool to open-source this mini
> search framework and pop it in django/contrib, but that would be up to
> Jacob to decide.

I'd love to open it up; I don't see any reason that we'd need to
keep
it hidden.  I'll put it on my todo list :)

Jacob

So i would like to know if i can see the code if it already published
cause i need to implement a search criteria in my site and this will
really helps


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



(x)html tags used to render newforms

2007-03-11 Thread Frédéric Roland

Hi,

I was discussing about layout of forms using CSS and heard that there 
was some tags such as fieldset, label and legend that should allow us to 
make the layout of forms without tables. Is there a reason these tags 
aren't used to render forms in Django ? Does it is hard to add them ? 
(Something like as_label() for example.)

Are these tags well supported by browsers ?

CC.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: javascript issue

2007-03-11 Thread Mary

Ohh thank you very much it helps a lot :)


On Mar 11, 5:55 pm, "akonsu" <[EMAIL PROTECTED]> wrote:
> hello,
>
> i have several questions:
>
> 1. why do you have s;ash (/) before quotes in some places like
>
> > homebutton01up.src   = /"media/images/welcome.jpg";
>
> 2. what does "The script doesn't work" mean? i suspect it means the
> images are not shown. is this correct?
>
> 3. "django will not find the image by this way" implies that you serve
> images through django. is this correct?
>
> 4. do you serve the css file through django as well?
>
> 5. have yuo seen the discussion 
> athttp://www.djangoproject.com/documentation/static_files/
>
> hope this helps
> konstantin
>
> On Mar 11, 7:49 am, "Mary" <[EMAIL PROTECTED]> wrote:
>
> > I am implementing a website with Djnago and i have been facing certain
> > issue with a javascript
> > i don't know if this is the right place for the post or no but if any
> > one can help it would be great
>
> > The problem is that when i make the path of the images :/media/images/
> > the image The script doesn't work but when i change it to media/images/
> > the image The script works fine
>
> > But i can't do make the path media/images/the image as django will not
> > find the image by this way so does anyone has as idea how can i make
> > the path of the images media/images and Django can translate it to the
> > right media path
>
> > here is my javascipt:
> > 
> > 
> 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to 

Re: model validation

2007-03-11 Thread Greg Donald

On 3/10/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> Validation happens on the strings submitted from a form, *before* they
> are converted to Python objects (since there's no guarantee we can
> convert them without error). We do not have model-aware validation at
> the moment, but it is coming. Note that what we do have is still good
> for the majority of cases, because you have access to all the submitted
> fields. What you don't have access to is the instance of the model that
> will be affected in the case where you are updating an existing
> instance. That is the feature we will add eventually.

Having to validate the data at every possible form location doesn't
seem very DRY to me.  I should be able to put a single set of
validation rules directly in the model so any form I write in the
future has to validate against them.

> See http://www.djangoproject.com/documentation/forms/#validators for a
> description of how validators work. Although that page talks about
> validators in the context of form submissions, they are the same
> validators that you can specify on models.*Field classes as well.

The newforms page doesn't have much about validation on it:

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

Do the same validation techniques apply from the old forms system to
the newforms?

> Suffice it to say that, in your case, when you submit a string as part
> of a form submission to go into your field, Django will ensure that it
> is non-empty, because you have blank=False.

That doesn't seem to be the case for this particular field I have:

class List(models.Model):
name = models.CharField(maxlength=32, blank=False, null=False)

> python manage.py shell
In [1]: import datetime
In [2]: from mysite.groceries.models import List
In [3]: l = List(name='', created_at=datetime.datetime.now())
In [4]: l.save()
In [5]: l.name
Out[5]: ''

What am I missing here?


-- 
Greg Donald
http://destiney.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: Django Automatic Page Refreshing

2007-03-11 Thread sphogan

There are two ways of doing this:

1) You can use a meta refresh so that every, say, 30 seconds, the page
reloads itself.

2) You can use Ajax to lookup if someone has registered every 30
seconds and then update the display based on the new data (or not if
there is no new data).

Unfortunately, there is no way to have it be instant.  For example, 1
person signs up and then the server pushes an update to everyone on
the site.  This is because HTTP is stateless.  The server has no idea
whether anyone using the system is still using the system.  When you
visit a site, your browser says to the server "hi!  i want this page"
and the server says "cool, here it is!" and then there is no
communication between them until you request something new.  The
server has no idea whether you're staring at the screen, whether
you've closed the window, whether you've shut down your computer,
etc.  As such, the server can't know who's still there to push data
to.

Suffice it to say, your best option would probably be to use Ajax to
send a request to the server and then update the data from the
response, but you will have to do it timed - you could pick every 5
minutes or 5 seconds, but do realise that your server and the person's
browser has to be sending and processing data when these requests
happen.

Good Luck!

On Mar 11, 9:12 am, "johnny" <[EMAIL PROTECTED]> wrote:
> I have an online seminar booking application.  What I want to know is,
> if 100 people are currently
> viewing a room that holds max 200 people, and one person out of 100
> books the seat in the room, how do
> I refresh all the 100 pages so that they all have an updated version?
>
> Thank you.


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



Re: newforms, choices and models

2007-03-11 Thread enquest

Op zondag 11-03-2007 om 15:48 uur [tijdzone +0100], schreef Horst
Gutmann:
> enquest schrieb:
> > 
> > Second question: how can you add a password field from the newforms. you
> > can't define ("correct me if I'm wrong") a password field in the
> > model... And I don't see any option to give a field a password field.
> > 
> > How can I do this?
> > 
> > Thanxs
> > 
> 
> I haven't really tried it so this is probably just a wild guess, but the
> form_for_model function has a formfield callback function that will be
> executed on each field in your model and returns a new instance of the
> FormField to be used for the respective field.
> 
> If you then instantiate your password field to use a CharField that uses
> the PasswordInput widget I think it should work :-) (But again: Wild
> guess ;-) )
> 
> Best regards
> 
> > 

Could you give an example so that I better can understand this.

Enquest


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: Testing Django App Running on Dev Server with Selenium

2007-03-11 Thread Paul Childs

Thanks for the suggestion Grig.
I'll give it a shot on Monday.
/Paul

On 3/10/07, Grig <[EMAIL PROTECTED]> wrote:
>
> Paul -- have you tried running the Selenium RC server non-
> interactively, then interacting with it via one of the languages it
> supports? Python for example, since you're doing Django development.
> Look in the python sub-directory of the selenium-rc distribution, and
> modify the test_google.py script so that it goes to your Django site.
>
> It might be easier if you run the Selenium RC server on a different
> box than your Django server, because SelRC uses a proxy to get around
> the Javascript security issues. The proxy might interfere with your
> Django server running on port 8000.
>
> Grig

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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 Automatic Page Refreshing

2007-03-11 Thread baasbartels

Not Django related, but well ... there you go

The short answer is: don't.

The longer answer is: Your room only holds 200 people, so at some
point someone will be out of luck. You just need to make sure that if
someone starts a serious attempt to book a seat (as opposed to just
browsing around), that he can complete the process in the assurance
that he'll get a seat/the number of seats he want. Therefor have a
'check for availability' step early (first?) in the booking process
and make a temporary reservation for that person for say 5-10 minutes
so that he can complete the booking process. Make sure to inform the
user of the duration of this temp reservation.

Rgds,
Jeroen

On Mar 11, 2:12 pm, "johnny" <[EMAIL PROTECTED]> wrote:
> I have an online seminar booking application.  What I want to know is,
> if 100 people are currently
> viewing a room that holds max 200 people, and one person out of 100
> books the seat in the room, how do
> I refresh all the 100 pages so that they all have an updated version?
>
> Thank you.


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



Re: newforms, choices and models

2007-03-11 Thread Horst Gutmann

enquest schrieb:
> 
> Second question: how can you add a password field from the newforms. you
> can't define ("correct me if I'm wrong") a password field in the
> model... And I don't see any option to give a field a password field.
> 
> How can I do this?
> 
> Thanxs
> 

I haven't really tried it so this is probably just a wild guess, but the
form_for_model function has a formfield callback function that will be
executed on each field in your model and returns a new instance of the
FormField to be used for the respective field.

If you then instantiate your password field to use a CharField that uses
the PasswordInput widget I think it should work :-) (But again: Wild
guess ;-) )

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



newforms, choices and models

2007-03-11 Thread enquest

I'm using/learning the newforms... I got a model, in this model I have a
choices list ( ('1', 'foo'), ('2', 'bar' ) that are reprensented as
select box in the admin... 
However when I import this class to the newforms
"forms.form_for_model(Gadget)" the choices arn't coming along and the
field is reprented as a normal textfield... How come?

Second question: how can you add a password field from the newforms. you
can't define ("correct me if I'm wrong") a password field in the
model... And I don't see any option to give a field a password field.

How can I do this?

Thanxs


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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 Automatic Page Refreshing

2007-03-11 Thread johnny

I have an online seminar booking application.  What I want to know is,
if 100 people are currently
viewing a room that holds max 200 people, and one person out of 100
books the seat in the room, how do
I refresh all the 100 pages so that they all have an updated version?

Thank you.


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



javascript issue

2007-03-11 Thread Mary

I am implementing a website with Djnago and i have been facing certain
issue with a javascript
i don't know if this is the right place for the post or no but if any
one can help it would be great

The problem is that when i make the path of the images :/media/images/
the image The script doesn't work but when i change it to media/images/
the image The script works fine

But i can't do make the path media/images/the image as django will not
find the image by this way so does anyone has as idea how can i make
the path of the images media/images and Django can translate it to the
right media path

here is my javascipt:





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: ForeignKey fields in list_display

2007-03-11 Thread Gilhad

On Sunday 11 March 2007 10:19, Laurie wrote:
> > > When I go to the admin page that lists all Test objects, Django hangs.
> > > If I remove 'owner', from the list_display tuple, it works as
> > > expected.
> > >
> > > Is this something that's not supported, or am I doing something
> > > silly? :-)

I got some strange error, but I do not remebmber where and from what. But this 
looks like it could be the same problem (or not).

The solution was to add to the related object (User) the method 
def __str__(self):
so the problem disapeared ... maybe you can just try it ...

-- 
Zdravi
 Gilhad
 [EMAIL PROTECTED]

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



Template Problem

2007-03-11 Thread samira

Hi every Body, can any body help me? I want to have two folders for my
templates. One it for general template and other for template related
to member for example. How I can extend from general folder in
member ?
Regards
Samira


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: myghtyboard forum problem

2007-03-11 Thread zehi

Thank you Baxter,

but could you specific as typing exact place (or in the particular
sample) where to modify it? ...

I know, it is quite dole from me, but I really want to avoid other
mistake.

I am guessing like this:

The current:
forum_topicsint44   Yes Change  Drop
Index   Unique

should it goes to this?:

forum_topicsint40   Yes Change  Drop
Index   Unique

Thanks.


On Mar 9, 10:52 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Exactly... even though your formatting got lost, you see where forum-
> topics has no default value? That's your problem. Modify that field
> that 0 is the default value.
>
> I still don't know why it happened, though.
>
> On Mar 9, 3:41 pm, "Richard Zehnal" <[EMAIL PROTECTED]> wrote:
>
> > This is view from my database table:
>
> >  Database zehi - Table myghtyboard_forum
> > Field   TypeLength  Not NullDefault Action
> > id  int44   Yes 
> > nextval('myghtyboard_forum_id_seq'::regclass)
> > Change  DropIndex   Unique
> > forum_category_id   int44   Yes Change  Drop
> > Index   Unique
> > forum_name  varchar 255 Yes Change  Drop
> > Index   Unique
> > forum_description   varchar 255 Yes Change  
> > DropIndex   Unique
> > forum_topicsint44   Yes Change  DropIndex   
> > Unique
> > forum_posts int44   Yes Change  DropIndex   
> > Unique
> > forum_lastpost  varchar 255 No  Change  
> > DropIndex   Unique
> > forum_order int22   Yes Change  DropIndex   
> > Unique
>
> > Keyname Unique  Primary Field   Action
> > myghtyboard_forum_forum_category_id No  No  forum_category_id   
> > Drop
> > myghtyboard_forum_pkey  Yes Yes id  Drop


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: search_fields: search is unrestricted

2007-03-11 Thread James Bennett

On 3/11/07, Laurie <[EMAIL PROTECTED]> wrote:
> Ah, that might help if I can figure out where to call it from... Is
> the list preserved across requests? Could I implement a view that I
> could hit whenever I need to check 'what just happened to the
> database'?

The query list only lives as long as the database connection, and
Django doesn't persist connections. If you just want to see what's
happening on the current request, the 'debug' context processor[1]
will make the information available to templates as a 'sql_queries'
variable, so you could drop something into the admin change list
template which, say, prints out 'sql_queries' inside an HTML comment.

Another option, if you want to log them over time, would be to create
a middleware class with a 'process_response' method -- it will be
called after each view has returned a response, and you could import
the DB connection there and write out the queries to a file.

[1] 
http://www.djangoproject.com/documentation/templates_python/#django-core-context-processors-debug


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

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



Re: How to define non-persisted attributes in Model

2007-03-11 Thread Horst Gutmann

Do you really need a CharField here or would a simply string variable be
enough? So you could simply do something like

  class Message(models.Model):
 description = models.CharField(maxlength=200)
 author = models.ForeignKey(User)
 temp = ""

and it should never get stored in the database as far as I know... Or do
you need to have a CharField for a specific reason?

anders conbere schrieb:
> well like I said you can either make that particular field not a model
> object, or you could just add the attributes at run time.  I'm not
> familiar with using the json serializer so I'm not sure about the
> specifics there, but for simply adding attributes to the model that
> wouldn't be saved to the db, both of those options are viable.
> 
> ~ Anders
> 
> On 3/10/07, Kenny Lee <[EMAIL PROTECTED]> wrote:
>> I need a model as i will need to save to the database. Just that i need to
>> serialize the object to send it to json, and it will be helpful to have some
>> custom attributes for temporary processing, but will not be saved to the db.
>>
>>
>>
>> On 3/10/07, anders conbere <[EMAIL PROTECTED]> wrote:
>>> I would just not make it a model.* since you don't want that value to
>>> be part of the Database, just don't use the ORM for it.
>>>
>>> ~ Anders
>>>
>>> On 3/10/07, shevken <[EMAIL PROTECTED]> wrote:
 class Message(models.Model):
 description = models.CharField(maxlength=200)
 author = models.ForeignKey(User)
 temp = models.CharField(maxlength=100)


 When i syncdb, i do not want the column temp to be created. Is there
 any arguments i can pass to enable this?

 Eg.

 temp = models.CharField(maxlength=100, persist=False)



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: search_fields: search is unrestricted

2007-03-11 Thread Laurie

On Mar 11, 4:33 am, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On 3/11/07, Laurie <[EMAIL PROTECTED]> wrote:
>
> > I don't think there's any way to get Django to log the SQL it's
> > executing, so I don't know if it's issuing any 'WHERE x ILIKE y' type
> > clauses, but functionally I'm not getting search filtering.
>
> When the DEBUG setting is True, Django keeps a list of all the queries
> it's executed; you can see them by doing
>
> from django.db import connection
> print connection.queries

Ah, that might help if I can figure out where to call it from... Is
the list preserved across requests? Could I implement a view that I
could hit whenever I need to check 'what just happened to the
database'?

> For searching in the admin, the default is to use the 'contains'
> keyword filter on the QuerySet, which translates to 'LIKE %term%' in
> the SQL. You can alter this behavior by adding operators to your
> search terms:
>
> ^ at the start of a term turns it into a 'startswith' filter ('LIKE term%')
> @ will cause it to use a full-text index search (currently only
> supported on MySQL)
> = before a term makes it look for an exact match.

Yup, I tried a regular constraint and an ^constraint. In both cases,
the result of a search is all items; no filtering/restriction of the
view happens. If I can figure out where to put the 'print
connection.queries' statement, I'll see whether the admin UI is
actually the search criteria to its queries.

L.


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



Re: ForeignKey fields in list_display

2007-03-11 Thread Laurie

On Mar 11, 4:22 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sun, 2007-03-11 at 00:06 -0800, Laurie wrote:
> > If I include a field which is a foreign key in my list_display admin
> > option, Django hangs. When using 'manage.py runserver' I'm unable to
> > get any further response from the app once this happens.
>
> > Here's an example:
>
> > class Test(models.Model):
> > name = models.CharField(maxlength=100)
> > owner = models.ForeignKey(User)
>
> > class Admin:
> > list_display = ('name', 'owner',)
>
> > When I go to the admin page that lists all Test objects, Django hangs.
> > If I remove 'owner', from the list_display tuple, it works as
> > expected.
>
> > Is this something that's not supported, or am I doing something
> > silly? :-)
>
> > I'm running the code from trunk (latest as of 5 minutes ago)
>
> This should definitely work (and does for me when I tested it just now).
>
> Are you testing this against a full-blown webserver (Apache,
> lighttpd, ...) or against Django's development server? In the latter
> case, is anything displayed in the terminal window where you're running
> the dev server?
>
> Could you post the fulls models.py file that is causing the problems? If
> I take your above model and add only
>
> from django.db import models
> from django.contrib.models import User
>
> and put it in an models.py in an application, it works fine. So I'm
> wondering what you have done differently.
>
> In short, any extra information you can provide will be helpful here.

Hmm, I tried a super-simple test case and it worked for me too. I'll
have to dig a but further to figure out what's causing the problem in
my main project.

L.


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



Re: trying to make select_related() work

2007-03-11 Thread Atilla

On 09/03/07, akonsu <[EMAIL PROTECTED]> wrote:
>
> thanks for your response.
>
> well, i am trying to get a list of dependents of a given object in a
> single query. i want to be able to retrieve the dependents by key (the
> object name) from this list.
>
> i do not see any way of doing this but getting the query set and
> converting it to a dictionary manually:
>
> d = dict()
> for x in AB.objects.select_related().filter(aa__name = 'aa')  :
> y = x.bb
> d[y.name] = y
>
> i was trying to avoid this extra list traversal...
>
> konstantin

I'm still a little bit confused, but here's what I'd suggest:

In the model you've described you can say something like:
BB.objects.filter(ab__aa__name="aa") to get the list of BB objects
that are mapped to that specific AA object.

In addition - if you don't have other fields in the AB model,
substitute that with a M2M field in one of the AA or BB models.  It
will allow you to use the full M2M relationship syntax in your
QuerySets.

Finally - those model names are giving us headaches. Sometimes it
helps a lof if you ask your questions in the context of your system
and people might have more clues and ideas for you.

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



Re: search_fields: search is unrestricted

2007-03-11 Thread James Bennett

On 3/11/07, Laurie <[EMAIL PROTECTED]> wrote:
> I don't think there's any way to get Django to log the SQL it's
> executing, so I don't know if it's issuing any 'WHERE x ILIKE y' type
> clauses, but functionally I'm not getting search filtering.

When the DEBUG setting is True, Django keeps a list of all the queries
it's executed; you can see them by doing

from django.db import connection
print connection.queries

For searching in the admin, the default is to use the 'contains'
keyword filter on the QuerySet, which translates to 'LIKE %term%' in
the SQL. You can alter this behavior by adding operators to your
search terms:

^ at the start of a term turns it into a 'startswith' filter ('LIKE term%')
@ will cause it to use a full-text index search (currently only
supported on MySQL)
= before a term makes it look for an exact match.


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

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



Re: ForeignKey fields in list_display

2007-03-11 Thread Malcolm Tredinnick

On Sun, 2007-03-11 at 00:06 -0800, Laurie wrote:
> If I include a field which is a foreign key in my list_display admin
> option, Django hangs. When using 'manage.py runserver' I'm unable to
> get any further response from the app once this happens.
> 
> Here's an example:
> 
> class Test(models.Model):
> name = models.CharField(maxlength=100)
> owner = models.ForeignKey(User)
> 
> class Admin:
> list_display = ('name', 'owner',)
> 
> When I go to the admin page that lists all Test objects, Django hangs.
> If I remove 'owner', from the list_display tuple, it works as
> expected.
> 
> Is this something that's not supported, or am I doing something
> silly? :-)
> 
> I'm running the code from trunk (latest as of 5 minutes ago)

This should definitely work (and does for me when I tested it just now).

Are you testing this against a full-blown webserver (Apache,
lighttpd, ...) or against Django's development server? In the latter
case, is anything displayed in the terminal window where you're running
the dev server?

Could you post the fulls models.py file that is causing the problems? If
I take your above model and add only

from django.db import models
from django.contrib.models import User

and put it in an models.py in an application, it works fine. So I'm
wondering what you have done differently.

In short, any extra information you can provide will be helpful here.

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



search_fields: search is unrestricted

2007-03-11 Thread Laurie

If I set the Admin option 'search_fields' the admin interface gives me
a search field, but when I use it, I always get all objects. The
search criteria don't seem to be applied.

I don't think there's any way to get Django to log the SQL it's
executing, so I don't know if it's issuing any 'WHERE x ILIKE y' type
clauses, but functionally I'm not getting search filtering.

Again, using up-to-date Django trunk.

L.


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



Re: 'table per sub-class' mapping strategy

2007-03-11 Thread Malcolm Tredinnick

On Sun, 2007-03-11 at 04:46 +, Laurie wrote:
[...]
> I'm
> having some trouble using the relationship. Using the example models
> from the 'One-to-one relationships' page:
> 
> p = Place(name="p1",address="...")
> r = Restaurant(place=p,serves_hot_dogs=True,serves_pizza=True)r.place
> Traceback (most recent call last):
>   File "", line 1, in ?
>   File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
> python2.3/site-packages/django/db/models/fields/related.py", line 165,
> in __get__
> raise self.field.rel.to.DoesNotExist
> DoesNotExist
> r.nameTraceback (most recent call last):
>   File "", line 1, in ?
> AttributeError: 'Restaurant' object has no attribute 'name'
> 
> It seems I can't access the 'parent type' instance/properties. If I
> insert
> a p.save() before constructing r, I can dereference p.place, but the
> Restaurant instance still doesn't have the fields from Place.

I think you are misunderstanding how OneToOne works: it is an explicit
join field between the tables, not an implicit (transparent) one. So in
order to access the fields of Place from a Restaurant class, you will
always need to use queries like

r.place.name

and so on. OneToOneField is not model inheritance. It provides similar
functionality in terms of linking models together, but the access
pattern is a little more cumbersome, which is why we are also
implementing more transparent model inheritance.

> Is the model inheritance implementation far enough along I could
> grab it off a branch somewhere and fill in the

Not at the moment, no. Sorry. We're leading up to 0.96 at the moment and
I'm putting all my free time into that.

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



ForeignKey fields in list_display

2007-03-11 Thread Laurie

If I include a field which is a foreign key in my list_display admin
option, Django hangs. When using 'manage.py runserver' I'm unable to
get any further response from the app once this happens.

Here's an example:

class Test(models.Model):
name = models.CharField(maxlength=100)
owner = models.ForeignKey(User)

class Admin:
list_display = ('name', 'owner',)

When I go to the admin page that lists all Test objects, Django hangs.
If I remove 'owner', from the list_display tuple, it works as
expected.

Is this something that's not supported, or am I doing something
silly? :-)

I'm running the code from trunk (latest as of 5 minutes ago)

Thanks,

L.


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