Re: Not querying related record on form creation

2007-02-04 Thread Ivan Sagalaev

Adrian Holovaty wrote:
> The first option sounds better to me, too. Are you willing to code up a patch?

OK. I'll post a follow-up here with the ticket number in a day or two.

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



Re: Some ideas for Django ;)

2007-02-04 Thread [EMAIL PROTECTED]



On Feb 5, 5:37 pm, Ivan Sagalaev <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > 2a. WSGI support / compatibility -> so WSGI middleware and WSGI apps
> > could be integrated with the framework (for example AuthKit with
> > openID, pocoo)
>
> Django is WSGI compliant. You can use WSGI middlewares right now.
> Seriously, Django has a WSGI handler
> (django.core.handlers.wsgi.WSGIHandler), what else is needed?

Sorry, but it could be argued that Django is not truly WSGI compliant.
A WSGI compliant application should be able to accept all
configuration information or at least a pointer to where to find it,
through the environ passed to the application by the upstream WSGI
component or server adapter.

I believe this is not the case with Django however as it requires
certain settings be put into os.environ. The most glaring problem this
causes is that you cannot run two instances of Django within the same
Python interpreter below some third party URL mapping system. If it
was a true plug and play WSGI component you would be able to do this.
If I am wrong I would love to know how you do it as I haven't stumbled
across it yet in my quick looks at Django.

This is why when using mod_python one is forced to separate the two
Django instances using PythonInterpreter directive, or by running them
under separate VirtualHost, which is the default separation context
for interpreters in mod_python.

This is one thing that really needs to be addressed for WSGI
compliance else it isn't plug and play and you still have to create a
special WSGI middleware adapter to interface to Django even though it
is supposed to be WSGI compliant.

Graham


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



Re: Some ideas for Django ;)

2007-02-04 Thread Ivan Sagalaev

[EMAIL PROTECTED] wrote:
> 1. Full if support - if/elif/else with python access - It could be
> done in the view but making a loop in view and second one in template
> isn't a nice solution.

I bet you can find such or similar discussion in the archives of this 
list or django-users. In short -- not supporting programming logic in 
templates is by design. Honestly I'm yet to see a use case for 'if-elif' 
that shouldn't be implemented instead as a tag or a filter.

> 2a. WSGI support / compatibility -> so WSGI middleware and WSGI apps
> could be integrated with the framework (for example AuthKit with
> openID, pocoo)

Django is WSGI compliant. You can use WSGI middlewares right now. 
Seriously, Django has a WSGI handler 
(django.core.handlers.wsgi.WSGIHandler), what else is needed?

> 3. default folder for user libraries that will work without any
> configuration (just copy to /lib and import is possible).

Django doesn't require any project folder structure (beside 'models.py' 
location). You can place your libs wherever you want and import them. 
The only 'configuraion' that is needed is for Python itself to know this 
location.

> 3.a  is all that config with media files is required/needed ? In
> Pylons there is APP/public and it just works on the dev server and on
> others without configuration.

'All config with media files' is just two clear settings that are used 
as a common convention for storing and retrieving media files.

But if you mean the idea of not serving media off the framework then 
this is, again, a strong design decision. I believe it is right because 
unless it would be that painful to serve media off Django people would 
actually *do* this. In production. Ignoring all the warnings because it 
'just works'... Of course until first ten real users come to site.

> 9. Djangoforge was a nice idea... why it's so slowly developed ?
> Nobody wants it ?

I believe there is no time for this now. Pre 1.0 Django is indeed quite 
API-unstable so many projects would need a constant updating and 
maintaining. My guess is that all this will start after 1.0.

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



Re: Some ideas for Django ;)

2007-02-04 Thread James Bennett

On 2/4/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> 1. Full if support - if/elif/else with python access - It could be
> done in the view but making a loop in view and second one in template
> isn't a nice solution.

As far as I know, support for arbitrary Python expressions in
templates (which would be required for this to work) isn't going to
happen.

> 2. Support for things like http://www.toscawidgets.org/index.html
> http://pylonshq.com/WebHelpers/ - either by integration of existing
> projects or by creating a system for helpers and widgets. Something
> more than template filters and tags.

For the record, I'm -infinity on such a thing, but everybody knows
that already :)

> 2a. WSGI support / compatibility -> so WSGI middleware and WSGI apps
> could be integrated with the framework (for example AuthKit with
> openID, pocoo)

