Highlighting Search Results

2006-03-26 Thread bradford

A question came up in #django and I was wondering what the best
solution may be: how to highlight search results.

Here are some possibilities:
1.  Add  in around the returned results
for the searched words in the view.
2.  Template filter
3.  Template tags

Please expand on 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
-~--~~~~--~~--~--~---



Re: Showing admin-style forms on regular user forms?

2006-03-26 Thread shredwheat

This is some amazing work, thank you! I have the magic widgets in my
form now, it was quite simple to do following your work. Looks like I
still need to bless them with some CSS because they are semi rancid
looking. But it all works as needed. Still using the generic
update_object view to generate the form.

As a recap to others. These were the steps I took:

1) add an entry to my site's urlpatterns
(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', {'packages':
'django.conf'}),

2) add the following code to the start of the "form" template page.




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



Re: Memory leak (db connection related?) with apache/postgres and magic-removal

2006-03-26 Thread Alex Brown

Adrian,

Debug is disabled (should have mentioned this) I saw this reported and
was the first thing I tried.

model sent in email.

Regards

Alex


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



Re: RSS Feeds - what am I doing wrong?

2006-03-26 Thread Adrian Holovaty

On 3/24/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> def items(self, obj):
> return submissions.get_list(blog__id__exact = obj.id,
> order_by=('-date_submitted',), limit=5)
> - - - - - - - - - - - - - - - - - - - - - - - -
>
> According to the docs, the RSS framework should be calling my
> "items(self, obj):" method. Unfortunately, it seems to be only looking
> for "items(self)", which isn't there.

Hi Daniel,

This is a subtle one. In Django 0.91, the code in
django.contrib.syndication.feeds traps TypeError, and I suspect one of
the methods in your RSS class is raising a TypeError by mistake that
is being caught (and silently ignored) by the RSS framework.

Try changing the items(self, obj) to return [1, 2, 3], like so:

def items(self, obj):
return [1, 2, 3]

That ensures the method doesn't raise TypeError. If you get the same
error, do the same with the other methods on the RSS class until you
pinpoint the one that's raising TypeError.

By the way, this silent trapping of TypeError was fixed in Django's
development version a while ago, so, if all else fails, just upgrade
to the development (Subversion) version, and you should get a clearer
error. Hope this makes sense!

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

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



Re: Recursive(?) ManyToMany model

2006-03-26 Thread Russell Keith-Magee
On 3/27/06, wam <[EMAIL PROTECTED]> wrote:
class Doc(meta.Model): title = meta.CharField(maxlength=50) contents = meta.TextField() inspired_by = meta.ManyToManyField(Doc) supercedes = meta.ManyToManyField(Doc)I've obviously been having problem with the recursive nature of the
definitions. I saw mention of using 'self' as a special arg forrecursive references in the initializer of a ForeignKey(), butManyToMany() doesn't seem to have this capability. Any suggestions?
As of the 0.91 release, you are correct - 'self' referencing doesn't exist for ManyToMany. This is one (of many) areas that is fixed in the magic-removal development stream. 
For future reference, when referring to another model, you can use either the model name as a python symbol, the model name as a string (useful for forward references), or the string 'self'. In your case, either 'Doc' or 'self' would work.
Magic-removal also has improved model validation code, which will pick up the other problem in your model - multiple references on the same table. You are currently describing two relations on the same table, but not providing a 'related_name' to differentiate between the two. 
Yours,Russ Magee 

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


Re: Memory leak (db connection related?) with apache/postgres and magic-removal

2006-03-26 Thread Adrian Holovaty

On 3/26/06, Alex Brown <[EMAIL PROTECTED]> wrote:
> I have a test script that repeatedly POSTs to a generic_view
> create_object form.
>
> The problem, is that apache's memory usage just goes up and up, and
> never releases.

Hi Alex,

Make sure your DEBUG setting isn't set to True. If it's set to True,
Django will log every database connection in the variable
django.core.db.queries, and that variable is never purged or reset.

If you're not using DEBUG=True, could you give more information, such
as your model?

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

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



Re: ASCII or PDF version of docs?

2006-03-26 Thread Adrian Holovaty

On 3/24/06, Glenn Tenney <[EMAIL PROTECTED]> wrote:
> On Fri, Mar 24, 2006 at 07:45:18PM -0600, James Bennett wrote:
> > Every time you download Django, you get a complete copy of the latest
> > version of the documentation, in ASCII format.
>
> As I've noted on one of the doc pages on the web, that's not quite
> correct...  You don't get all of the model examples -- and some of the
> needed documentation is in the example pages surrounding the actual
> examples.  i.e. you don't get any of the doc at
> http://www.djangoproject.com/documentation/models/

That's incorrect; you do indeed get the model examples. Although it's
not obvious, they're in the directory tests/testapp/models directory
of the Django distribution. The model examples are generated
automatically from the unit tests.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

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



Re: Recursive(?) ManyToMany model

