Re: Edit inline problems

2007-07-04 Thread John Shaffer

On 6/28/07, Patrick Anderson <[EMAIL PROTECTED]> wrote:
> I validate the models and I can see the forms in the Admin, but every
> time I try to add a Person (while adding a new Personnel list or editing
> an existing one), none of the Persons get saved. What could be wrong with
> my model?

The problem is that you've set core=True on Person.personnel. Remove
that and your models should work fine. There's a ticket for this bug:
http://code.djangoproject.com/ticket/2724

--~--~-~--~~~---~--~~
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 custom manager methods

2007-07-04 Thread cesco

Hi,

I've created a MyManager class (extending models.Manager) to provide
some custom filtering methods, then in the related
MyModel(models.Model) class I put
objects=MyManager()
so I have the custom filtering methods available as
MyModel.objects.my_filter().
Now I'd like to be able to chain the custom filters in the way it's
currently possible for the default manager methods so that I could
call the custom filter methods I defined also on a queryset as
queryset.my_filter() and not only as MyModel.objects.my_filter().
Do you have any suggestion on how to accomplish that?

Thanks a lot
Francesco


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



ImageField upload_to Parameter Problem

2007-07-04 Thread lastmohican

Hello everybody,

I want to create a gallery app and I have a slight problem, my
models.py
code looks like this:

...
class Gallery(models.Model):
   slug = models.SlugField(...)
   ...

class Image(models.Model):
   ...
   gallery = models.ForeignKey(...)
   image = models.ImageField(
   upload_to=(lambda:'images/%s' % gallery.slug),
   ...,)
...

This won't work, because the ImageField constructor wants "upload_to"
to
be a String and no Funtion. The Problem is, I want a dynamic image
storage path, something like MEDIA_ROOT+"images/" wont work with
hundrets of galleries, I need something like MEDIA_ROOT
+"images/"+gallery.slug . In my Image class "gallery" is a ForeignKey,
which will have the attribute "slug" at runtime, but not at model
creation time, either I am doing something stupid or there is
currently
no way to solve this. Hopefully someone knows a solution.

Sascha Peilicke
--
http://saschashideout.de


--~--~-~--~~~---~--~~
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: MySQL Got packet bigger than 'max_allowed_packet'

2007-07-04 Thread [EMAIL PROTECTED]

Thanks Martn and Carl.

I would really like to avoid having to re design the architecture of
the application at this stage (its a case of the requirements changing
after roll out), althougth thanks for the comments re serving large
data volumes.
I have made the adjustments suggested in 
http://dev.mysql.com/doc/refman/4.1/en/packet-too-large.html
prior to making these loading the insert directly into  mysql failed,
afterwards it suceeded but the insert through django still fails hence
my question - Does django ignore the max_allowed_packet setting in
my.cnf?
if so how can it be increased so that django uses it?

Thanks again

Owen

On Jul 3, 6:21 pm, Martin Winkler <[EMAIL PROTECTED]> wrote:
> Am Tue, 3 Jul 2007 17:34:33 +0200
> schrieb Martin Winkler <[EMAIL PROTECTED]>:
>
> > If you have binary data, why don't you use FileField and ImageField?
> > That way you'd store the large data in the filesystem and only have a
> > reference to the file in the database.
>
> Maybe I should clarify the problems as far as I am aware of them:
>
> Whenever you work with the result of MyModel.objects.filter()
> or .all() or even .get(), django loads the complete record(s) including
> all fields into memory. So if you want to present just a list of titles
> of 20 of your records, all these 20 records will be loaded into memory -
> which might be a HUGE amount of data. (As long as you don't play around
> with specialized Q() objects, as far as I know)
>
> Furthermore Django is not really meant to serve huge amounts of (more
> or less) static data. That's what your webserver is for. Your webserver
> might be able to continue a download which stopped in the middle at
> the correct location etc.
>
> So for me it makes much more sense to store the binary data in the
> filesystem because it has much less overhead. The only disadvantage I
> can see here is that for backups you not only have to save your
> database, but also one directory (including subdirs) of your file
> system.
>
> Martin


--~--~-~--~~~---~--~~
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: Eclipse + PyDev + Aptana - Anybody??? Need some pointers

2007-07-04 Thread Tom Smith
As a word of encouragement, I'm using

Eclipse + Aptana + PyDev  (+ SubClipse)  fine... It was just a case  
of setting the right editors for the right file types... Can't  
remember exactly which Preference screen that is in... go digging  
you'll get there (I did)

You need to allter run args like this though (I use port 8771)... the  
noreload does the magic...
runserver 8771 --noreload

You will find though that running Django within Eclipse has the  
problem that it doesn't automatically reload when you make changes,  
so I only use PyDev to run my app when I have a very gnarly bug that  
I need to step through line at a time watching variables...

good luck

tom


-- Tom Smith   
---
[EMAIL PROTECTED]  http://everythingability.comhttp:// 
theotherblog.com
mobile: +44 (0)7720 288285  land: +44 (0)1904 870565 fax: +44 (0) 
871 661 3413
- usability, findability, profitability, remarkability  
--



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



global tags. tag not only for one app

2007-07-04 Thread sector119

Hi

Is it possible to create a global tag not only for one app? I use
paginator tag for my streets app, but I need to use it for other, like
people, organizations, ... How can I load and use paginator tag if I
have templatetags/paginator.py only in my streets application?


--~--~-~--~~~---~--~~
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: global tags. tag not only for one app

2007-07-04 Thread Malcolm Tredinnick

On Wed, 2007-07-04 at 09:16 +, sector119 wrote:
> Hi
> 
> Is it possible to create a global tag not only for one app? I use
> paginator tag for my streets app, but I need to use it for other, like
> people, organizations, ... How can I load and use paginator tag if I
> have templatetags/paginator.py only in my streets application?

When you use the {% load %} template tag, it looks in all your
/templatetag/ directories. After all, the template doesn't
know which app it belongs to -- it might not belong to any particular
app. So just load any tag from any application in your templates and it
will work.

Regards,
Malcolm

-- 
I don't have a solution, but I admire your problem. 
http://www.pointy-stick.com/blog/


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



Build the Community, Make More Money

2007-07-04 Thread hiruma222

Build the Community, Make More Money

I recently joined AGLOCO because of a friend recommended it to me. I
am now promoting it to you because I like the idea and I want you to
share in what I think will be an exciting new Internet concept.


AGLOCO's story is simple:


Do you realize how valuable you are? Advertisers, search providers and
online retailers are paying billions to reach you while you surf.  How
much of that money are you making? NONE!


AGLOCO thinks you deserve a piece of the action.