As far as I know, it's a matter of someone stepping up and writing
code. WSGI's status in Django is, IMHO, mostly a function of
historical accident; mod_python was mature and stable, and so Django
grew up on it and only got WSGI later.

> 3. default folder for user libraries that will work without any
> configuration (just copy to /lib and import is possible).

It'd be at best a minor convenience, but it'd also move us further
away from being a Python web framework, because we'd essentially be
hacking around Python's import rules to get different behavior. I'm -0
on this.

> 3.a  is all that config with media files is required/needed ? In
> Pylons there is APP/public and it just works on the dev server and on
> others without configuration.

Under several server setups, yes it is needed. I'm not sure what the
best development solution is for this, since adding real static file
support to the dev server would probably mean a large increase in the
complexity of configuring it.

> 9. Djangoforge was a nice idea... why it's so slowly developed ?
> Nobody wants it ?

My personal guess, based on various bits of information, is that there
are two things happening:

1. A lot of Django development goes on behind corporate doors where
the code will never be publicly released.
2. A lot of people who aren't in such situations spend more time
sitting around saying, "I wish somebody would write an application for
this" instead of getting together with like-minded developers and
writing it.

The second bit isn't intended to be a knock on anyone, just a
statement of what I see happen a *lot* on IRC. The Satchmo folks are
the only ones I know of who've gone beyond the "I wish..." stage and
moved into actually developing the application they want; more people
should do that :)

> 10. pay more attention to Google Summer of code projects. Last
> projects are still far from being merged and for some of them even
> finished... Fulltext search is nice feature but now it's just a wish.

This has come up time and again, and it's been reiterated that a lot
of things are really waiting on motivated people to step up with
testing and improvements. If you're pining for a particular feature
from an SoC project, get involved; we've said over and over and over
again that if someone wants to help bring an SoC feature closer to
completion, we'll give them all the infrastructure help they need to
hack on it. Look at the Oracle branch for a good example: a group of
people really wanted Oracle support and that they'd work it out, so
they got a branch and an official code sprint with a core dev on-site
and everything. Imagine what you can do :)

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

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



Re: Some ideas for Django ;)

2007-02-04 Thread limodou

On 2/5/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I''ve been using Django some time, I've also looked on Pylons and it's
> friends :) Django is a nice framework but there are few things I would
> want to see in the framework
>
> 1. Full if support - if/elif/else with python access - It could be
> done in the view but making a loop in view and second one in template
> isn't a nice solution.

I'v also implement a custom tag pyif,

http://code.djangoproject.com/wiki/PyifTag

And I'v also submit a patch about 'else' support in django template #3090
http://code.djangoproject.com/ticket/3090

+1

>
> 2. Support for things like http://www.toscawidgets.org/index.html
> http://pylonshq.com/WebHelpers/ - either by integration of existing
> projects or by creating a system for helpers and widgets. Something
> more than template filters and tags.

I think write js code in hand is some so hard, and it's funny. I like
jquery. And there are many ajax frameworks, so which one should be
support, it's a big problem.

-0

>
> 2a. WSGI support / compatibility -> so WSGI middleware and WSGI apps
> could be integrated with the framework (for example AuthKit with
> openID, pocoo)

Good idea. +1

>
> 3. default folder for user libraries that will work without any
> configuration (just copy to /lib and import is possible).
> 3.a  is all that config with media files is required/needed ? In
> Pylons there is APP/public and it just works on the dev server and on
> others without configuration.
>
I don't understand so much what you want. But if we can introduce app
installation mechanism like turbogears, because install an app, except
isntall the source code, we also need to copy static files, such as:
js, css, images, html, etc. All these things need to do by hands for
now.

>
> 9. Djangoforge was a nice idea... why it's so slowly developed ?
> Nobody wants it ?

I want, and I'v already proposal this before. +1

> 10. pay more attention to Google Summer of code projects. Last
> projects are still far from being merged and for some of them even
> finished... Fulltext search is nice feature but now it's just a wish.
>
+1

-- 
I like python!
UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad
My Blog: http://www.donews.net/limodou

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



Some ideas for Django ;)

2007-02-04 Thread [EMAIL PROTECTED]

I''ve been using Django some time, I've also looked on Pylons and it's
friends :) Django is a nice framework but there are few things I would
want to see in the framework

1. Full if support - if/elif/else with python access - It could be
done in the view but making a loop in view and second one in template
isn't a nice solution.

2. Support for things like http://www.toscawidgets.org/index.html
http://pylonshq.com/WebHelpers/ - either by integration of existing
projects or by creating a system for helpers and widgets. Something
more than template filters and tags.