2006-03-26 Thread Malcolm Tredinnick

Hi William,

On Sun, 2006-03-26 at 20:16 -0800, wam wrote:
> I have a model where I will have a pool of documents that will have
> several references to various other documents within the pool. For
> example, I'm trying to do something similar to the following:
> 
> class Doc(meta.Model):
>  title = meta.CharField(maxlength=50)
>  contents = meta.TextField()
>  inspired_by = meta.ManyToManyField(Doc)
>  supercedes = meta.ManyToManyField(Doc)
> 
> I've obviously been having problem with the recursive nature of the
> definitions. I saw mention of using 'self' as a special arg for
> recursive references in the initializer of a ForeignKey(), but
> ManyToMany() doesn't seem to have this capability. Any suggestions?

I may be missing something, but it sounds like you want a one-to-many
(a.k.a. ForeignKey) relationship here. The 'one' side is the "self"
document in each case with links to 'many' other documents. I don't
believe a ManyToMany relationship is necessary here.

Malcolm



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



Re: Memory leak (db connection related?) with apache/postgres and magic-removal

2006-03-26 Thread Ivan Sagalaev

Alex Brown wrote:

>I have a test script that repeatedly POSTs to a generic_view
>create_object form.
>
>The problem, is that apache's memory usage just goes up and up, and
>never releases.
>  
>
It's a feature :-)

With DEBUG = True Django logs all executed SQL statements in db.queries. 
This is them taking up space.

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



Recursive(?) ManyToMany model

2006-03-26 Thread wam

I have a model where I will have a pool of documents that will have
several references to various other documents within the pool. For
example, I'm trying to do something similar to the following:

class Doc(meta.Model):
 title = meta.CharField(maxlength=50)
 contents = meta.TextField()
 inspired_by = meta.ManyToManyField(Doc)
 supercedes = meta.ManyToManyField(Doc)

I've obviously been having problem with the recursive nature of the
definitions. I saw mention of using 'self' as a special arg for
recursive references in the initializer of a ForeignKey(), but
ManyToMany() doesn't seem to have this capability. Any suggestions?

  -- William

P.S. This is my first 'real' Django app I've worked on outside of the
tutorial, so don't be surprised if you hear from me again. :-)


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



Memory leak (db connection related?) with apache/postgres and magic-removal

2006-03-26 Thread Alex Brown

Hi,

I am running django on Windows/apache/mod_python/postgres. I am using
the latest magic-removal branch with the following patches:

(1)
http://code.djangoproject.com/attachment/ticket/1539/magic.querydict.patch
- Solves a multithreading issue with the QueryDict class
(2)
http://code.djangoproject.com/attachment/ticket/1442/magic.threading.2.patch
- Fixes apache crashes with multi-threaded apache setup.

(I also ran the same test this morning with a fresh magic-removal
checkout and the behaviour is the same)

I have a test script that repeatedly POSTs to a generic_view
create_object form.

The problem, is that apache's memory usage just goes up and up, and
never releases.

When django serves views that do not interact with the database,
apache's memory usage is 100% constant.

So I am guessing that the database connections are not being
released/closed correctly ?

Is this a known issue, anyone have any ideas ?

Thanks

Alex


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



Re: customised generic view

2006-03-26 Thread lawgon

>
> Hello,
>
> what I am trying to do since this morning is to allow my logged in user
> to create Members. As you will see below Member is related to the User
> class by a foreignkey.

convention is to use OneToOneField

kg


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



Re: Assigning default value for field in admin

2006-03-26 Thread tonemcd

This looks like it might help,
http://lukeplant.me.uk/blog.php?id=1107301634 although it's not exactly
what you're after...

Cheers,
Tone


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



Re: Showing admin-style forms on regular user forms?

2006-03-26 Thread tonemcd

Check this out -
http://groups.google.com/group/django-users/browse_frm/thread/3328829f1ed7f788/a980f983c5fc1bad

It's very rushed, as I was on the way to the airport and just wanted to
get the post made before I forgot it, but it does work...

Cheers,
Tone


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



Re: customised generic view

2006-03-26 Thread limodou