AGLOCO collects money from those companies on behalf of its members.
(For example, Google currently pays AOL 10 cents for every Google
search by an AOL user. And Google still has enough profit to pay $1.6
billion dollars for YouTube, an 18-month old site full of content that
YouTube's users did not get paid for!


AGLOCO will work to get its Members their share of this and more.


AGLOCO is building a new form of online community that they call an
Economic Network. They are not only paying Members their fair share,
but they're building a community that will generate the kind of
fortune that YouTube made. But instead of that wealth making only a
few people rich, the entire community will get its share.


What's the catch? No catch - no spyware, no pop-ups and no spam -
membership and software are free and AGLOCO is 100% member owned.
Privacy is a core value and AGLOCO never sells or rents member
information.


So do both of us a favor: Sign up for AGLOCO right now! If you use
this link to sign up, I automatically get credit for referring you and
helping to build AGLOCO. http://www.agloco.com/r/BBFT8024


Thanks


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



Admin module, user account editing and group assignment info

2007-07-04 Thread Angela Sutanto

Hi,


I'm learning Django and trying to use/customize Admin module but I cannot
find information about group(s) a user  is assigned to.

If I open page to edit user's account, at the bottom is multiselect
box containing all existing groups.

If I select one(s) and save user profile, in DB table
auth_user_grooups I see a correct links between auth_user and
auth_group table.

But I cannot find the same information in the GUI. I use development
version of Django a few days old.

Please, could you advice what I'm missing?

Thanks, Angela

--~--~-~--~~~---~--~~
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: Sybase support for Django

2007-07-04 Thread Nis Jørgensen

Russell Keith-Magee skrev:
> Ok. In which case, a Sybase backend will probably hit the same
> problems as the existing MS SQL backend. MS SQL doesn't contain
> support for LIMIT/OFFSET in queries, which Django uses these keywords
> to optimize the results obtained from large queries. (I think this
> problem has been fixed in SQL Server 2005, but don't quote me on that.
> I don't keep close tabs on MS SQL).
>   
Perhaps we (that is, the people who want MS-SQL support) could use the
technique described here:

http://josephlindsay.com/archives/2005/05/27/paging-results-in-ms-sql-server/

I do believe there might be a subtle problem in the case where the sort
key is not unique -  in that case, TOP X can return more than X records,
IIRC. We might have to add the primary key to the SORT BY as a last
resort when sorting by a non-unique field.

Nis


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



Admin module, editing user account + user profile in the same page

2007-07-04 Thread Angela Sutanto

Hi

once more question concerning Admin module customization: What is a
recommended way of customization to achieve a single page editor to
edit choosen fields from standard user accouny and fields from my user
profile?

Using parameter edit_iniline in OneToOne fields includes fields of my
profile into user's page editor, by how to hide some fields of user
account and how to make some boxes 'collapsable' (how to apply all
those customization features to standard model of user account)


Thanks, Angela

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



Sharing code between two projects

2007-07-04 Thread Eugene Morozov

Hello,
I have two projects, they were developed independently. They will be
run on the same server and have many things in common (notably some
models and templatetags).

While I can import models from another project if it is on PYTHONPATH,
I cannot find a way to share templatetags. I don't want to copy them,
because maintaining costs would become higher (need to remember to
apply bug fixes in both places, for example).

Is there a way to import templatetags from another project?

Django is really great framework, but I have a gut feeling that Django
support for code reuse is significantly worse, than, say, in Plone/
Zope 3. Though it might be because of my relative inexpirience in
Django.

I would be very grateful if someone will point me to pages/blog
entries about how to write Django apps with reusability in mind.
Eugene


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



summary field

2007-07-04 Thread vanderkerkoff

Quick question, I think I know the answer I just want someone to
confirm.

We've got alot of apps in our project that use generic views.  One of
which is a noticeboarad app.

I don't want to have a summary field in this app, but want to use
generic views, but want to use generic views in the other apps.

Is this possible/easy?

Or do I need write the noticeboard app not using generic views?


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



Re: summary field

2007-07-04 Thread vanderkerkoff

Ignore me

generic views have nothing to do with fields

my bad



On Jul 4, 12:34 pm, vanderkerkoff <[EMAIL PROTECTED]> wrote:
> Quick question, I think I know the answer I just want someone to
> confirm.
>
> We've got alot of apps in our project that use generic views.  One of
> which is a noticeboarad app.
>
> I don't want to have a summary field in this app, but want to use
> generic views, but want to use generic views in the other apps.
>
> Is this possible/easy?
>
> Or do I need write the noticeboard app not using generic views?


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



Re: Sharing code between two projects

2007-07-04 Thread Malcolm Tredinnick

On Wed, 2007-07-04 at 04:34 -0700, Eugene Morozov wrote:
> Hello,
> I have two projects, they were developed independently. They will be
> run on the same server and have many things in common (notably some
> models and templatetags).
> 
> While I can import models from another project if it is on PYTHONPATH,
> I cannot find a way to share templatetags. I don't want to copy them,
> because maintaining costs would become higher (need to remember to
> apply bug fixes in both places, for example).
> 
> Is there a way to import templatetags from another project?

Reuse is much easier once you think in terms of applications, rather
than projects. A project is just a collection of applications (really,
it's just a settings file and maybe a root URLConf). So you can easily
share an application in two projects, since applications can be imported
from anywhere on your Python path, as you've noted.

So, if you *only* want to share the template tags and nothing else from
their current application, make a new application that only contains
those template tags. Then you can install that application into both
projects (by including the import path in INSTALLED_APPS in each
project's settings file) and the code will be shared as you would
expect. As mentioned in a thread earlier today on this list, loading a
template tag in a template will cause all the installed apps to be
searched for that template tag file, so you don't need to worry about
keeping the tags right next to the templates they are used in.

> Django is really great framework, but I have a gut feeling that Django
> support for code reuse is significantly worse, than, say, in Plone/
> Zope 3. Though it might be because of my relative inexpirience in
> Django.

It's due to your inexperience, I suspect. Almost everything in Django
operates through normal Python imports, so you can share any code that
is on your Python path. The only real constraints are that template tags
are loaded from a directory called templatetags/ that must live in an
application directory and models must live in a module called "models".
Everything else is free-form and entirely under your control.

Regards,
Malcolm

-- 
Depression is merely anger without enthusiasm. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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: Ideas for performance improvement?

2007-07-04 Thread jj

On Jul 2, 8:00 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> Sorry, I meant how many HTTP requests *per page*, as in, how many
> external resource references?

- 13 unique external images
- 4 stylesheets (changelists.css from contrib/admin)

and I just noticed I create:
- 4000 HTML anchors

> Are you serving media off a separate server, or though apache?  If
> apache, are you using it's regular file service or running it through
> Django?

Through Apache's regular file service (as described in the tutorial).

> > 1, essentially: Book.objects.select_related(). Plus access to 5
> > foreign objects per book.
>
> with settings.DEBUG = True:
>
> from django.db import connection
> print connection.queries
>
> May give you a clue.

I've now instrumented as you suggest:
db.reset_queries()
book_list = list(Book.objects.select_related())
l0 = len(book_list)
l1 = len(db.connection.queries)
response = render_books(request, book_list, title='All books')
l2 = len(db.connection.queries) - l1
response.write('(%s, %s, %s)' %
(l0, l1, l2))
return response

and the amazing response is:
(l0: 225, l1: 1, l2: 2630)
!!!

I'm quite at lost here. What am I doing wrong?

> > book_list = cache.get('all_books')
> > if not book_list:
> > book_list = Book.objects.select_related()
> > cache.set('all_books', book_list)
>
> This doesn't actually cache the result set.  Querysets are lazy.
> If you want to cache the finished results, try this:
>
>  book_list = cache.get('all_books')
>  if not book_list:
>  book_list = list(Book.objects.select_related())

Thanks. I've now tried the above, no performance gain however. Could
this be related to the issue above?

>  cache.set('all_books', book_list)
>
> > book_list = [b for b in book_list if b.is_visible_by(user)]
>
>  Concur with Tim that this may be worth making a DB function and
> using extra() on.
>
> Depends which DB you're using, really?

Initially, sqlite3, but I've now switched to MySQL 5.

JJ.

On Jul 2, 8:00 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> On 7/2/07, jj <[EMAIL PROTECTED]> wrote:
>
> > > How many HTTP requests?
>
> > It's only me testing at the moment, and it's already slow enough.
>
> Sorry, I meant how many HTTP requests *per page*, as in, how many
> external resource references?
>
> Are you serving media off a separate server, or though apache?  If
> apache, are you using it's regular file service or running it through
> Django?
>
> > 1, essentially: Book.objects.select_related(). Plus access to 5
> > foreign objects per book.
>
> with settings.DEBUG = True:
>
> from django.db import connection
> print connection.queries
>
> May give you a clue.
>
> > book_list = cache.get('all_books')
> > if not book_list:
> > book_list = Book.objects.select_related()
> > cache.set('all_books', book_list)
>
> This doesn't actually cache the result set.  Querysets are lazy.
> If you want to cache the finished results, try this:
>
>  book_list = cache.get('all_books')
>  if not book_list:
>  book_list = list(Book.objects.select_related())
>  cache.set('all_books', book_list)
>
> > book_list = [b for b in book_list if b.is_visible_by(user)]
>
>  Concur with Tim that this may be worth making a DB function and
> using extra() on.


--~--~-~--~~~---~--~~
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: Sharing code between two projects

2007-07-04 Thread Ben Ford
Hi Eugene,
The way to do this is to make another project (just a module with an
__init__.py inside) and then have a templatetags module inside that... Your
directory structure looks like this:
top_module/
  -> __init__.py
  -> templatetags/
 -> __init__.py
 -> some_file.py

Put all of your templatetags in some_file.py and include top_module in your
installed apps. In your templates you just
{% load some_file %}
AFAIK that's all you need.
Cheers
Ben

On 04/07/07, Eugene Morozov <[EMAIL PROTECTED]> wrote:
>
>
> Hello,
> I have two projects, they were developed independently. They will be
> run on the same server and have many things in common (notably some
> models and templatetags).
>
> While I can import models from another project if it is on PYTHONPATH,
> I cannot find a way to share templatetags. I don't want to copy them,
> because maintaining costs would become higher (need to remember to
> apply bug fixes in both places, for example).
>
> Is there a way to import templatetags from another project?
>
> Django is really great framework, but I have a gut feeling that Django
> support for code reuse is significantly worse, than, say, in Plone/
> Zope 3. Though it might be because of my relative inexpirience in
> Django.
>
> I would be very grateful if someone will point me to pages/blog
> entries about how to write Django apps with reusability in mind.
> Eugene
>
>
> >
>


-- 
Regards,
Ben Ford
[EMAIL PROTECTED]
+628111880346

--~--~-~--~~~---~--~~
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: Sharing code between two projects

2007-07-04 Thread Eugene Morozov

Hello,
Thank you, must have thought about it... Probably need some rest, now
it seems so obvious a solution.
Eugene

On 4 июл, 15:56, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> On Wed, 2007-07-04 at 04:34 -0700, Eugene Morozov wrote:
> > Hello,
> > I have two projects, they were developed independently. They will be
> > run on the same server and have many things in common (notably some
> > models and templatetags).
>
> > While I can import models from another project if it is on PYTHONPATH,
> > I cannot find a way to share templatetags. I don't want to copy them,
> > because maintaining costs would become higher (need to remember to
> > apply bug fixes in both places, for example).
>
> > Is there a way to import templatetags from another project?
>
> Reuse is much easier once you think in terms of applications, rather
> than projects. A project is just a collection of applications (really,
> it's just a settings file and maybe a root URLConf). So you can easily
> share an application in two projects, since applications can be imported
> from anywhere on your Python path, as you've noted.
>
> So, if you *only* want to share the template tags and nothing else from
> their current application, make a new application that only contains
> those template tags. Then you can install that application into both
> projects (by including the import path in INSTALLED_APPS in each
> project's settings file) and the code will be shared as you would
> expect. As mentioned in a thread earlier today on this list, loading a
> template tag in a template will cause all the installed apps to be
> searched for that template tag file, so you don't need to worry about
> keeping the tags right next to the templates they are used in.
>
> > Django is really great framework, but I have a gut feeling that Django
> > support for code reuse is significantly worse, than, say, in Plone/
> > Zope 3. Though it might be because of my relative inexpirience in
> > Django.
>
> It's due to your inexperience, I suspect. Almost everything in Django
> operates through normal Python imports, so you can share any code that
> is on your Python path. The only real constraints are that template tags
> are loaded from a directory called templatetags/ that must live in an
> application directory and models must live in a module called "models".
> Everything else is free-form and entirely under your control.
>
> Regards,
> Malcolm
>
> --
> Depression is merely anger without 
> enthusiasm.http://www.pointy-stick.com/blog/


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



Unicode branch merged into trunk

2007-07-04 Thread Malcolm Tredinnick

I have just finished merging the Unicode branch into trunk (in r5609).

This should be backwards-compatible for all practical purposes
(providing you only use ASCII data). The only real difference you will
notice in that case is that model fields are Unicode strings instead of
bytestrings in type, but since they are ASCII data anyway, that
shouldn't make any real difference.

For people wanting to take advantage of non-ASCII data now, there are
some quick porting steps at
http://code.djangoproject.com/wiki/UnicodeBranch#PortingApplicationsTheQuickChecklist
 .

There is more extensive documentation in the files docs/unicode.txt in
the source or online at
http://www.djangoproject.com/documentation/unicode/ .

Anybody who was previously using the Unicode branch to develop against,
should "svn switch" back to trunk, as no further updates will be going
into that branch. Thankyou to this group of early adopters for your
early testing feedback.

Regards,
Malcolm

-- 
Two wrongs are only the beginning. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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: Sharing code between two projects

2007-07-04 Thread Ben Ford
Ooops, typo from my earlier message s/project/app/ you want a new
application structure as Malcolm said, not a whole project. Sorry :-)

On 04/07/07, Eugene Morozov <[EMAIL PROTECTED]> wrote:
>
>
> Hello,
> Thank you, must have thought about it... Probably need some rest, now
> it seems so obvious a solution.
> Eugene
>
> On 4 июл, 15:56, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> > On Wed, 2007-07-04 at 04:34 -0700, Eugene Morozov wrote:
> > > Hello,
> > > I have two projects, they were developed independently. They will be
> > > run on the same server and have many things in common (notably some
> > > models and templatetags).
> >
> > > While I can import models from another project if it is on PYTHONPATH,
> > > I cannot find a way to share templatetags. I don't want to copy them,
> > > because maintaining costs would become higher (need to remember to
> > > apply bug fixes in both places, for example).
> >
> > > Is there a way to import templatetags from another project?
> >
> > Reuse is much easier once you think in terms of applications, rather
> > than projects. A project is just a collection of applications (really,
> > it's just a settings file and maybe a root URLConf). So you can easily
> > share an application in two projects, since applications can be imported
> > from anywhere on your Python path, as you've noted.
> >
> > So, if you *only* want to share the template tags and nothing else from
> > their current application, make a new application that only contains
> > those template tags. Then you can install that application into both
> > projects (by including the import path in INSTALLED_APPS in each
> > project's settings file) and the code will be shared as you would
> > expect. As mentioned in a thread earlier today on this list, loading a
> > template tag in a template will cause all the installed apps to be
> > searched for that template tag file, so you don't need to worry about
> > keeping the tags right next to the templates they are used in.
> >
> > > Django is really great framework, but I have a gut feeling that Django
> > > support for code reuse is significantly worse, than, say, in Plone/
> > > Zope 3. Though it might be because of my relative inexpirience in
> > > Django.
> >
> > It's due to your inexperience, I suspect. Almost everything in Django
> > operates through normal Python imports, so you can share any code that
> > is on your Python path. The only real constraints are that template tags
> > are loaded from a directory called templatetags/ that must live in an
> > application directory and models must live in a module called "models".
> > Everything else is free-form and entirely under your control.
> >
> > Regards,
> > Malcolm
> >
> > --
> > Depression is merely anger without enthusiasm.http://www.pointy-
> stick.com/blog/
>
>
> >
>


-- 
Regards,
Ben Ford
[EMAIL PROTECTED]
+628111880346

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



Help for side project needed (Django + JavaScript)

2007-07-04 Thread [EMAIL PROTECTED]

Django Users,

First let me apologize for this spammy post. I first tried contacting
several contractors posted on the Django Project website, but did not
have much luck. One person I did get in touch with suggested that I
try here as well.

I have a game website that I am currently migrating off of Webware to
Django, but I could use another set of hands/brains to get things
wrapped up over the next 3-6 months.

The technology stack is:

- Debian (Ubuntu) Linux
- Apache
- MySQL
- Python (Django)
- XHTML + CSS
- JavaScript (YUI)
- CVS

High-level Project details:

- About 120-160 hours of work remaining
- Work can be done remotely
- Work when you want (we just need time to sync up via Email and IM)
- Looking to keep a slow but steady pace (10-20 hours per week)
- My budget is limited (10 USD per hour), so I believe that will limit
(by location/cost of living) of who can help
- I have a Ubuntu VMWare instance with the entire project, so you
won't need to clutter your machine with my software configuration

If you are interested, please send me an email directly (let's not
bother the whole group) and I will answer any questions you may have:

[EMAIL PROTECTED]


regards,
Shootclub Webmaster


--~--~-~--~~~---~--~~
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: Unicode branch merged into trunk

2007-07-04 Thread David Reynolds


On 4 Jul 2007, at 1:41 pm, Malcolm Tredinnick wrote:


I have just finished merging the Unicode branch into trunk (in r5609).


Fantastic news!

What's the status of newforms-admin (just out of interest).

Thanks to everyone whose good work has gone into the Unicode branch.

Cheers,

David

--
David Reynolds
[EMAIL PROTECTED]




smime.p7s
Description: S/MIME cryptographic signature


Re: Using newforms to create multiple related objects?

2007-07-04 Thread yml

Hello,

It would be great if one of the Gurus could spend some time to answer
this kind of questions. I am trying to do something similar. But so
far I haven't been able to achieve this.
I am looking for a way to build dynamically a form representing a
mashup of several models and its associated view.

Thank you

On Jun 29, 3:45 am, Michael Sylvan <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I am trying to use newforms and templates, together with the following
> models, to mimic what the admin application does with num_in_admin :
> provide a form for Person's fields, and multiple Phone forms.
>
> With just one Phone form things are quite straightforward: validate
> the Person form, and if that passes, save the object, get its ID, fill
> the ID field of the Phone object and then save it.
>
> With multiple Phone forms, however, I have not been able to customize
> the HTML IDs of the various fields -- form_for_model generates
> identical forms!
>
> One can modify form_for_model with a custom formfield_callback
> function, but as far as I can tell, it maps a field name to a field
> object, so it won't be enough to override that.
>
> Is there a way to do this sort of things cleanly, short of using the
> newforms-admin branch of Django? Or do I have to do something like
> changing the form's fields attribute by hand?
>
> Thanks,
>
> -- M. Sylvan
>
> class Person(models.Model):
> firstName = models.CharField(maxlength=32)
> lastName  = models.CharField(maxlength=32)
>
> class Phone(models.Model):
> person = models.ForeignKey(Person)
> number = models.CharField(maxlength=24, core=True)


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



Re: nasa site on django

2007-07-04 Thread Gábor Farkas

Jeremy Dunck wrote:
>>   Frankly I think a generic python application server similar to tomcat
>> would do a world of good for python apps in general. Something similar to
>> cherrypy... but this is beyond the responsibilities of the django community
>> which have plenty great work left.
> 
> Similar to CherryPy but not it?  How come?  In any case, if you're
> thinking this way, consider Aspen/Stephane:
> http://www.zetadev.com/software/aspen/
> 
> It appears to be thread-per-request.

so all the usual issues (and non-issues) with the python GIL apply...


btw. i never understood what's so nice about those pure-python (or 
pure-ruby (mongrel etc.)) web-servers..

for example regarding performance/memory-consumption/whatever,

why should apache+mod_python be worse than a pure-python-web-server?

let's say with the single-process multi-threaded apache-mode...?

gabor

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



Re: Unicode branch merged into trunk

2007-07-04 Thread Paul Rauch

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

David Reynolds schrieb:
> 
> On 4 Jul 2007, at 1:41 pm, Malcolm Tredinnick wrote:
> 
>> I have just finished merging the Unicode branch into trunk (in r5609).
> 
> Fantastic news!
> 
> What's the status of newforms-admin (just out of interest).
> 
> Thanks to everyone whose good work has gone into the Unicode branch.
> 
> Cheers,
> 
> David
> 
thanks for the good work.

*building new rpm out of a current svnsnapshot*

greetz Paul Rauch
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iQIVAwUBRouddhG67lyyQrltAQLezg/9Gxphc6uyD/PypuLUr+eHneHTiF+1OimY
TiACJ1HN5XlOVBQw6UBdA8xVWZUAiXdlmYU2E9c9uVFjk680sWb8oWQ/xs5OAh/u
onu7zxXpYeFNE/U/8jQYL4Jz5FFiFcttxGJziiKNefkn73R5KDZaKnq59OEfjZBq
TfCq8UAikuZaUi5SaIHHW7h6EAW9XcNKKP023rexFe9j0y4TXzYICV2t/6Fha2w4
NohBYtZL8V9FFEYERLLY63MkBg0ylFX4Om6mWu+V1kJumidsW4FgiB3wZ4bI47Sn
xbuZGhaYd5o6ViH0XmlNxI2cdKp6J2AL2Vn3a76WK4MmDK8WF+/vp0ebhdDOdycY
61TMVPPQlsAF/p/K2EddpQ8+GNC6dzuphLM4B3RBC/chO+kdec4BTWYOdiIzHRiU
bPaY1b9rp9gC8PS1f3/g/SAA+5h7+1FFPtUr2BxxAraKbDrpHMctv3xd1eGMLfm0
Z7wZomPqzfPKpqoMkr/o1Jsr386uWXdk4O6nuGWIN3n70teiEMyZoieUNieoV2Fc
GqPJ2vCyx+OthjJAVIOLbIsWGvBl+x5MjITFrefAdi8zqIG7+N8iymb5uEXm6Y1J
o0bMPs+XO5BiaYKu5ctDVT3eBxQB41y9gFXHspe1JR1ImnU1108wrOoG9EPDeWR0
cMT8T+ETP1M=
=mnaS
-END PGP SIGNATURE-

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



using create_update.update_object with formtools.preview

2007-07-04 Thread sector119

is it possible? or it's possible to use formtools.preview only with
newforms models?


--~--~-~--~~~---~--~~
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, unicode and umlauts

2007-07-04 Thread Dirk van Oosterbosch, IR labs
Thanks, that did it.
d

On 2-jul-2007, at 3:35, Malcolm Tredinnick wrote:

> So change
> it to compare:
>
> unicode(default_movies[i].name, 'utf-8') == self.clean_data 
> [...]



--~--~-~--~~~---~--~~
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: Ideas for performance improvement?

2007-07-04 Thread jj

I've tried to use ideas from:
http://code.djangoproject.com/attachment/wiki/CookBookPreloadRelated/db.py

so:
oids=[obj._get_pk_val() for obj in Book.objects.all()]
c={'co_book_set__in': oids}
Author.objects.filter(**c).select_related(True)
but this generates:
300 queries
and the result is not being cached.

I had thought:
b.co_authors.all()
would now be populated, but apparently it isn't.

Is there any way I could reduce the number of DB query to 1 (or a mere
few)?

JJ.

FYI, the model is as follows:
class Book(models.Model):
title = CharField()
main_author = ForeignKey(Author, related_name='main_book_set')
co_authors = ManyToManyField(Author,
related_name='co_book_set')

class Author(models.Model):
initials = CharField()
employee_id = SmallPositiveInteger()
user = ForeignKey(User)
On Jul 4, 1:59 pm, jj <[EMAIL PROTECTED]> wrote:
> On Jul 2, 8:00 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
>
> > Sorry, I meant how many HTTP requests *per page*, as in, how many
> > external resource references?
>
> - 13 unique external images
> - 4 stylesheets (changelists.css from contrib/admin)
>
> and I just noticed I create:
> - 4000 HTML anchors
>
> > Are you serving media off a separate server, or though apache?  If
> > apache, are you using it's regular file service or running it through
> > Django?
>
> Through Apache's regular file service (as described in the tutorial).
>
> > > 1, essentially: Book.objects.select_related(). Plus access to 5
> > > foreign objects per book.
>
> > with settings.DEBUG = True:
>
> > from django.db import connection
> > print connection.queries
>
> > May give you a clue.
>
> I've now instrumented as you suggest:
> db.reset_queries()
> book_list = list(Book.objects.select_related())
> l0 = len(book_list)
> l1 = len(db.connection.queries)
> response = render_books(request, book_list, title='All books')
> l2 = len(db.connection.queries) - l1
> response.write('(%s, %s, %s)' %
> (l0, l1, l2))
> return response
>
> and the amazing response is:
> (l0: 225, l1: 1, l2: 2630)
> !!!
>
> I'm quite at lost here. What am I doing wrong?
>
> > > book_list = cache.get('all_books')
> > > if not book_list:
> > > book_list = Book.objects.select_related()
> > > cache.set('all_books', book_list)
>
> > This doesn't actually cache the result set.  Querysets are lazy.
> > If you want to cache the finished results, try this:
>
> >  book_list = cache.get('all_books')
> >  if not book_list:
> >  book_list = list(Book.objects.select_related())
>
> Thanks. I've now tried the above, no performance gain however. Could
> this be related to the issue above?
>
> >  cache.set('all_books', book_list)
>
> > > book_list = [b for b in book_list if b.is_visible_by(user)]
>
> >  Concur with Tim that this may be worth making a DB function and
> > using extra() on.
>
> > Depends which DB you're using, really?
>
> Initially, sqlite3, but I've now switched to MySQL 5.
>
> JJ.
>
> On Jul 2, 8:00 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
>
> > On 7/2/07, jj <[EMAIL PROTECTED]> wrote:
>
> > > > How many HTTP requests?
>
> > > It's only me testing at the moment, and it's already slow enough.
>
> > Sorry, I meant how many HTTP requests *per page*, as in, how many
> > external resource references?
>
> > Are you serving media off a separate server, or though apache?  If
> > apache, are you using it's regular file service or running it through
> > Django?
>
> > > 1, essentially: Book.objects.select_related(). Plus access to 5
> > > foreign objects per book.
>
> > with settings.DEBUG = True:
>
> > from django.db import connection
> > print connection.queries
>
> > May give you a clue.
>
> > > book_list = cache.get('all_books')
> > > if not book_list:
> > > book_list = Book.objects.select_related()
> > > cache.set('all_books', book_list)
>
> > This doesn't actually cache the result set.  Querysets are lazy.
> > If you want to cache the finished results, try this:
>
> >  book_list = cache.get('all_books')
> >  if not book_list:
> >  book_list = list(Book.objects.select_related())
> >  cache.set('all_books', book_list)
>
> > > book_list = [b for b in book_list if b.is_visible_by(user)]
>
> >  Concur with Tim that this may be worth making a DB function and
> > using extra() on.


--~--~-~--~~~---~--~~
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: Unicode branch merged into trunk

2007-07-04 Thread Thomas Guettler

Am Mittwoch, 4. Juli 2007 14:41 schrieb Malcolm Tredinnick:
> I have just finished merging the Unicode branch into trunk (in r5609).

Thank you Malcolm.

 Thomas Güttler

--~--~-~--~~~---~--~~
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: FastCGI spawns unnecessary processes on large POST's

2007-07-04 Thread Dirk van Oosterbosch, IR labs
On 1-jul-2007, at 21:24, Dirk van Oosterbosch, IR labs wrote:
>
> I narrowed down the moment the extra processes are spawned by  
> FastCGI to be here:
>
>   if request.method == 'POST':
>   if not (('poster' in request.FILES) or ('movie' in 
> request.FILES)):

The following happens upon receivement of large POST's:
FastCGI starts up the (Django) site script which passes the request  
to the view code. Then the script gets untill between the two excerpt  
lines above. But because it is a large POST and is not completely  
received over the wire yet, it hangs / waits (whatever you wanna call  
it) there. This makes FastCGI think that the whole handling of the  
request is stalled, upon which FastCGI spawns a new process every 3  
seconds (ultimately crashing the server).

If found this old thread on the FastCGI list, which seems to  
accurately explains the problem:
http://www.fastcgi.com/archives/fastcgi-developers/2004-January/ 
003206.html

However, the proposed solution, to put this on the top of the view code:
tmp_response = HttpResponse()
tmp_response.write("Content-type: text/html")
tmp_response.flush()

does not seem to work.
Is text/html the correct Content-type to use with Django?

I would be very surprised if uploading files using Django and FastCGI  
does work for anyone at all, with the present code.
Is nobody having troubles with large POST's?


Two more questions:
2. I'm trying to debug this uploading script using print statements  
code. These print statement however show up in Apache's error.log  
quite late, much later than the warnings and notifications of  
FastCGI. Is there a way to flush these print statements so I can find  
them in the error.log sooner?

3. What is the exact behavior when a request containing a POST comes  
in? Shouldn't it be buffering the data while the data comes in and be  
telling FastCGI it is handling the request? What is exactly happening  
between those two lines in my code above?


Best regards,
dirk




--~--~-~--~~~---~--~~
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: MySQL Got packet bigger than 'max_allowed_packet'

2007-07-04 Thread Carl Karsten

[EMAIL PROTECTED] wrote:
> Thanks Martn and Carl.
> 
> I would really like to avoid having to re design the architecture of
> the application at this stage (its a case of the requirements changing
> after roll out), althougth thanks for the comments re serving large
> data volumes.
> I have made the adjustments suggested in 
> http://dev.mysql.com/doc/refman/4.1/en/packet-too-large.html
> prior to making these loading the insert directly into  mysql failed,
> afterwards it suceeded but the insert through django still fails hence
> my question - Does django ignore the max_allowed_packet setting in
> my.cnf?
> if so how can it be increased so that django uses it?

django uses python's mysqldb module, which uses mysql's client library.

My guess is the my.conf you edited is not the one being used.

I would write a little 5 line .py that just connects and inserts a 5m wad of 
data.  my guess is it will fail.

I tried to track down exactly where the .conf file got read, and ran out of 
time.  But I did see that you can specify it as part of the connection:

89 read_default_file
90   file from which default client values are read

http://mysql-python.svn.sourceforge.net/viewvc/mysql-python/trunk/MySQLdb/MySQLdb/connections.py?view=markup

I rushed this post and just psoted what I had so far, so let me know if you 
need 
more details.

Carl K

--~--~-~--~~~---~--~~
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 know what went wrong with the .save()

2007-07-04 Thread AnaReis

Hi again,
Thanks for the suggestion, but this still isn't working... the
difference between this module and the others that I have already made
is that (besides the fact that the others actually work) this one
involves a table with two primary keys. If it had just one I bet there
would be no problem.
I don't know why this doesn't save the object. All the inserted data
is saved in the Level object correctly as you can see from the output
of the error page (because of the assert False I put in the code):
level 

The model file is:
[models.py]
class LevelForm(forms.Form):
level_Name=RegexField('^level\d[a-b]?$', required=True,
max_length=20, initial='level', error_message='Blah')
instrument_Name=ChoiceField(required=False,
choices=[(i.instrument_name,i.instrument_name) for i in
Instrument.objects.all()])
available=ChoiceField(required=False, choices=[('Y','Yes'),
('N','No')], initial='Y')
table_Name=RegexField('^[a-zA-Z]+$', required=False,
max_length=20, error_message='Blah')

class Level(models.Model):
level_name = models.CharField(primary_key=True, maxlength=20)
instrument_name = models.CharField(primary_key=True, maxlength=20)
available = models.TextField()
tablename = models.CharField(blank=True, maxlength=20)
def __str__(self):
stringue='level_name - '+self.level_name+' instrument_name -
'+self.instrument_name+' available - '+str(self.available)+' tablename
- '
if self.tablename== None:
stringue=stringue+str(self.tablename)
else:
stringue=stringue+self.tablename
return stringue

class Meta:
db_table = 'Level'

I really don't know how to make this work and I need to make this
work :(

Ana

On Jul 3, 7:55 pm, RajeshD <[EMAIL PROTECTED]> wrote:
> Hi Ana,
>
>
>
> > [views.py]
> > level=Level()
> > level.level_name=form.clean_data.get('level_Name')
> > level.instrument_name=form.clean_data.get('instrument_Name')
> > level.available=form.clean_data.get('available')
> > level.tablename=form.clean_data.get('tabelname')
>
> > level.save()
>
> > #when I do this instruction to test if anything was inserted
> > num=Level.objects.filter(Q(level_name__exact=level.level_name) &
> > Q(instrument_name__exact=level.instrument_name)).count() #returns 0L
>
> Try that without the Q object like this:
>
> num=Level.objects.filter(level_name__exact=level.level_name,
> instrument_name__exact=level.instrument_name).count()
>
> -Rajesh


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



Building forms by hands

2007-07-04 Thread Alexander Solovyov

Hi all.

I want to build forms in HTML by hands, without helpers from django
(like outputting field with label and etc), but I can't find one thing
- how I can get value from field (to select appropriate field in
radioselect, f.e.).

For example, RadioSelect provides unordered list with choices, but I
want to get fieldset - and can't select necessary field.

Thanks in advance.

--
Alexander


--~--~-~--~~~---~--~~
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 know what went wrong with the .save()

2007-07-04 Thread RajeshD



On Jul 4, 12:14 pm, AnaReis <[EMAIL PROTECTED]> wrote:
> Hi again,
> Thanks for the suggestion, but this still isn't working... the
> difference between this module and the others that I have already made
> is that (besides the fact that the others actually work) this one
> involves a table with two primary keys. If it had just one I bet there
> would be no problem.

And you'd win that bet! I should have noticed the two PKs in your
model.

Here's the thing: Django allows only one PK field per object. You
should remove the two primary_key=True attributes altogether from your
model (letting Django create a PK id field for you.) Then, use the
unique_together clause to make the database enforce that the pair
(level_name, instrument_name) is always unique. That clause is defined
in your Meta class like this:

unique_together = (('level_name', 'instrument_name'),) # Note that
this is a nested tuple

For added measure you can add a db_index=True to your formerly primary
key fields to make querying over them faster.

Don't forget to wipe out the model entirely from your DB table
(assuming you are in development mode with despensible test data) and
then syncdb to recreate everything.


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



RE: Admin module, user account editing and group assignment info

2007-07-04 Thread Chris Brand

> If I open page to edit user's account, at the bottom is multiselect
> box containing all existing groups.
> 
> If I select one(s) and save user profile, in DB table
> auth_user_grooups I see a correct links between auth_user and
> auth_group table.
> 
> But I cannot find the same information in the GUI. I use development
> version of Django a few days old.

If you go to edit that same user in the Admin, the group should be selected
in that same multiselect box.

It's as simple as that.

Chris




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



YUI tags

2007-07-04 Thread Todd O'Bryan

I just looked at YUI yesterday and am pretty impressed. What I'm not
impressed by is how complicated it is to write the markup in HTML for
things like menus so that they'll work in non-JavaScript environments.

I'm considering trying to develop a yuitags app that would just consist
of template tags that compartmentalize YUI widgets in a form that would
make them easy to enter in a Django template. For example, to do a
menubar, you'd do something like

{% menubar %}
{% menu %}
{% menuitem %}Menu One{% endmenuitem %}
{% menuitem %}Item One.1{% endmenuitem %}
{% menuitem %}Item One.2{% endmenuitem %}
{% endmenu %}
{% menu %}
etc.
{% endmenu %}
{% endmenubar %}

The other thing is that you could include a

{{ yui_links }}

variable in the head section of your base template, and each tag would
include the imports it would need to be displayed in the context so that
they'd be loaded automatically.

Does such a thing already exist? If not, is this something people see a
use for? Any gotchas I'm missing that would make this impossible instead
of just tricky?

Thanks,
Todd


--~--~-~--~~~---~--~~
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: augmenting admin delete

2007-07-04 Thread Aidas Bendoraitis

Use Django pre_delete and post_delete signals:
http://www.mercurytide.co.uk/whitepapers/django-signals/

or override the delete method:
def delete(self):
# do something
super(type(self), self).delete()
# do something

Regards,
Aidas Bendoraitis aka Archatas


On 7/3/07, Bryan <[EMAIL PROTECTED]> wrote:
>
> Is there an easy way to augment deleting from the admin page.
> Specifically, I'm uploading an image and as part of saving the image
> model I make a thumbnail (which isn't part of the model). The admin
> delete will remove the uploaded image but not the thumbnail, so I'd
> like to basically say, whenever you delete the image also delete the
> thumbnail.
>
> I know I can override the admin delete to do whatever I want but I
> just want to augment it with one tiny thing, so I'm hoping there is a
> clean way.
>
> Any ideas?
>
> Thanks.
>
>
> >
>

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



newbie having difficulty with sqlite

2007-07-04 Thread walterbyrd

My settings.py file looks like this:

DATABASE_ENGINE = 'sqlite3'# 'postgresql_psycopg2', 'postgresql',
'mysql', 'sqlite3' or 'ado_mssql'.
DATABASE_NAME = '/usr/bin/scripts/mysite/books' # Or path to database
file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost.
Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not
used with sqlite3.

I do not have a database file yet. I am just setting this up.

I ran the interactive shell with: python manage.py shell. Then
entered:

In [1]: from django.db import connection
In [2]: cursor = connection.cursor()

Here is where it bombed:

---> 58 self.connection = Database.connect(**kwargs)

This is the error message:

OperationalError: unable to open database file

Am I supposed to already have a database file? I have been trying to
follow the examples given in djangobook.com, and I don't see where I
was supposed to create a file before running those commands.
DATABASE_NAME is set to where I want the file to go.


--~--~-~--~~~---~--~~
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: ImageField upload_to Parameter Problem

2007-07-04 Thread Martin Winkler

Am Wed, 04 Jul 2007 01:19:16 -0700
schrieb lastmohican <[EMAIL PROTECTED]>:

> The Problem is, I want a dynamic image
> storage path, something like MEDIA_ROOT+"images/" wont work with
> hundreds of galleries, [...]

Since your primary concern seems to be too many files in one directory,
did you check
http://www.djangoproject.com/documentation/model-api/#filefield
especially the paragraph about "%Y/%m/%d" ?

So you could do this:

image = models.ImageField(upload_to='images/%Y/%m/%d')

Of course the images of one album are not in one directory, but this
solution still makes more sense:
1) Many users might not upload any images at all - so there would be
many empty directories.
2) Some users might upload a whole lot of images - your problem with too
many files in one directory will come up again.

An additional benefit: If you run out of diskspace, you could mount a
different volume under $MEDIA_ROOT/images/2008 for the next year.

And of course django will always know where your images are:

[ i.image for i in Gallery.get(slug="foobar").image_set.all() ]

will get you all images for one gallery.


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



Re: newbie having difficulty with sqlite

2007-07-04 Thread nick feng
 I think you should create the books file by yourself, the sqlite3 may not have 
the ability to create the file in your file system.
- Original Message - 
From: "walterbyrd" <[EMAIL PROTECTED]>
To: "Django users" 
Sent: Thursday, July 05, 2007 2:25 AM
Subject: newbie having difficulty with sqlite


> 
> 
> My settings.py file looks like this:
> 
> DATABASE_ENGINE = 'sqlite3'# 'postgresql_psycopg2', 'postgresql',
> 'mysql', 'sqlite3' or 'ado_mssql'.
> DATABASE_NAME = '/usr/bin/scripts/mysite/books' # Or path to database
> file if using sqlite3.
> DATABASE_USER = '' # Not used with sqlite3.
> DATABASE_PASSWORD = '' # Not used with sqlite3.
> DATABASE_HOST = '' # Set to empty string for localhost.
> Not used with sqlite3.
> DATABASE_PORT = '' # Set to empty string for default. Not
> used with sqlite3.
> 
> I do not have a database file yet. I am just setting this up.
> 
> I ran the interactive shell with: python manage.py shell. Then
> entered:
> 
> In [1]: from django.db import connection
> In [2]: cursor = connection.cursor()
> 
> Here is where it bombed:
> 
> ---> 58 self.connection = Database.connect(**kwargs)
> 
> This is the error message:
> 
> OperationalError: unable to open database file
> 
> Am I supposed to already have a database file? I have been trying to
> follow the examples given in djangobook.com, and I don't see where I
> was supposed to create a file before running those commands.
> DATABASE_NAME is set to where I want the file to go.
> 
> 
> > 
>
--~--~-~--~~~---~--~~
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: ImageField upload_to Parameter Problem

2007-07-04 Thread lastmohican

Thanks, this is quite a good idea, the more I think about it the more
I like it, because Images have only one Gallery, but I can change the
gallery for every image if I want, which would lead to the problem of
moving the image file from one directory to another. Your proposal
seems to be the better solution.


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



An idea on DB migration

2007-07-04 Thread Noam

Hello,

I have an idea on how DB migration can work in Django. It's very
simple, it will allow the programmer to do anything he wants in the
migration, and he will have to learn almost nothing in order to
migrate the DB. The drawback is that it's not very efficient, which
means that it will probably work only for small to medium databases -
but I think that most Django sites are like this. If you have a bigger
site, you will have to use SQL.

My idea is this: create a tool which will create a script which will
migrate the DB. The user will then edit the script as he likes, and
run it to create a new DB with the migrated data. If the result is not
what he wanted, he will edit the script again and run it again.

For example, say that I have a directory with the old site (and old
models) and a directory with the new site. The only difference between
them is that I renamed the field store.Book.name to
store.Book.book_name. I will run "django-admin.py migrate oldsitedir
newsitedir". This will create a file which will look like this:

=
#!/usr/bin/env python

from django.db import ...

class old_settings:
DATABASE_ENGINE = 'mysql'
DATABASE_NAME = 'store_3'
...

class new_settings:
DATABASE_ENGINE = 'mysql'
DATABASE_NAME = 'store_4'
...

old_connection = make_connection_from_settings(old_settings)
new_connection = make_connection_from_settings(new_settings)

# Old models

class old:
class auth:
class User(models.Model):
_connection = old_connection  # or whatever will be needed

username = models.CharField(unique=True, maxlength=30)
...

class store:
class Book(models.Model):
_connection = old_connection

name = models.CharField()
...

# New models

class new:
...
class store:
class Book(models.Model):
_connection = old_connection

book_name = models.CharField()
...

# Migration function

def migrate():
drop_tables_in_new_db_and_sync_it()

# Migrate auth.User
for o in old.auth.User.objects.all():
n = new.auth.User()
n.id = o.id
n.username = o.username
...
n.save()

# Migrate store.Book
for o in old.store.Book.objects.all():
n = new.store.Book()
n.id = o.id
# TODO:
# Removed fields: name
# Added fields: book_name
n.save()
...

if __name__ == '__main__':
migrate()

=

Then, to migrate the DB, I will edit the file, search for "TODO"
comments, and replace the comment in the file with "n.book_name =
o.name". I will create a new empty DB with the name "store_4".

Then I will run "./migrate.py", and the database will be migrated. I
will run the new version of my site, and if everything works I can
delete the DB "store_3".

Another thing: the migrate command will work also with only one given
site directory. In that case the old db definition and the new db
definition will be identical, and the user will be able to edit them
manually in the generated file. This feature will also help in
migrating between different types of databases - in that case, the
user will only change the settings on the top of migrate.py.

To summarize: the programmer won't have to learn commands which add
new fields, delete fields, rename fields, modify fields, etc. The
programmer will just have to slightly modify a generated file, to
create the new version of the DB as he likes.

I hope I managed to explain my idea. What do you think about it?

Have a good day,
Noam


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



Re: newbie having difficulty with sqlite

2007-07-04 Thread walterbyrd



On Jul 4, 12:31 pm, "nick feng" <[EMAIL PROTECTED]> wrote:
>  I think you should create the books file by yourself, the sqlite3 may not 
> have the ability to create the file in your file system.

Thank you. That did it.


--~--~-~--~~~---~--~~
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: An idea on DB migration

2007-07-04 Thread Carl Karsten

Noam wrote:

> For example, say that I have a directory with the old site (and old
> models) and a directory with the new site. The only difference between
> them is that I renamed the field store.Book.name to
> store.Book.book_name. I will run "django-admin.py migrate oldsitedir
> newsitedir". This will create a file which will look like this:
> 
[snip]

> 
> Then, to migrate the DB, I will edit the file, search for "TODO"
> comments, and replace the comment in the file with "n.book_name =
> o.name". I will create a new empty DB with the name "store_4".

I don't like the "edit the file" part.  I can think of 2 alternatives:

1. add an attribute to one/both of the models.  something like

class Book(models.Model):
 name = models.CharField(blank=True, "migrate_to"="book_name" )

2. a 3rd file that defines those kind of translations, which might be about the 
same by just subclassing the existing models.

class Book(models.Book):
 book_name = Book.name()

(I am totally winging it here, so forgiveme if my brain storm has some 
turbulence.)

Also, along the lines of slow... you are going to love this one: how about 
making it use the web server as the source which would allow migrating between 
2 
servers where http is the only exposed protocol?   it would also take care of 
migrating between systems where I don't have both db stacks installed on one 
box 
- consider win/mssql -> linux/SqlLite.  yeah yeah, django/mssql doesn't exist 
yet... but it makes a good example :)

Carl K

--~--~-~--~~~---~--~~
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: An idea on DB migration

2007-07-04 Thread nick feng
The django has already provided the way to use SQL, I don't think this is 
needed.

- Original Message - 
From: "Noam" <[EMAIL PROTECTED]>
To: "Django users" 
Sent: Thursday, July 05, 2007 2:40 AM
Subject: An idea on DB migration


> 
> 
> Hello,
> 
> I have an idea on how DB migration can work in Django. It's very
> simple, it will allow the programmer to do anything he wants in the
> migration, and he will have to learn almost nothing in order to
> migrate the DB. The drawback is that it's not very efficient, which
> means that it will probably work only for small to medium databases -
> but I think that most Django sites are like this. If you have a bigger
> site, you will have to use SQL.
> 
> My idea is this: create a tool which will create a script which will
> migrate the DB. The user will then edit the script as he likes, and
> run it to create a new DB with the migrated data. If the result is not
> what he wanted, he will edit the script again and run it again.
> 
> For example, say that I have a directory with the old site (and old
> models) and a directory with the new site. The only difference between
> them is that I renamed the field store.Book.name to
> store.Book.book_name. I will run "django-admin.py migrate oldsitedir
> newsitedir". This will create a file which will look like this:
> 
> =
> #!/usr/bin/env python
> 
> from django.db import ...
> 
> class old_settings:
>DATABASE_ENGINE = 'mysql'
>DATABASE_NAME = 'store_3'
>...
> 
> class new_settings:
>DATABASE_ENGINE = 'mysql'
>DATABASE_NAME = 'store_4'
>...
> 
> old_connection = make_connection_from_settings(old_settings)
> new_connection = make_connection_from_settings(new_settings)
> 
> # Old models
> 
> class old:
>class auth:
>class User(models.Model):
>_connection = old_connection  # or whatever will be needed
> 
>username = models.CharField(unique=True, maxlength=30)
>...
> 
>class store:
>class Book(models.Model):
>_connection = old_connection
> 
>name = models.CharField()
>...
> 
> # New models
> 
> class new:
>...
>class store:
>class Book(models.Model):
>_connection = old_connection
> 
>book_name = models.CharField()
>...
> 
> # Migration function
> 
> def migrate():
>drop_tables_in_new_db_and_sync_it()
> 
># Migrate auth.User
>for o in old.auth.User.objects.all():
>n = new.auth.User()
>n.id = o.id
>n.username = o.username
>...
>n.save()
> 
># Migrate store.Book
>for o in old.store.Book.objects.all():
>n = new.store.Book()
>n.id = o.id
># TODO:
># Removed fields: name
># Added fields: book_name
>n.save()
>...
> 
> if __name__ == '__main__':
>migrate()
> 
> =
> 
> Then, to migrate the DB, I will edit the file, search for "TODO"
> comments, and replace the comment in the file with "n.book_name =
> o.name". I will create a new empty DB with the name "store_4".
> 
> Then I will run "./migrate.py", and the database will be migrated. I
> will run the new version of my site, and if everything works I can
> delete the DB "store_3".
> 
> Another thing: the migrate command will work also with only one given
> site directory. In that case the old db definition and the new db
> definition will be identical, and the user will be able to edit them
> manually in the generated file. This feature will also help in
> migrating between different types of databases - in that case, the
> user will only change the settings on the top of migrate.py.
> 
> To summarize: the programmer won't have to learn commands which add
> new fields, delete fields, rename fields, modify fields, etc. The
> programmer will just have to slightly modify a generated file, to
> create the new version of the DB as he likes.
> 
> I hope I managed to explain my idea. What do you think about it?
> 
> Have a good day,
> Noam
> 
> 
> > 
>
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Applying custom manager methods on querysets

2007-07-04 Thread cesco

Hi,

in django we can chain multiple filter methods like:

MyModel.objects.filter(field1__exact=value1).filter(field2__exact=value2)

but I'd like to be able to chain custom filter methods defined by
extending the models.Manager class.
For example:

MyModel.objects.filter(field1__exact=value1).my_filter(field2)

In other words I'd like to be able to apply the filter directly to a
queryset and not only to MyModel.objects.

Do you have any suggestion on how to accomplish that?

Thanks a lot
Francesco


--~--~-~--~~~---~--~~
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: An idea on DB migration

2007-07-04 Thread Noam Raphael

On 7/4/07, Carl Karsten <[EMAIL PROTECTED]> wrote:
>
> I don't like the "edit the file" part.  I can think of 2 alternatives:
>
> 1. add an attribute to one/both of the models.  something like
>
> class Book(models.Model):
>  name = models.CharField(blank=True, "migrate_to"="book_name" )
>
> 2. a 3rd file that defines those kind of translations, which might be about 
> the
> same by just subclassing the existing models.
>
> class Book(models.Book):
>  book_name = Book.name()
>
> (I am totally winging it here, so forgiveme if my brain storm has some 
> turbulence.)
>

What I like about my idea is that you don't need to learn new syntax
for migration. And syntax like this will never be enough - for
example, how would you convert a field with a full name into two
fields, the first name and last name? Using my idea, it will simply
be:

n.first_name, n.last_name = o.name.split()

(Well, you would have to add some error handling, but it won't be a
lot more complicated.)

> Also, along the lines of slow... you are going to love this one: how about
> making it use the web server as the source which would allow migrating 
> between 2
> servers where http is the only exposed protocol?   it would also take care of
> migrating between systems where I don't have both db stacks installed on one 
> box
> - consider win/mssql -> linux/SqlLite.  yeah yeah, django/mssql doesn't exist
> yet... but it makes a good example :)

I think that for this you can use "./manage.py dumpdata" and
"./manage.py loaddata". See
http://groups.google.com/group/django-users/msg/02f5447f41207a65

Noam

--~--~-~--~~~---~--~~
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: ImageField upload_to Parameter Problem

2007-07-04 Thread lastmohican

And in case anyone is interested in the results (a demo django gallery
application) have a look here:

http://saschashideout.de/wiki/DjangoGalleryTutorial/


--~--~-~--~~~---~--~~
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: An idea on DB migration

2007-07-04 Thread Noam Raphael

On 7/4/07, nick feng <[EMAIL PROTECTED]> wrote:
> The django has already provided the way to use SQL, I don't think this is 
> needed.

Well, I'm not a SQL expert, and I don't feel comfortable with adding
fields manually. I'm never sure whether my SQL statement is what
Django would have issued when creating the table - not to mention
relations and indices. If I don't need to know SQL to use Django, why
should I need to learn SQL to modify my models?

Noam

--~--~-~--~~~---~--~~
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: Unicode branch merged into trunk

2007-07-04 Thread Dmitry Shevchenko

Guys, you rock! :)

-Original Message-
From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of Malcolm Tredinnick
Sent: Wednesday, July 04, 2007 3:42 PM
To: django-users@googlegroups.com
Subject: Unicode branch merged into trunk


I have just finished merging the Unicode branch into trunk (in r5609).

This should be backwards-compatible for all practical purposes
(providing you only use ASCII data). The only real difference you will
notice in that case is that model fields are Unicode strings instead of
bytestrings in type, but since they are ASCII data anyway, that
shouldn't make any real difference.

For people wanting to take advantage of non-ASCII data now, there are
some quick porting steps at
http://code.djangoproject.com/wiki/UnicodeBranch#PortingApplicationsTheQuick
Checklist .

There is more extensive documentation in the files docs/unicode.txt in
the source or online at
http://www.djangoproject.com/documentation/unicode/ .

Anybody who was previously using the Unicode branch to develop against,
should "svn switch" back to trunk, as no further updates will be going
into that branch. Thankyou to this group of early adopters for your
early testing feedback.

Regards,
Malcolm

-- 
Two wrongs are only the beginning. 
http://www.pointy-stick.com/blog/




--~--~-~--~~~---~--~~
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: An idea on DB migration

2007-07-04 Thread Carl Karsten

Noam Raphael wrote:
> On 7/4/07, Carl Karsten <[EMAIL PROTECTED]> wrote:
>> I don't like the "edit the file" part.  I can think of 2 alternatives:
>>
>> 1. add an attribute to one/both of the models.  something like
>>
>> class Book(models.Model):
>>  name = models.CharField(blank=True, "migrate_to"="book_name" )
>>
>> 2. a 3rd file that defines those kind of translations, which might be about 
>> the
>> same by just subclassing the existing models.
>>
>> class Book(models.Book):
>>  book_name = Book.name()
>>
>> (I am totally winging it here, so forgiveme if my brain storm has some 
>> turbulence.)
>>
> 
> What I like about my idea is that you don't need to learn new syntax
> for migration. And syntax like this will never be enough - for
> example, how would you convert a field with a full name into two
> fields, the first name and last name? Using my idea, it will simply
> be:
> 
> n.first_name, n.last_name = o.name.split()
> 
> (Well, you would have to add some error handling, but it won't be a
> lot more complicated.)

The problem I see is maintaining the generated file.  This process will often 
start before the target system is stable, so as soon as you start making 
changes 
to the target model, the converter will need to be updated too.  If the 
transformation formulas are part of one of the models, then there isn't 
anything 
to keep in sync.

maybe put the transformation in the target model:

def getfirst(name):
  return name.split()[0]
def getfirst(name):
  return name.split()[1]

  first_name = models.CharField(blank=True, "migrate_from"="getfirst(name)" 
)
  last_name = models.CharField(blank=True, "migrate_from"="getlast(name)" )

but I am not thrilled about jamming a bunch of conversion stuff in the new 
model 
either.  conversion stuff sucks.

> 
>> Also, along the lines of slow... you are going to love this one: how about
>> making it use the web server as the source which would allow migrating 
>> between 2
>> servers where http is the only exposed protocol?   it would also take care of
>> migrating between systems where I don't have both db stacks installed on one 
>> box
>> - consider win/mssql -> linux/SqlLite.  yeah yeah, django/mssql doesn't exist
>> yet... but it makes a good example :)
> 
> I think that for this you can use "./manage.py dumpdata" and
> "./manage.py loaddata". See
> http://groups.google.com/group/django-users/msg/02f5447f41207a65

But then you don't get any of the nifty transformations which is kinda the 
point 
of your idea.

Carl K

--~--~-~--~~~---~--~~
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: An idea on DB migration

2007-07-04 Thread Noam Raphael

On 7/4/07, Carl Karsten <[EMAIL PROTECTED]> wrote:
>
> The problem I see is maintaining the generated file.  This process will often
> start before the target system is stable, so as soon as you start making 
> changes
> to the target model, the converter will need to be updated too.  If the
> transformation formulas are part of one of the models, then there isn't 
> anything
> to keep in sync.
>
You don't have to maintain the generated file. After you've updated
the database, there's no need to keep it. When you want another update
to the database, you create a new file and change there what you want.

>
> >
> >> Also, along the lines of slow... you are going to love this one: how about
> >> making it use the web server as the source which would allow migrating 
> >> between 2
> >> servers where http is the only exposed protocol?   it would also take care 
> >> of
> >> migrating between systems where I don't have both db stacks installed on 
> >> one box
> >> - consider win/mssql -> linux/SqlLite.  yeah yeah, django/mssql doesn't 
> >> exist
> >> yet... but it makes a good example :)
> >
> > I think that for this you can use "./manage.py dumpdata" and
> > "./manage.py loaddata". See
> > http://groups.google.com/group/django-users/msg/02f5447f41207a65
>
> But then you don't get any of the nifty transformations which is kinda the 
> point
> of your idea.
>
Well, you can separate nifty transformations (which will be done on
one computer) and system migration.

Noam

--~--~-~--~~~---~--~~
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: FastCGI spawns unnecessary processes on large POST's

2007-07-04 Thread Dirk van Oosterbosch, IR labs
Aha, of course you guys also have troubles with uploading large  
POST's. I found the ticket: #2070
Say, which of those patches could I run over version 0.96?
And can I still use the same code as I have here http://dpaste.com/ 
hold/13578/ ?

dirk


On 4-jul-2007, at 17:03, Dirk van Oosterbosch, IR labs wrote:
>
> The following happens upon receivement of large POST's:
> FastCGI starts up the (Django) site script which passes the request  
> to the view code. Then the script gets untill between the two  
> excerpt lines above. But because it is a large POST and is not  
> completely received over the wire yet, it hangs / waits (whatever  
> you wanna call it) there. This makes FastCGI think that the whole  
> handling of the request is stalled, upon which FastCGI spawns a new  
> process every 3 seconds (ultimately crashing the server).
>
> If found this old thread on the FastCGI list, which seems to  
> accurately explains the problem:
> http://www.fastcgi.com/archives/fastcgi-developers/2004-January/ 
> 003206.html
>
> [...]
> I would be very surprised if uploading files using Django and  
> FastCGI does work for anyone at all, with the present code.
> Is nobody having troubles with large POST's?
>
>
> Two more questions:
> 2. I'm trying to debug this uploading script using print statements  
> code. These print statement however show up in Apache's error.log  
> quite late, much later than the warnings and notifications of  
> FastCGI. Is there a way to flush these print statements so I can  
> find them in the error.log sooner?

Found that out. Have this line in yoursite.fcgi
sys.stdout = sys.stderr

> 3. What is the exact behavior when a request containing a POST  
> comes in? Shouldn't it be buffering the data while the data comes  
> in and be telling FastCGI it is handling the request? What is  
> exactly happening between those two lines in my code above?


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



Rendering a template to the browser on the fly using an iterator?

2007-07-04 Thread Steve Bergman

I am working on a report generator which needs to render potentially
huge sets of data into an html table.

The method that generates the rows is an iterator.  I believe that if
I do something like:

return HttpResponse(my_iterator())

it will do what I want.  Except that I want to do it with a template.

I can do something like:

return render_to_response('report.html',
dict(output=generate_output()))

and it works, but it does all the rendering before it starts sending
to the browser, incurring the potentially large memory requirements of
doing so.

I'd like to be able to render a template straight down the wire to the
browser on the fly.

Is this possible?

Thanks for any assistance,
Steve Bergman


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



Cross Importing Model Problem

2007-07-04 Thread Bryan Veloso

I don't know if this is even possible, since I've had so many errors
thrown at me, but I wanted to ask here so I can get a clear picture.

I have 2 models for an MMORPG control panel I'm building. Each set of
data is within it's own app with related models, etc. So here's my
example. It's run off an existing database so I really can't change
any of the database fields.

I have a Character model that imports the Guild model.

class Character(models.Model):
char_id = models.IntegerField('Character ID',
primary_key=True)
account = models.ForeignKey(Account, unique=True,
db_column='account_id')
char_num= models.IntegerField('Character Slot')
name= models.CharField('Name', maxlength=90)
guild   = models.ForeignKey('Guild',
db_column='guild_id') 

But the app that contains Guild has another model that is linked to
the Character model.

class GuildMember(models.Model):
guild   = models.ForeignKey(Guild,
db_column='guild_id', unique=True, primary_key=True)
account = models.ForeignKey(Account,
db_column='account_id', unique=True)
character   = models.ForeignKey(Character,
db_column='char_id', unique=True) 

So when I run it, it says it can't import Character & Guild. Which
makes sense because I'd be importing a model onto itself. Is there any
way to get around this? I thought if you called a model that it would
only import the dependencies related to the model being imported,
rather than all the dependencies in models.py.

My apologies if I totally botched up the explanation, but that's the
best I can manage.


--~--~-~--~~~---~--~~
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: Applying custom manager methods on querysets

2007-07-04 Thread Malcolm Tredinnick

On Wed, 2007-07-04 at 19:15 +, cesco wrote:
> Hi,
> 
> in django we can chain multiple filter methods like:
> 
> MyModel.objects.filter(field1__exact=value1).filter(field2__exact=value2)
> 
> but I'd like to be able to chain custom filter methods defined by
> extending the models.Manager class.
> For example:
> 
> MyModel.objects.filter(field1__exact=value1).my_filter(field2)
> 
> In other words I'd like to be able to apply the filter directly to a
> queryset and not only to MyModel.objects.
> 
> Do you have any suggestion on how to accomplish that?

Sub-class the QuerySet class and have your model's manager return your
subclass as the result of get_query_set() rather than the current
QuerySet instance that is returned.

Look in django/db/models/manager.py for the default manager behaviour
and write something similar for get_query_set().

Regards,
Malcolm

-- 
Tolkien is hobbit-forming. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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: Rendering a template to the browser on the fly using an iterator?

2007-07-04 Thread Malcolm Tredinnick

On Wed, 2007-07-04 at 22:52 +, Steve Bergman wrote:
> I am working on a report generator which needs to render potentially
> huge sets of data into an html table.
> 
> The method that generates the rows is an iterator.  I believe that if
> I do something like:
> 
> return HttpResponse(my_iterator())
> 
> it will do what I want.  Except that I want to do it with a template.
> 
> I can do something like:
> 
> return render_to_response('report.html',
> dict(output=generate_output()))
> 
> and it works, but it does all the rendering before it starts sending
> to the browser, incurring the potentially large memory requirements of
> doing so.

That's correct. Templates render to a string and that string is passed
upstream. If you search the archives, you'll see that we recently tried
to switch to iterative rendering and a lot of unintended side-effects
showed up. So that is being worked on a bit more before we try again.

Note also, that a lot of middleware will interfere with your intentions
here: any middleware that needs to examine the content to do its work as
part of process_response() is going to have to convert the iterator to a
string, so you'll need to be careful in your configuration.

Regards,
Malcolm

-- 
Quantum mechanics: the dreams stuff is made of. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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: nasa site on django

2007-07-04 Thread Graham Dumpleton

On Jul 4, 11:20 pm, Gábor Farkas <[EMAIL PROTECTED]> wrote:
> Jeremy Dunck wrote:
> >>   Frankly I think a generic python application server similar to tomcat
> >> would do a world of good for python apps in general. Something similar to
> >> cherrypy... but this is beyond the responsibilities of the django community
> >> which have plenty great work left.
>
> > Similar to CherryPy but not it?  How come?  In any case, if you're
> > thinking this way, consider Aspen/Stephane:
> >http://www.zetadev.com/software/aspen/
>
> > It appears to be thread-per-request.
>
> so all the usual issues (and non-issues) with the python GIL apply...
>
> btw. i never understood what's so nice about those pure-python (or
> pure-ruby (mongrel etc.)) web-servers..
>
> for example regarding performance/memory-consumption/whatever,
>
> why should apache+mod_pythonbe worse than a pure-python-web-server?
>
> let's say with the single-process multi-threaded apache-mode...?