2a. WSGI support / compatibility -> so WSGI middleware and WSGI apps
could be integrated with the framework (for example AuthKit with
openID, pocoo)

3. default folder for user libraries that will work without any
configuration (just copy to /lib and import is possible).
3.a  is all that config with media files is required/needed ? In
Pylons there is APP/public and it just works on the dev server and on
others without configuration.


9. Djangoforge was a nice idea... why it's so slowly developed ?
Nobody wants it ?
10. pay more attention to Google Summer of code projects. Last
projects are still far from being merged and for some of them even
finished... Fulltext search is nice feature but now it's just a wish.


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



Re: Django ORM

2007-02-04 Thread tsuyuki makoto

Hi all.

I agree with Benjamin completely.
I hate Identity Map and synchronization approach.
They break database logic like trigger or view.

2007/2/5, Benjamin Slavin <[EMAIL PROTECTED]>:
>
> I've also given this some consideration -- I haven't found any
> information on this either.
>
> It would be nice if the DB API could make use of the cache system
> (memcached) if you attempt the lookup by ID.  Synchronization becomes
> more of a problem... and it certainly removes transactional safety
> from the system if implemented improperly.
>
> Anyone have any experience with this sort of setup under Django?
>
>  - Ben
>
>
> On 2/2/07, Sergey Kirillov <[EMAIL PROTECTED]> wrote:
> >
> > Greetings,
> >
> > I'd like to ask, why Django ORM has no concept of Identity Map? It is
> > strange for me that if I call get() five times I will get five object
> > instances, instead of five references to a single instance.
> >
> > Was it a design decision? I'm unable to find any discussions of this.
> > Or I'm the first one who asks about this?
> >
> >
> > >
> >
>
> >
>

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



# 2070 cleanup and review

2007-02-04 Thread [EMAIL PROTECTED]

Remove all files up to 3581-
streaming_uploads_and_uploadprogress_middleware_x_progress_id.diff

and theese

4065-
streaming_uploads_and_uploadprogress_middleware_x_progress_id_windowsfix.diff
upload.py
middleware.py
using-feedparser.diff
using-feedparser.2.diff
modpyton-ok-needs-fcgi-testing.diff
modpyton-ok-needs-fcgi-testing.2.diff

Remove comments up to 01/25/07

Also need a review to see if my code is acceptable or just a mess :)


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



Re: filesizeformat filter

2007-02-04 Thread vfoley

It was in my my unit tests, instead of properly upload a file, I just
set the name to "whatever.pdf", but when I loaded the detail page,
Python couldn't find the file, so it raised an OSError.  I don't think
I can qualify that as a bug.