On 3/27/06, yml <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> what I am trying to do since this morning is to allow my logged in user
> to create Members. As you will see below Member is related to the User
> class by a foreignkey.
> so far I create User, Member using generic view. What I would like to
> do is to remove the user field from the form: "members_form". And this
> is where I am stuck.
> since the user attribute is mandatory for a member.
>
> here it is an abstract of my model:
>
> class Member(meta.Model):
> user =meta.ForeignKey(User)
> pseudo = meta.CharField(maxlength=30,core=True)
> gender=
> meta.ForeignKey(Gender,radio_admin=True,null=True,blank=True)
> address = meta.TextField(maxlength=300,null=True,blank=True)
> phonenumber = meta.CharField(maxlength=10,null=True,blank=True)
> want_to_publised_personal_info = meta.BooleanField()
> #photo = meta.ImageField(upload_to="memberPhoto",null=True)
> localisation =
> meta.ManyToManyField(Localisation,null=True,blank=True,filter_interface=meta.HORIZONTAL)
> memberShipLevel = meta.ForeignKey(Membership,radio_admin=True)
> def __repr__(self):
> return self.pseudo
> class META:
> admin = meta.Admin(
> fields = (
> ('General information',{'fields':
> ('user','localisation')}),
> ('Online information',{'fields':
> ('pseudo','memberShipLevel','want_to_publised_personal_info')}),
> ('Optional information',{'fields':
> ('gender','address','phonenumber')}),
> ),
> list_display =
> ('user','pseudo','want_to_publised_personal_info','phonenumber'),
> ordering = ['pseudo'],
> )
>
>
> so far I am calling my generic view from urls.py like this:
> (r'^members/create/?$',
> 'django.views.generic.create_update.create_object',
> dict(info_dict_members, post_save_redirect="/members/") ),
>
>
> I hope that someone is going to take some times to help me.
>
> thank you
>
> PS: thank you to the authors of django for open sourcing this
> beautifull tool.
>

I think if you don't want to user field in Manipulator you can easily
delete it, just like:

m = model.AddManipulator or model.Changemanipulator(object_id)
del m['user']

But because you are using generic_view, and manipulator is created in
the function, so I think there is no way to do like above. So I think
you had to create a custom manipulator to do that, it's better.

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

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



Re: Showing admin-style forms on regular user forms?

2006-03-26 Thread James Bennett

On 3/26/06, shredwheat <[EMAIL PROTECTED]> wrote:
> I'm just getting started with Django. Went through the tutorials for
> getting a simple form and validation on the user site. I have a time
> and date field shown, but they are plain text entry form widgets. I was
> hoping they would be all decorated out like the time and date fields on
> the admin pages.

No, the JavaScript that does that is currently coupled to other
JavaScript stuff used in the admin. I'm working on porting all of our
JavaScript to the Dojo toolkit, and one of my goals is to make things
like the fancy admin date/time widgets more easily reusable, but I
don't have any kind of timeframe on when that will hit trunk.

> Is it possible to just use one of the admin generic views anywhere in
> the site?

You'd probably have to hack on them a bit.


--
"May the forces of evil become confused on the way to your house."
  -- George Carlin

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



Showing admin-style forms on regular user forms?

2006-03-26 Thread shredwheat

I'm just getting started with Django. Went through the tutorials for
getting a simple form and validation on the user site. I have a time
and date field shown, but they are plain text entry form widgets. I was
hoping they would be all decorated out like the time and date fields on
the admin pages.

Is it possible to just use one of the admin generic views anywhere in
the site?


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



Mixing with Mailman?

2006-03-26 Thread shredwheat

I'm planning the development of a site that will have several
integreated mailing lists. I think Django and Mailman could be a good
mix for this. After some intitial browsing it doesn't look hard to
import the Mailman package and start querying/setting from Python.

Has anyone travelled this road before? Are there any links of this
nature?


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



Re: Extreme file uploading

2006-03-26 Thread Istvan

Great patch Ivan,

This issue is of great importance as it is one of those oversights that
separates a "cool toy" from a reliable "work horse".


Istvan


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



Re: limit_choices_to

2006-03-26 Thread tonemcd

I think that this http://lukeplant.me.uk/blog.php?id=1107301634 might
be helpful. There's also been some traffic on limit_choices_to in the
group recently (although not strictly relevent to your problem I think)

Cheers,
Tone


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



limit_choices_to

2006-03-26 Thread yml

Hello,

Is there someone kind enought to provide me some guidance on the usage
of "limit_choices_to" in a foreign key?

my model look like this:

class Profile(meta.Model):
user =meta.ForeignKey(User)
pseudo = meta.CharField(maxlength=30,core=True)
[...]
def __repr__(self):
return self.pseudo
class META:
admin = meta.Admin()
class Announce(meta.Model):
titre = meta.CharField(maxlength=30)
[...]
profile =meta.ForeignKey(Profile, limit_choices_to={'user__exact' :
meta.LazyDate()})
def __repr__(self):
return self.titre
class META:
admin = meta.Admin( )

The User is the regular django.models.auth class. I would like to
filter the Profiles on the attribute user. the objective it display
only the profiles of the logged in user.

I found that it should look like somelike this:

profile =meta.ForeignKey(Profile,
limit_choices_to={'user__exact'=##?the curentuser?## :
meta.LazyDate()})

It would be great if someone can help me to complete my dict.
thank you


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



Re: Get current user ID in _pre_save() function

2006-03-26 Thread Gacha

I solved this problem by this patch:
http://code.djangoproject.com/attachment/ticket/1132/current_user_field_patch.2.diff

Now I use:
author  = meta.CurrentUserField(update_on_edit=False)

--
But the problem about User management is not solved :(


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