It may be of interest for you to read my recent blog post at:

  http://blog.dscpl.com.au/2007/07/web-hosting-landscape-and-modwsgi.html

This talks about mod_wsgi, but various of the issues discussed there
with running mod_wsgi in embedded mode apply equally to mod_python.
Some of the things discussed are the balance between performance vs
security, memory usage, scaling ability of Apache and what impacts the
GIL has on performance when using multiple processors. Also ensure you
read comments as some discussion on trade offs between mod_wsgi and
mod_fastcgi or proxy like solutions.

Graham


--~--~-~--~~~---~--~~
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: Cross Importing Model Problem

2007-07-04 Thread Malcolm Tredinnick

On Wed, 2007-07-04 at 23:06 +, Bryan Veloso wrote:
> I don't know if this is even possible, since I've had so many errors
> thrown at me, but I wanted to ask here so I can get a clear picture.
> 
> I have 2 models for an MMORPG control panel I'm building. Each set of
> data is within it's own app with related models, etc. So here's my
> example. It's run off an existing database so I really can't change
> any of the database fields.
> 
> I have a Character model that imports the Guild model.
> 
> class Character(models.Model):
> char_id = models.IntegerField('Character ID',
> primary_key=True)
> account = models.ForeignKey(Account, unique=True,
> db_column='account_id')
> char_num= models.IntegerField('Character Slot')
> name= models.CharField('Name', maxlength=90)
> guild   = models.ForeignKey('Guild',
> db_column='guild_id') 
> 
> But the app that contains Guild has another model that is linked to
> the Character model.
> 
> class GuildMember(models.Model):
> guild   = models.ForeignKey(Guild,
> db_column='guild_id', unique=True, primary_key=True)
> account = models.ForeignKey(Account,
> db_column='account_id', unique=True)
> character   = models.ForeignKey(Character,
> db_column='char_id', unique=True) 
> 
> So when I run it, it says it can't import Character & Guild. Which
> makes sense because I'd be importing a model onto itself. Is there any
> way to get around this? I thought if you called a model that it would
> only import the dependencies related to the model being imported,
> rather than all the dependencies in models.py.