On Feb 3, 4:52 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> That does sound like a bug to me, can you file a ticket with an
> example of where it's going wrong (i.e. what value you're giving it?)
>
> Cheers,
> Simon G.
>
> On Feb 2, 6:43 am, "vfoley" <[EMAIL PROTECTED]> wrote:
>
> > I just saw that filesizeformat expects a number bytes.  So the culprit
> > in my case would be get_file_size.  Not sure if this one should fail
> > silently...
>
> > On Feb 1, 12:39 pm, "vfoley" <[EMAIL PROTECTED]> wrote:
>
> > > According to the Django template documentation for developpers 
> > > (http://www.djangoproject.com/documentation/templates_python/#writing-..),
> > > a filter shouldn't raise an exception, it should silently ignore
> > > errors.
>
> > > The filesizeformat filter raises an exception for an inexistant file.
> > > Should this be fixed?


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



Re: Django ORM

2007-02-04 Thread Benjamin Slavin

I've also given this some consideration -- I haven't found any
information on this either.

It would be nice if the DB API could make use of the cache system
(memcached) if you attempt the lookup by ID.  Synchronization becomes
more of a problem... and it certainly removes transactional safety
from the system if implemented improperly.

Anyone have any experience with this sort of setup under Django?

 - Ben


On 2/2/07, Sergey Kirillov <[EMAIL PROTECTED]> wrote:
>
> Greetings,
>
> I'd like to ask, why Django ORM has no concept of Identity Map? It is
> strange for me that if I call get() five times I will get five object
> instances, instead of five references to a single instance.
>
> Was it a design decision? I'm unable to find any discussions of this.
> Or I'm the first one who asks about this?
>
>
> >
>

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



Re: Not querying related record on form creation

2007-02-04 Thread Adrian Holovaty

On 2/3/07, Ivan Sagalaev <[EMAIL PROTECTED]> wrote:
> I have a better proposal. We can just defer getting 'choices' for
>  until 'render' is called. Thus if the field is never displayed
> in template it won't hit database. I'm not sure how to do it properly
> though... I see two ways now:
>
> - Turn Field.get_choices into a generator. It now actually fetches rows
> and wraps them into a list and adds a 'blank' choice.
> - Allow a callable in 'choices' param of a Select widget that will be
> called on 'render'. It then can be passed as lambda calling form's choices.
>
> I better like first option. What do you think?

The first option sounds better to me, too. Are you willing to code up a patch?

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com

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



Django ORM

2007-02-04 Thread Sergey Kirillov

Greetings,

I'd like to ask, why Django ORM has no concept of Identity Map? It is
strange for me that if I call get() five times I will get five object
instances, instead of five references to a single instance.

Was it a design decision? I'm unable to find any discussions of this.
Or I'm the first one who asks about this?


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



Display field name of a related object

2007-02-04 Thread mykdzn

I need to return a queryset, to be serialized for ajax. I have a Store
object, which references a State object.

State.objects.all() currently returns the state value as the ID field
for the State object. But I need it to instead return the  l_state

Any insight?

Thanks

Mike


See below:
=

class Store(models.Model):
  name = models.CharField(maxlength=100)
  url = models.URLField(null=True,blank=True)
  addr1 = models.CharField(maxlength=100,null=True,blank=True)
  addr2 = models.CharField(maxlength=100,null=True,blank=True)
  state = models.ForeignKey(State)
  zip_code = models.CharField(maxlength=10,null=True,blank=True)
  city = models.CharField(maxlength=100,null=True,blank=True)
  phone = models.PhoneNumberField(null=True,blank=True)

  def __str__(self):
  return "%s" % (self.name)


class State(models.Model):
  country = models.ForeignKey(Country)
  l_state = models.TextField()
  s_state = models.TextField()

  def __str__(self):
  return "%s" % (self.l_state)


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



Re: Using javascript to edit_in_line on django admin

2007-02-04 Thread Gary Wilson

On Feb 3, 5:04 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Filtering with javascript isn't too much needed, but the edit_inline
> with javascript is a cool thing I want to see in django that doesn't
> break backward compatibility.  As I said, I can make this improvement
> on the django admin and send a patch (I think :D) but it seems to me
> that the admin is being rewritten with newforms, is it true?

Yes, the admin interface is being updated to use newforms in the
newforms-admin branch:
http://code.djangoproject.com/browser/django/branches/newforms-admin

> What do you think about this?

I think it would be a cool addition.  Patches are always welcome.  Be
sure to create a ticket:
http://code.djangoproject.com/simpleticket


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



newforms form_for_model documentation

2007-02-04 Thread philipp . keller

Hi there

The newforms documentation still lacks a paragraph about converting model to 
forms and posted form data back to models/db.

There are some tickets (3247, 3257) waiting for this documentation bit to be 
written so they can submit a documentation path and become part of the svn 
trunk.
Is this part of newforms considered stable and should/could someone write the 
documentation for it? Should I post a ticket?

I wrote a tutorial about the model2form convertion part [1]. This tutorial 
probably can serve as a starting point for the documentation..

greets
Philipp

[1] http://code.pui.ch/2007/01/07/using-djangos-newforms/


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



Re: Not querying related record on form creation

2007-02-04 Thread Ivan Sagalaev

James Bennett wrote:
> One suggestion that I kind of like is the ability to pass a QuerySet
> to 'choices' and, in that case, have it generate the choices from,
> say, the id and __str__ of each object in the QuerySet.

Then you'll loose a 'blank' choice. Current Field.get_choices does a bit 
more than just iterating a queryset but as far as I can tell it can 
easily be made lazy by turning it into a generator: instead of 
concatenating two actual lists just yield them by items.


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



Re: unicode issues in multiple tickets (#952, #1356, #3370) and thread about Euro sign in django-users

2007-02-04 Thread Bjørn Stabell

On Feb 1, 4:16 pm, Michael Radziej <[EMAIL PROTECTED]> wrote:
> Ivan Sagalaev:
>
> > Michael Radziej wrote:
> >> d) make the database wrapper accept both unicode and bytestrings in
> >> the models, but always pass unicode strings to the database backend.

Sounds like a reasonable proposal.  You may even consider logging
deprectation messages in the case of bytestrings appearing in models
(but be careful not to create a flood of these).


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