Importing a file processes the whole file. That's the way Python works.
This includes parsing all code at the top level, including class
descriptions like you've got here.

One solution which is recommended to get around circular import problems
is not to import the remote name into the current namespace. Instead,
import the module containing the object you want to access. For example,
instead of

from my_app.models import Character

use

from my_app import models as my_app_models

(using an alias, since "models" might be used elsewhere).

However, having said that, I suspect you might still have some problems
as Django is going to need access to all the internal details as part of
the __new__ method, which might mess things up. We might make this
easier one day (it's been shot down in the past, but it might be worth
revisiting at some point; not soon, though, since we're busy on other
things).

It does force me to ask the question though: if GuildMember depends on
Character *and* Character depends on GuildMember, why are they in
separate applications? They are very tightly bound to each other, so you
can't exactly take one of the apps and use it without the other one.
This looks like false separation of responsibilities a bit.

If you really need them in separate apps and the above technique doesn't
resolve the problem, use a GenericRelation for one of the relations;
that should help.

Regards,
Malcolm

-- 
I intend to live forever - so far so good. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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: Rendering a template to the browser on the fly using an iterator?

2007-07-04 Thread Don Arbow

On Jul 4, 2007, at 3:52 PM, Steve Bergman wrote:
> I'd like to be able to render a template straight down the wire to the
> browser on the fly.
>
> Is this possible?


This was discussed a few weeks ago on the developer list:

http://groups.google.com/group/django-developers/browse_frm/thread/ 
328685ac73959701/7cf4a6f68fffc3e5?lnk=gst&q=template+rendering+as 
+iteration&rnum=1#7cf4a6f68fffc3e5

It was fixed in changeset 5482 but then backed out in 5511, while  
they check for side-effect bugs.

Don



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



Re: Help for side project needed (Django + JavaScript)

2007-07-04 Thread wrb
10usd/h? for god's sake

2007/7/4, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>
> Django Users,
>
> First let me apologize for this spammy post. I first tried contacting
> several contractors posted on the Django Project website, but did not
> have much luck. One person I did get in touch with suggested that I
> try here as well.
>
> I have a game website that I am currently migrating off of Webware to
> Django, but I could use another set of hands/brains to get things
> wrapped up over the next 3-6 months.
>
> The technology stack is:
>
> - Debian (Ubuntu) Linux
> - Apache
> - MySQL
> - Python (Django)
> - XHTML + CSS
> - JavaScript (YUI)
> - CVS
>
> High-level Project details:
>
> - About 120-160 hours of work remaining
> - Work can be done remotely
> - Work when you want (we just need time to sync up via Email and IM)
> - Looking to keep a slow but steady pace (10-20 hours per week)
> - My budget is limited (10 USD per hour), so I believe that will limit
> (by location/cost of living) of who can help
> - I have a Ubuntu VMWare instance with the entire project, so you
> won't need to clutter your machine with my software configuration
>
> If you are interested, please send me an email directly (let's not
> bother the whole group) and I will answer any questions you may have:
>
> [EMAIL PROTECTED]
>
>
> regards,
> Shootclub Webmaster
>
>
> >
>


-- 
韦日宝
wei ribao

--~--~-~--~~~---~--~~
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: Rendering a template to the browser on the fly using an iterator?

2007-07-04 Thread Steve Bergman

Thank you for the replies.  I only searched the user list.  Sounds
like I should probably leave things as they are for now.  The memory
requirements are not *that* extreme.  Iterative rendering would be
super cool though.  I write intranet *apps* rather than web *sites*
and it seems I'm always dealing with large sets of data and big
tables.

With iterative rendering (and if the Firefox guys would fix the
performance issues with large tables) I'd be happy as a clam.

-Steve


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



Spawning long processes

2007-07-04 Thread Oliver Charles

Hi

I'm currently playing around trying to make something akin to
TorrentFlux, using Django. TorrentFlux is a system that's PHP and it
calls shell scripts to download torrents in the background, with a web
interface to control them. For every torrent download, a new process
is started, which runs with the torrent - downloading and seeding it.

My system is similar, and i'm at a very proof of concept stage at the
moment. However, I've hit a problem. I can't find a nice way to spawn
the processes, without Django hanging as long as the process needs
(and for 600mb torrents, that's gonna be hours, and endless if seeding
is expected).

At the moment I am doing:

def start(request):

p = os.spawnlp(os.P_NOWAIT, 'python', 'python', '/Users/acid/Work/
dTorrent/btdownloadheadless',
'/Users/acid/Desktop/Inbox/-{mininova.org}- Professional C+
+.torrent')

t = Torrent.objects.create(pid=p)

return HttpResponse(str(p))

But this is hanging, despite the P_NOWAIT (the Torrent model does get
created).


Any ideas?


--~--~-~--~~~---~--~~
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: Rendering a template to the browser on the fly using an iterator?

2007-07-04 Thread Jeremy Dunck

On 7/4/07, Steve Bergman <[EMAIL PROTECTED]> wrote:

> With iterative rendering (and if the Firefox guys would fix the
> performance issues with large tables) I'd be happy as a clam.

Don't miss Malcolm's caution about middleware, though.

CSRF certainly will cause the problem he warned about.

--~--~-~--~~~---~--~~
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: YUI tags

2007-07-04 Thread Michael Trier

I like it.  Good luck to you and keep us posted on how you progress.

Michael

On 7/4/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote:
>
> I just looked at YUI yesterday and am pretty impressed. What I'm not
> impressed by is how complicated it is to write the markup in HTML for
> things like menus so that they'll work in non-JavaScript environments.
>
> I'm considering trying to develop a yuitags app that would just consist
> of template tags that compartmentalize YUI widgets in a form that would
> make them easy to enter in a Django template. For example, to do a
> menubar, you'd do something like
>
> {% menubar %}
> {% menu %}
> {% menuitem %}Menu One{% endmenuitem %}
> {% menuitem %}Item One.1{% endmenuitem %}
> {% menuitem %}Item One.2{% endmenuitem %}
> {% endmenu %}
> {% menu %}
> etc.
> {% endmenu %}
> {% endmenubar %}
>
> The other thing is that you could include a
>
> {{ yui_links }}
>
> variable in the head section of your base template, and each tag would
> include the imports it would need to be displayed in the context so that
> they'd be loaded automatically.
>
> Does such a thing already exist? If not, is this something people see a
> use for? Any gotchas I'm missing that would make this impossible instead
> of just tricky?
>
> Thanks,
> Todd
>
>
> >
>

--~--~-~--~~~---~--~~
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: Modify Session in TemplateTag?

2007-07-04 Thread rtconner

Gah dumb groups thinking I was quoting something...

del context['request'].session['some key']
sess = SessionMiddleware()
http = HttpResponse()
sess.process_response(context['request'], http)


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



Modify Session in TemplateTag?

2007-07-04 Thread rtconner

So I realize I'm doing something non-standard here, but still I have
my reasons, and if I can pull this off, it'll make life easier for me
in the future.

.. is it possible to save to the Session within a TemplateTag? I don't
really see how it is, but I'm hoping someone knows something that I
don't.

For fun I hacked this together, which *almost* works. For some reason
it does not immediately modify the session, it waits one page load
before making my changes.

(in Node.render)
>del context['request'].session['some key']
>sess = SessionMiddleware()
>http = HttpResponse()
>sess.process_response(context['request'], http)


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