Re: MySQL backend patch

2006-08-31 Thread [EMAIL PROTECTED]

I think, unfortunately, two branches is the way to go (<=4.1 and 5.0<=)
- there are hosts out there who still provide 3.28, Debian sarge is
4.0.2. So - I guess the question is - what version of MySQL does
Django's backend work with at the moment.

I'm running the patch right now, and haven't seen any issues with a
quick play (5.0.24 on OSX).

I do like the fact that it sets ANSI,TRADITIONAL. 

--Simon


--~--~-~--~~~---~--~~
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: why 'default' filter does't work?

2006-08-31 Thread HoLin
Thank you for your reply. 
I think 'default' filter is not useful to me now. :(, I must add 'act' variable explicitly.
 
 
On 9/1/06, SmileyChris <[EMAIL PROTECTED]> wrote:
Hi HoLin,I encountered that same problem - the functionality changed in [3268]so that filters aren't used if the variable is not found.
I think this is incorrect and will bring it up in the developers groupnow.-- RegardsHoLin 

--~--~-~--~~~---~--~~
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: python manage.py syncdb fails with assertion error

2006-08-31 Thread billybob

python 2.3.1  (mod_python 3.2.10)
Django 0.95
Apache 2.2.3
mysql 4.0.20

bad RAM is possible, but this is the only funny thing happening on the
box.  Is it possibly a MySQL issue?  thanks for any help or
suggestions.


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



Making sure a user has checked a checkbox ?

2006-08-31 Thread [EMAIL PROTECTED]

I am trying to implement the common use case of a form with an "I agree
to these terms" checkbox.
I'm not that interested in having that field in my model, so I create
my own Manipulator, define the fields I want in the form (with the
checkbox), then do validation against that Manipulator.
If that works out okay, I convert from the custom Manipulator to the
various Models where data will be stored (violating DRY here, I know,
but it seemed like good solution).

The problem I have is with simply validating that the checkbox is
checked.
I represent it as a forms.CheckboxField, with a custom validator
function, but this only seems to run when the checkbox is checked on
the form.
This makes sense considering how forms only exist in the POST data when
they are active, but I still want to handle this sanely within a
manipulator, so I can return the usual FormWrapper object to the
template.

I trid the "magic name" validate_ pattern, didn't seem to
work, and searched the newsgroups for some answers, but nothing
concrete came up.
I may be ignoring the obvious here, but it would be most kind of anyone
to point it out to me.

On an ending note, I would just say that I very much enjoy Django,
although documentation could be better (especially on "advanced" forms)

Here comes a paste of my Manipulator (formatting might be eaten by
processing),
the point is I would like to run the validator even if the checkbox is
not checked (or another solution with same result).
---
class CreateAccountManipulator(forms.Manipulator):
def __init__(self):
self.fields = (

forms.TextField(field_name="fornavn",maxlength=100,is_required=True),

forms.TextField(field_name="etternavn",maxlength=100,is_required=True),
forms.TextField(field_name="firma",maxlength=100),

forms.TextField(field_name="adresse",maxlength=100,is_required=True),
forms.IntegerField(field_name="postnr",is_required=True),

forms.TextField(field_name="poststed",is_required=True,maxlength=100),
forms.IntegerField(field_name="mobilnr",is_required=True),
forms.EmailField(field_name="epost",is_required=True),

forms.SelectField(field_name="select",choices=PAYMENT_PLANS),

forms.SelectField(field_name="invoicetype",choices=PAY_METHOD),

forms.CheckboxField(field_name="conditions_approve",validator_list=[self.validate_conditions_approve])
)

def validate_conditions_approve(self, data, form):
   if not data == "on": #See note
raise validators.ValidationError("Checkbox must be
checked")

note: Is this a way of checking for checked ? see
forms.CheckboxField.html2python


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



Re: Django deployment tools?

2006-08-31 Thread gabor

[EMAIL PROTECTED] wrote:
> Joseph Heck wrote:
>> Have you used it for your own deploys? I'm curious how well it worked for
>> you.
> 
> I looked at it, but decided to roll my own tools for now.  
> 

hi... could you tell us what kind of tools did you write?

because i'm also at a similar situation,
and planning to write some python scripts to do something like:

1. checkout a specific version of the source code on the webserver from svn
2. adjust some symlinks
3. restart stuff
4. etc :)

did you find some usable libraries?
or just executed 'ssh bla' calls?

or did you do something completely different?

gabor

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



Re: Two ForeignKeys to the Same Model

2006-08-31 Thread alex kessinger

I anwserd my own question, it was in the examples section

http://www.djangoproject.com/documentation/models/m2o_recursive2/

--~--~-~--~~~---~--~~
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: Two ForeignKeys to the Same Model

2006-08-31 Thread alex kessinger

I'm sorry Rob  I didn't see that you had posted the same anwser thanks.

On 8/31/06, alex kessinger <[EMAIL PROTECTED]> wrote:
> I anwserd my own question, it was in the examples section
>
> http://www.djangoproject.com/documentation/models/m2o_recursive2/
>

--~--~-~--~~~---~--~~
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: Two ForeignKeys to the Same Model

2006-08-31 Thread Rob Hudson

Would that be a self join?
http://www.djangoproject.com/documentation/models/m2o_recursive/


--~--~-~--~~~---~--~~
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: why 'default' filter does't work?

2006-08-31 Thread SmileyChris

Hi HoLin,

I encountered that same problem - the functionality changed in [3268]
so that filters aren't used if the variable is not found.

I think this is incorrect and will bring it up in the developers group
now.


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



Re: django cannot connect to mysql after upgrade

2006-08-31 Thread Andy Dustman

MySQL-5.0.24 accidentally introduced an ABI-incompatibilty, which
caused the "Commands out of sync" error; MySQL-5.0.24a fixes this.

-- 
This message has been scanned for memes and
dangerous content by MindScanner, and is
believed to be unclean.

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



Two ForeignKeys to the Same Model

2006-08-31 Thread alex kessinger

I have a model named producer

class Producer(models.Model):
student = models.ForeignKey(Student)
pu = models.IntegerField(blank=True)


and producer can pay each other PU so I have another model that I want to create
I use two different producer cols to do this
class ProducerToProducerPayment(models.Model):
producer1 = models.ForeignKey(Producer)
producer2 = models.ForeignKey(Producer)
pu = models.IntegerField()

class Admin:
pass

def __str__(self):
return self.producer1 + ' pays ' + self.pu + ' to ' + 
self.producer2

but I get an error when I sync the DB does anyone know of way to do this?

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



Re: Advanced Admin Customization

2006-08-31 Thread Chris Long


> Oh, I see where you're going with it. Just hide the interface from the
> user. That's a great idea, I still need a way though to enforce it so
> that carefully crafted POST requests don't allow unauthorized users
> from breaking things.

That's true, maybe using the custom manipulator would handle that, but
I'm not so sure. Possible a combination of the two methods would work,
either save and template or manipulator and template. Either method
works, more just style then anything else.

>
> That was my first pass. I subclassed models.IntegerField and overroad
> get_manipulator_field_objs, and return my custom Form. However, when
> running syncdb I still got a KeyError.
>
> I think that there is a dict somewhere that maps models to their sql
> implementation and that my model doesn't exist in that dict, hence a
> KeyError. But that's really just a guess. I'd love to hear from an
> authority about where the sql structure of a model is defined.

When I get a moment later this evening, I'll dive into the DB code and
see what else I can find. From the top of my head, I don't think there
is anything, but I might be wrong...when I've been exploring the DB
code I haven't looked for anything along those lines. Maybe pastebin
the code and the trace and I can offer some more help.

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



Re: Advanced Admin Customization

2006-08-31 Thread mthorley

Chris Long wrote:
> Maybe, but if you do it in the template then it won't even show the
> option to the user and you'll avoid the trouble of getting the error
> from the save method to be displayed to the user.

Oh, I see where you're going with it. Just hide the interface from the
user. That's a great idea, I still need a way though to enforce it so
that carefully crafted POST requests don't allow unauthorized users
from breaking things.

> If all you're using is an Integer, then I'd suggest just subclass the
> integer field and leave most of it the same as it is and only override
> the part where it returns the form field. Should avoid a lot of
> trouble.

That was my first pass. I subclassed models.IntegerField and overroad
get_manipulator_field_objs, and return my custom Form. However, when
running syncdb I still got a KeyError.

I think that there is a dict somewhere that maps models to their sql
implementation and that my model doesn't exist in that dict, hence a
KeyError. But that's really just a guess. I'd love to hear from an
authority about where the sql structure of a model is defined.

Thanks again Chris, you're thoughts have really helped
--
mthorley


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



Possible to collapse an inlined model?

2006-08-31 Thread Rob Hudson

It looks like you can collapse a group of fields on a model, but can
you collapse a joined model that you are inlining?  I don't see how you
can do that.

Thanks,
Rob


--~--~-~--~~~---~--~~
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: Advanced Admin Customization

2006-08-31 Thread Chris Long


> Thanks, that's a neat trick, though from the surface I'm not 100% sure
> it will do what I'm thinking. I'll have to investigate further. My
> intuition tells me I need to do the checks in the model, maybe with a
> save hook, not in the template; but I may be off on that.

Maybe, but if you do it in the template then it won't even show the
option to the user and you'll avoid the trouble of getting the error
from the save method to be displayed to the user.

>
> I am currently trying option 2, which is not as difficult as I thought
> it might be, thought I have gotten stuck.
>
> I've created a new field that subclasses models.Field, and a new form
> that subclasses forms.formField, both seem correct (at lest the models
> doesn't throw any errors when starting the server), however when I try
> manage.py syncdb appname, the manager errors: KeyError: "MyBitField"
>
> Does any one know where you include that code does the db creation
> stuff?
>

If all you're using is an Integer, then I'd suggest just subclass the
integer field and leave most of it the same as it is and only override
the part where it returns the form field. Should avoid a lot of
trouble.

Cheers,

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



Re: Advanced Admin Customization

2006-08-31 Thread mthorley


Chris Long wrote:
> For the permission checking, See: 
> http://code.djangoproject.com/wiki/ExtendingAdminTemplates for more

Thanks, that's a neat trick, though from the surface I'm not 100% sure
it will do what I'm thinking. I'll have to investigate further. My
intuition tells me I need to do the checks in the model, maybe with a
save hook, not in the template; but I may be off on that.

> As for the second part, there are two possible routes...
> 1) Override the default change/add manipulator for the model...
> 2) Create a new field in the model that replaces the integer field you
> are currently using...

I am currently trying option 2, which is not as difficult as I thought
it might be, thought I have gotten stuck.

I've created a new field that subclasses models.Field, and a new form
that subclasses forms.formField, both seem correct (at lest the models
doesn't throw any errors when starting the server), however when I try
manage.py syncdb appname, the manager errors: KeyError: "MyBitField"

Does any one know where you include that code does the db creation
stuff?

Thanks again Chris.
--
mthorley


--~--~-~--~~~---~--~~
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: Are there significant differences between .95 & .96?

2006-08-31 Thread keukaman


Adrian Holovaty wrote:
> On 8/30/06, keukaman <[EMAIL PROTECTED]> wrote:
> > Somewhere in this process my flatpages middleware stopped working. I
> > was getting a python error when trying to access flatpages. I don't
> > know if something was corrupted of if .96 handles flatpages
> > differently. If anyone can shed some light on this, I would appreciate
> > it.
>
> I can't think of anything that would have broken this, except maybe
> this small change:
>
> http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Databaseconstraintnameschanged
>
> Could you post the Python traceback you're getting?
>
> Adrian
>
> --
> Adrian Holovaty
> holovaty.com | djangoproject.com
Unfortunately, I made the mistake of not saving the traceback. If I see
it again I'll forward it to you. Rookie mistake.


--~--~-~--~~~---~--~~
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: MySQL backend patch

2006-08-31 Thread Waylan Limberg

On 8/31/06, Geert Vanderkelen <[EMAIL PROTECTED]> wrote:
>
>
> There is already some migration going on from 4.x to 5.0, so I think
> we should go for 5.0 as 'default' backend. But that is just my opinion.

Just remember that all those shared hosting companies are very slow to
migrate at all. I'd hate to see something that greatly limits the
ability for people to use django just because they can't afford/don't
need top of the line hosting.


-- 

Waylan Limberg
[EMAIL PROTECTED]

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



Re: Is Django the right tool?

2006-08-31 Thread Jeremy Dunck

On 8/31/06, brad <[EMAIL PROTECTED]> wrote:
>
> Thanks for the input Bryan and Adrian. I have to agree and say that
> Django could be an asset to this project. Bryan or anyone else could
> you name a few useful packages that will help me scrape the prices from
> the list of websites that I have? Thanks in advanced for any future
> help I get. Thank you.

Have a look at ElementSoup:
http://effbot.org/zone/element-soup.htm

...If you run into bugs (it's quite a new package), you can switch to
BeautifulSoup, the underlying parser.

--~--~-~--~~~---~--~~
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: MySQL backend patch

2006-08-31 Thread Geert Vanderkelen

Hi Andy,

On 31 Aug 2006, at 19:40, Andy Dustman wrote:

>
> I've come up with a patch to the MySQL backend. If you use MySQL,
> please check it out.
>
> http://code.djangoproject.com/ticket/2635
>
> One of the issues to resolve is: What is the minimum version of MySQL
> which Django should support? I am doing all my development with 5.0,
> and the early deployment I have so far is on 4.1, but I haven't tested
> the patch against 4.1 yet.  Does anyone use anything older than 4.1?
> Should this be a MySQL-5.0-specific backend and the existing one left
> alone, i.e. make this one mysql5? Please discuss on this thread.

I'm not fan starting making different versions of it, but it might  
make sense due to big differences.

But MySQL 4.0 is reaching it's end-of-life, and so is 4.1 soon. I  
know that doesn't mean it is going to disappear anytime soon, but..

I'd rather see these backend naming then:
- mysql: for MySQL 4.1 and 5.0 and higher..
- mysql4: for MySQL 4.0 and 4.1

There is already some migration going on from 4.x to 5.0, so I think  
we should go for 5.0 as 'default' backend. But that is just my opinion.
MySQL 4.1 is like the thing between.. So I guess we could make both  
'mysql' and 'mysql4' 4.1 compatible, or?

Just looking into the future, when for example MySQL 6.0 comes out,  
it will be more compatible with 5.x series than 4.0 was with the 5.0  
version. Well, that's what I hope :)

If you need more of my help or info, let me know. Patch looks good to  
me, will put more time in when I get back next week.

Cheers,

Geert

-- 
Geert Vanderkelen
http://some-abstract-type.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: Advanced Admin Customization

2006-08-31 Thread Chris Long

Howdy,

For the permission checking, you could override the admin template and
add auth checking in there for the various permissions you want to
check for. See:
http://code.djangoproject.com/wiki/ExtendingAdminTemplates for more
details on this. And in the auth documents there is info on how to
access permissions in the templates.

As for the second part, there are two possible routes off the top of my
head. Neither of which I have tried or have any idea if they will work,
maybe someone else can validate these. From experience, they both
should work.

1) Override the default change/add manipulator for the model. E.g.
Class Object(Models):
ChangeManipulator = NewAddManipulator
Therefore you can select the fields you want and how you want them.
Including any processing of the data. I guess you could also do the
permission checking for fields here, but it might not be the best spot.

2) Create a new field in the model that replaces the integer field you
are currently using, in this new field you can override the method
get_manipulator_field_objs to return the field object you want for
this. See django.db.models.fields for the existing fields.

Hope that helps,

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



Re: Is Django the right tool?

2006-08-31 Thread brad

Thanks for the input Bryan and Adrian. I have to agree and say that
Django could be an asset to this project. Bryan or anyone else could
you name a few useful packages that will help me scrape the prices from
the list of websites that I have? Thanks in advanced for any future
help I get. 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: Confirmation email during user registration?

2006-08-31 Thread Iwan Memruk
Thanks zenx!I've just passed my 'aha!' stage of Django learning, and I somehow got to know how to do that thing and many other things too. In fact, I feel like I can do anything with Django now. :)
On 8/31/06, zenx <[EMAIL PROTECTED]> wrote:
Iwan, take a look at this too:http://feh.holsman.net/articles/2006/04/30/double-opt-in-user-registration-for-django
http://feh.holsman.net/articles/2005/11/20/user-registrationInstead of requiring a verification e-mail, it firsts sends the user an
e-mail that includes a link for continuing the registration, asLJWorld.com does.Hope it helps ;)-- Iwan

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


Re: Django deployment tools?

2006-08-31 Thread Rob Hudson

It looks like there was some work done with the django.conf.settings to
make it more paste friendly:

http://code.djangoproject.com/ticket/1212
http://code.djangoproject.com/ticket/1214

There's also Django Paste that I found:
http://pythonpaste.org/djangopaste/
Which doesn't appear to be up to date since it references those two
tickets as outstanding when they've been closed since around Jan/Feb
2006.

Paste looks more like a framework to combine multiple web frameworks
than a deployment tool, or am I missing something here?

Googling Django and Paste shows a lot of people excited about it.  So
there must be something cool about it, right?  :)


--~--~-~--~~~---~--~~
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: Custom SQL in Q objects

2006-08-31 Thread Luke Plant

On Thursday 31 August 2006 14:03, bk wrote:
> class CategoryPhoto(models.Model):
>   category = models.ForeingKey(Category, edit_inline=models.Tabular)
>   position = models.PositiveIntegerField(core=True)
>   photo = models.ForeignKey(Photo, limit_choices_to={'category__pk':
> ???})
>
> ??? is where I basically want to use the id of the current category
> being edited to limit the photo choices to those set for that
> category - since there's over 100 records in the db so far.
>
> Any chance this would be possible with a similar Q class?

I don't think this will be possible, if I understand correctly. 
The 'limit_choices_to' parameter simply alters the query that is used 
to get the list of photos used to populate the drop down list.  This 
query is completely independent of which CategoryPhoto is being 
edited - in fact, when adding a CategoryPhoto object (as opposed to 
editing), the object doesn't even exist in the database, but the photo 
drop down still needs to be populated.

The only way I can recommend is to add some AJAX that responds to 
changes to the category drop and repopulates the photo drop down 
accordingly.  Thankfully this should be pretty easy using the 'js' 
admin option.

Luke

-- 
"Pessimism: Every dark cloud has a silver lining, but lightning kills 
hundreds of people each year trying to find it." (despair.com)

Luke Plant || L.Plant.98 (at) cantab.net || http://lukeplant.me.uk/

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



Re: How do I make something available everywhere?

2006-08-31 Thread [EMAIL PROTECTED]

Ahh, it gets compiled when it's called. Duh. 

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: Confirmation email during user registration?

2006-08-31 Thread zenx

Iwan, take a look at this too:
http://feh.holsman.net/articles/2006/04/30/double-opt-in-user-registration-for-django
http://feh.holsman.net/articles/2005/11/20/user-registration

Instead of requiring a verification e-mail, it firsts sends the user an
e-mail that includes a link for continuing the registration, as
LJWorld.com does.

Hope it helps ;)


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



Re: why 'default' filter does't work?

2006-08-31 Thread Don Arbow

On Aug 31, 2006, at 9:43 AM, Don Arbow wrote:

> The two tags are not comparable in functionality.


Oops, that should actually read:

The two filters are not comparable in functionality.

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



Re: A few questions about queryset's.

2006-08-31 Thread Anders Aagaard


Steven Armstrong wrote:
> On 08/31/06 17:22, Anders Aagaard wrote:
> > Hi
> >
> > I've been learning to love django lately, but I can't quite wrap my
> > head around more advanced querysets.  I've listed my classes and their
> > sql tables on the bottom, as all problems are linked to those tables.
> >
> > First problem:
> > I have a class, Content, with a set of tags,  how can I filter for
> > multiple tags?
> > If I do:
> > list = Content.objects.filter(tag__id=1).filter(tag__id=2) it makes a
> > sql query asking content_content_tags for content_id's where tag_id = 1
> > and tag_id = 2, which will of course never match.
> >
>
> Something like this should work:
>
> mylist = Content.objects.filter(tag_id__range=(1,2,3,4,5))
>
> or:
>
> from django.db.models import Q
> mylist = Content.objects.filter(Q(tag_id=1) | Q(tag_id=2))

Your misunderstanding me, I dont want to browse objects with tag A OR
B, I want tag A AND B in this example.

What I thought would work:
#a = Content.objects
#b = a.filter(tags__id = 8)
#print b[0].tags.values()
[{'id': 3, 'name': 'TestTag'}]
#b.filter(tags__id = 3)
[]

Why doesn't the b.filter return b[0]?  Which does have that tag?

>
>
> > What I'd like to do is something like:
> > for tag in request.GET.getlist('tag')
> > content = content.filter('match this tag too')
> >
> >
> >
> > Second problem:
> > I've looked at complex_filter for doing this and I can't quite figure
> > it out.
> > What if I wanted something like this:
> > content.objects.filter(id__id=1) | content.objects.filter(id__id=2)
> > But I needed to match a dynamic list of id's.  How could I do something
> > like
> >
> > content = content.objects.filter(content=example)
> > for match in id_list:
> > content = content.objects.filter(id__id=match) #And here get a logical
> > OR comparison with the previus part of the loop.
> > So this would produce the same effect as:
> > content.objects.filter(id__id=id_list[0]) |
> > content.objects.filter(id__id=id_list[1])
> >
>
> from django.db.models import Q
> query = Q(tag_id=1)
> for the_tag_id in (2,5,6,8,9):
>  query = query | Q(tag_id=the_tag_id)
> mylist = Content.objects.filter(query)

Ahh!  So logical and clean, thanks a ton!

>
> Be careful with your use of the the double underscore __
> It has special meaning in djangoland.

Yeah, of course it'd be id=id_list[0], things tend to get tangled when
I try to sort this in my head ;)

> 
> Have a look at
> http://www.djangoproject.com/documentation/db_api/


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



Re: How do I make something available everywhere?

2006-08-31 Thread Jeremy Dunck

On 8/31/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> No matter what I try, nothing in the templatetag folder seems to want
> to compile.

Assuming
"
import amazon
"
works, does
"
from amazon.templatetags import amazon
"
work?

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



MySQL backend patch

2006-08-31 Thread Andy Dustman

I've come up with a patch to the MySQL backend. If you use MySQL,
please check it out.

http://code.djangoproject.com/ticket/2635

One of the issues to resolve is: What is the minimum version of MySQL
which Django should support? I am doing all my development with 5.0,
and the early deployment I have so far is on 4.1, but I haven't tested
the patch against 4.1 yet.  Does anyone use anything older than 4.1?
Should this be a MySQL-5.0-specific backend and the existing one left
alone, i.e. make this one mysql5? Please discuss on this thread.

-- 
This message has been scanned for memes and
dangerous content by MindScanner, and is
believed to be unclean.

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



Advanced Admin Customization

2006-08-31 Thread mthorley

Greetings,

I am trying to do a few advanced (from my point of view) customizations
to the built in admin. I have searched around but haven't found the
answers I'm looking for. If any one can help, or point me to a resource
that can, I'd be forever greatful. (or at least really grateful ;)

More Elaborate Permissions Handling
==
I've already setup and customized the basic permisions, but now I need
to be more elaborate. Rather than allowning read/write to whole
records, I need to limit access to specific attributes.

For example: any user can add a new blog post, but only users in group
X can toggle the 'publish' bit on any blog post and only users in group
Z can delete a post.

Are there hooks for individual fields, or at least saving, that will
allow me to enforce my own permission checks?

Custom fields
===
I also need to create my own custom field. In one of my models I have a
integer where each bit stands for an action. Similar to the unix
permissions system. i.e. chmod 640 user: r/w, group r, other 0

Rather than display this as a text box. I want to create a field with a
series of check boxes to turn each bit on or off. I dug around in the
source but got stuck. It would be nice too, if I can do this with add
modifying the orginal source.

Thanks much for anythoughts or help on these.
--
mthorley


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



Re: How do I make something available everywhere?

2006-08-31 Thread [EMAIL PROTECTED]

Is there a trick to making the templatetag files compile?

I have

amazon
>__init__.py
>__init__.pyc
>templatetags
>> amazon.py
>>__init__.py

No matter what I try, nothing in the templatetag folder seems to want
to compile.


--~--~-~--~~~---~--~~
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: Is Django the right tool?

2006-08-31 Thread Bryan

I use several web frameworks and will fairly say that Django is the
best tool for this because of the python packages you will find to help
you scrape the prices from those existing sites.

Good luck,

Bryan

brad wrote:
> Hello. I am wondering right now whether Django will help speed up my
> project and help me  or whether Django isn't the best tool in this
> situation. My project involves a web application that grabs thousands
> of prices, quantities and product names from a handful of predefined
> sites. The application runs hourly, therefore the database is updated
> hourly. Now the webpage that users can access the database from is
> composed of four Ajax drop down menus and one Ajax table--the table
> contains the prices, links, product name, etc. I am very knew to
> Django, so I am not sure whether it will be an asset for my project, or
> will installing Django mean that I am installing a lot of dead weight
> into my project. For example, I know that Django is very good when it
> comes to news web sites or for sites that depend on its users' input.


--~--~-~--~~~---~--~~
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: why 'default' filter does't work?

2006-08-31 Thread HoLin
Don,thanks for your reply.
 
'/z/catalog/{{ act|default:"new"}}/' worked well before I update svn.
in view, i do like this: 
return render_to_response("siteadmin/bid_new.html", {"act":"edit", "title":"edit bid",})
when it's new bid, I return
render_to_response("siteadmin/bid_new.html") 
On 9/1/06, Don Arbow <[EMAIL PROTECTED]> wrote:
On Aug 31, 2006, at 8:20 AM, HoLin wrote:> the code   /z/catalog/{{ act|default:"new" }}/  works well before i
> get the> latest svn trunk.> I try to replace it like this  /z/catalog/{{ act|> default_if_none:"new" }}/,> it also returns blank.> Does someone know how?The two tags are not comparable in functionality.
What is the value of 'act'? If it's an empty string, that's whatwould be returned. Remember, an empty string is not the same as None.The 'default' tag works differently as it compares the given value to
true/false. An empty string would cause the default value to bereturned.Don-- RegardsHoLin 

--~--~-~--~~~---~--~~
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: A few questions about queryset's.

2006-08-31 Thread Steven Armstrong

On 08/31/06 17:22, Anders Aagaard wrote:
> Hi
> 
> I've been learning to love django lately, but I can't quite wrap my
> head around more advanced querysets.  I've listed my classes and their
> sql tables on the bottom, as all problems are linked to those tables.
> 
> First problem:
> I have a class, Content, with a set of tags,  how can I filter for
> multiple tags?
> If I do:
> list = Content.objects.filter(tag__id=1).filter(tag__id=2) it makes a
> sql query asking content_content_tags for content_id's where tag_id = 1
> and tag_id = 2, which will of course never match.
> 

Something like this should work:

mylist = Content.objects.filter(tag_id__range=(1,2,3,4,5))

or:

from django.db.models import Q
mylist = Content.objects.filter(Q(tag_id=1) | Q(tag_id=2))


> What I'd like to do is something like:
> for tag in request.GET.getlist('tag')
>   content = content.filter('match this tag too')
> 
> 
> 
> Second problem:
> I've looked at complex_filter for doing this and I can't quite figure
> it out.
> What if I wanted something like this:
> content.objects.filter(id__id=1) | content.objects.filter(id__id=2)
> But I needed to match a dynamic list of id's.  How could I do something
> like
> 
> content = content.objects.filter(content=example)
> for match in id_list:
>   content = content.objects.filter(id__id=match) #And here get a logical
> OR comparison with the previus part of the loop.
> So this would produce the same effect as:
> content.objects.filter(id__id=id_list[0]) |
> content.objects.filter(id__id=id_list[1])
> 

from django.db.models import Q
query = Q(tag_id=1)
for the_tag_id in (2,5,6,8,9):
 query = query | Q(tag_id=the_tag_id)
mylist = Content.objects.filter(query)

Be careful with your use of the the double underscore __
It has special meaning in djangoland.

Have a look at
http://www.djangoproject.com/documentation/db_api/



--~--~-~--~~~---~--~~
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: Is Django the right tool?

2006-08-31 Thread Adrian Holovaty

On 8/31/06, brad <[EMAIL PROTECTED]> wrote:
> Hello. I am wondering right now whether Django will help speed up my
> project and help me  or whether Django isn't the best tool in this
> situation. My project involves a web application that grabs thousands
> of prices, quantities and product names from a handful of predefined
> sites. The application runs hourly, therefore the database is updated
> hourly. Now the webpage that users can access the database from is
> composed of four Ajax drop down menus and one Ajax table--the table
> contains the prices, links, product name, etc.

Yes, I think it would be appropriate for your project. But rather than
asking a bunch of clearly biased developers (who are already using and
enjoying Django), why not just give it a shot for yourself to see how
you like it?

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: Signals

2006-08-31 Thread Tyson Tate

On Aug 31, 2006, at 8:54 AM, David Blewett wrote:

> I know that I want to make use of signals in my project. I'm not sure
> how to use them, though. It appears that the handling function has to
> have arguments like this: sender, instance, signal, *args, **kwargs.
> Can someone define these arguments?

I tried to document signals a bit on the wiki:

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

However, because there's no official documentation (that I know of),  
what's on the wiki is incomplete and potentially inaccurate. I've  
used signals without any problems, however, so it should be a good  
starting point.

See also Ian's article on signals here:

http://feh.holsman.net/articles/2006/06/13/django-signals

-Tyson

--~--~-~--~~~---~--~~
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: why 'default' filter does't work?

2006-08-31 Thread Don Arbow

On Aug 31, 2006, at 8:20 AM, HoLin wrote:
> the code   /z/catalog/{{ act|default:"new" }}/  works well before i  
> get the
> latest svn trunk.
> I try to replace it like this  /z/catalog/{{ act| 
> default_if_none:"new" }}/,
> it also returns blank.
> Does someone know how?


The two tags are not comparable in functionality.

What is the value of 'act'? If it's an empty string, that's what  
would be returned. Remember, an empty string is not the same as None.

The 'default' tag works differently as it compares the given value to  
true/false. An empty string would cause the default value to be  
returned.

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



Is Django the right tool?

2006-08-31 Thread brad

Hello. I am wondering right now whether Django will help speed up my
project and help me  or whether Django isn't the best tool in this
situation. My project involves a web application that grabs thousands
of prices, quantities and product names from a handful of predefined
sites. The application runs hourly, therefore the database is updated
hourly. Now the webpage that users can access the database from is
composed of four Ajax drop down menus and one Ajax table--the table
contains the prices, links, product name, etc. I am very knew to
Django, so I am not sure whether it will be an asset for my project, or
will installing Django mean that I am installing a lot of dead weight
into my project. For example, I know that Django is very good when it
comes to news web sites or for sites that depend on its users' input.


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



Signals

2006-08-31 Thread David Blewett

Hi All:

I know that I want to make use of signals in my project. I'm not sure
how to use them, though. It appears that the handling function has to
have arguments like this: sender, instance, signal, *args, **kwargs.
Can someone define these arguments?

Basically, I want to hook into the post_save signal of several
different objects (User, ContentType, etc). Any help is appreciated!

David Blewett


--~--~-~--~~~---~--~~
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: Re: Django + XUL

2006-08-31 Thread Jeremy Dunck

On 8/31/06, James Bennett <[EMAIL PROTECTED]> wrote:
>
> On 8/31/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote:
> > Django view functions just want HTTPResponses back; the response body
> > is passed as either as string or an iterator over strings; you can
> > override the MIME type like so:
>
> You could also render XUL with the template system.

Yes indeed, I was just trying to demonstrate that the overlap between
Django and XUL is rather small.

--~--~-~--~~~---~--~~
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: Re: Django + XUL

2006-08-31 Thread James Bennett

On 8/31/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote:
> Django view functions just want HTTPResponses back; the response body
> is passed as either as string or an iterator over strings; you can
> override the MIME type like so:

You could also render XUL with the template system.

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



A few questions about queryset's.

2006-08-31 Thread Anders Aagaard

Hi

I've been learning to love django lately, but I can't quite wrap my
head around more advanced querysets.  I've listed my classes and their
sql tables on the bottom, as all problems are linked to those tables.

First problem:
I have a class, Content, with a set of tags,  how can I filter for
multiple tags?
If I do:
list = Content.objects.filter(tag__id=1).filter(tag__id=2) it makes a
sql query asking content_content_tags for content_id's where tag_id = 1
and tag_id = 2, which will of course never match.

What I'd like to do is something like:
for tag in request.GET.getlist('tag')
content = content.filter('match this tag too')



Second problem:
I've looked at complex_filter for doing this and I can't quite figure
it out.
What if I wanted something like this:
content.objects.filter(id__id=1) | content.objects.filter(id__id=2)
But I needed to match a dynamic list of id's.  How could I do something
like

content = content.objects.filter(content=example)
for match in id_list:
content = content.objects.filter(id__id=match) #And here get a logical
OR comparison with the previus part of the loop.
So this would produce the same effect as:
content.objects.filter(id__id=id_list[0]) |
content.objects.filter(id__id=id_list[1])



Third problem: (promise I'm done soon :p )
And this is something I can't quite wrap my head around.  I want to
allow each individual user to sort by percentage of files seen.
Sorting content that is.
So I want to produce a list of Content, but sort it based on the
percentage of FileName objects in that content category the user has
seen.

I'm thinking I'll need to override the save() function in FileName, and
update the percentage, stored in a different table.  But since this
percentage has to be stored per user, and I somehow have to sort
content by it I dont have a foggy clue how to make my classes.
Does something like this make sense: (where it's updated on
FileName.save())
class SeenCache(models.Model):
content = models.ForeignKey('Content')
user = models.ForeignKey(User)
percentage = models.IntegerField()
It'd only work if a user has seen one file in that category though.




Classes:
class Tag(models.Model):
name = models.CharField(maxlength=20)

class FileName(models.Model):
fullname = models.CharField(maxlength = 1024,core=True)
content = models.ForeignKey('Content')
#List of users that has seen this content
users_seen =
models.ManyToManyField(User,core=True,null=True,blank=True)

class Content(models.Model):
name = models.CharField(maxlength = 200,null=True,blank=True)
tags = models.ManyToManyField(Tag,null=True,blank=True)



Produced sql tables:
CREATE TABLE "content_content" (
"id" integer NOT NULL PRIMARY KEY,
"name" varchar(200) NULL,
);
CREATE TABLE "content_content_tags" (
"id" integer NOT NULL PRIMARY KEY,
"content_id" integer NOT NULL REFERENCES "content_content" ("id"),
"tag_id" integer NOT NULL REFERENCES "content_tag" ("id"),
UNIQUE ("content_id", "tag_id")
);
CREATE TABLE "content_filename" (
"id" integer NOT NULL PRIMARY KEY,
"fullname" varchar(1024) NOT NULL,
"content_id" integer NOT NULL REFERENCES "content_content" ("id")
);
CREATE TABLE "content_filename_users_seen" (
"id" integer NOT NULL PRIMARY KEY,
"filename_id" integer NOT NULL REFERENCES "content_filename"
("id"),
"user_id" integer NOT NULL REFERENCES "auth_user" ("id"),
UNIQUE ("filename_id", "user_id")
);
CREATE TABLE "content_tag" (
"id" integer NOT NULL PRIMARY KEY,
"name" varchar(20) NOT NULL,
);


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



Re: Django + XUL

2006-08-31 Thread Jeremy Dunck

On 8/31/06, Alagu Madhu <[EMAIL PROTECTED]> wrote:
>
> I'm looking for django + xul example or reference.

I don't think you'll find it.

Django view functions just want HTTPResponses back; the response body
is passed as either as string or an iterator over strings; you can
override the MIME type like so:

from django.http import HTTPResponse

def test_view(request):
  response = HTTPResponse("Your XUL CODE HERE")
  response.META['CONTENT_TYPE']= 'application/vnd.mozilla.xul+xml'
  return response

If that's not what you're looking for, can you be more specific?

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



why 'default' filter does't work?

2006-08-31 Thread HoLin
the code   /z/catalog/{{ act|default:"new" }}/  works well before i get the latest svn trunk.
I try to replace it like this  /z/catalog/{{ act|default_if_none:"new" }}/, it also returns blank.
Does someone know how?-- RegardsHoLin 

--~--~-~--~~~---~--~~
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: foreignKey + manipulator...performance problem, SOLVED

2006-08-31 Thread Gábor Farkas

[EMAIL PROTECTED] wrote:
> What do you mean with "2000 thing objects"? Are there 2000 records in
> the database for that table, or did you have 2000 records in memory at
> runtime?
> 

if you don't use raw_id_admin, then (from my understanding at least),
the manipulator loads all of them into the memory.
so you have all the objects from the database-table in the memory.

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



changeManipulator and edit_inline

2006-08-31 Thread patrickk

can anyone explain how to use changeManipulator with 2 models where  
one is edited inline?

I´m having problems understanding the basic idea:
- do I have to use one changeManipulator or two?
- how does the validation work? e.g., how do I get the errors for the  
2nd model (the one which is edited inline).

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



Re: How do I make something available everywhere?

2006-08-31 Thread Adrian Holovaty

On 8/31/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> So just so I'm clear, I'll need to create an app (we'll call it amazon)
> that will have an empty models.py AND an empty views.py (since I don't
> want this in the DB, and I don't want it tied to any particular view)
> but WILL contain a templatetags folder for my little function.

Yes. But you can delete the models.py and views.py files -- Django
doesn't require that they exist.

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



appointments in admin, possible?

2006-08-31 Thread Antonio Melé

Lets see if someone has already dealt with this problem and can help
me:
I want to administer appointments in admin. I have two classes:

===
class Client(models.Model):
   name = models.CharField(maxlength=30)
   company = models.CharField(maxlength=50)

class Appointment(models.Model):
   client = models.ForeignKey(Client,raw_id_admin=True)
   when = models.DateField(core=True)
   hour = models.TimeField(core=True)
===

There is a ManyToOne relationship: I can make many appointments with
every client and each appointment belongs only to one client. The
problem is I cannot make an appointment with a client the same date and
same time I've planned another appointment before. So I've got 2
troubles:

- When creating a new appointment showing only available dates/times
for selection.
(perhaps with AJAX when selecting a date showing only available times
for that date? but... how?)

- In the appointments list view showing available days for directly
adding an appointment that day (something like a timetable?)

Has anyone dealt with appointments in django admin? how?

Thank you!!!


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



admin and dates...

2006-08-31 Thread zenx

Lets see if someone has already dealt with this problem and can help
me:
I want to administer appointments in admin. I have two classes:

===
class Client(models.Model):
   name = models.CharField(maxlength=30)
   company = models.CharField(maxlength=50)

class Appointment(models.Model):
   client = models.ForeignKey(Client,raw_id_admin=True)
   when = models.DateField(core=True)
   hour = models.TimeField(core=True)
===

There is a ManyToOne relationship: I can make many appointments with
every client and each appointment belongs only to one client. The
problem is I cannot make an appointment with a client the same date and
same time I've planned another appointment before. So I've got 2
troubles:

- When creating a new appointment showing only available dates/times
for selection.
(perhaps with AJAX when selecting a date showing only available times
for that date? but... how?)

- In the appointments list view showing available days for directly
adding an appointment that day (something like a timetable?)

Has anyone dealt with appointments in django admin? how?

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: Re: Django on shared hosting - no effect until restart

2006-08-31 Thread Jeremy Dunck

On 8/31/06, James Bennett <[EMAIL PROTECTED]> wrote:
> Apache itself shouldn't require a restart, just the Django FastCGI
> processes. I run FastCGI behind lighttpd, and change stuff all the
> time; I just stop and start my FastCGI processes and leave lighttpd
> alone.

I haven't done anything with FastCGI, and only a little with lighty,
but you can usually force a config reload by sending HUP to the
interesting process:

kill -s HUP 

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



Re: How do I make something available everywhere?

2006-08-31 Thread [EMAIL PROTECTED]

So just so I'm clear, I'll need to create an app (we'll call it amazon)
that will have an empty models.py AND an empty views.py (since I don't
want this in the DB, and I don't want it tied to any particular view)
but WILL contain a templatetags folder for my little function.

Right?


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



class Meta: ordering by foreign key

2006-08-31 Thread frank h.

is it possible?

in the admin class, I can fake ordering by a foreign key field using
the table name and list_select_related

class Admin:
list_select_related = True
ordering = ['myapp_mytable.myfield']

the same does not seem to work for class Meta, which gives me very
weired  boxes in the admin interface


--~--~-~--~~~---~--~~
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: Re: Django on shared hosting - no effect until restart

2006-08-31 Thread James Bennett

On 8/31/06, viestards <[EMAIL PROTECTED]> wrote:
> My hosting provider will not restart server every time when I need it.
> Maybe it's fcgi fault, now default FreeBSD FastCGI package is used,
> and it's built as DSO. Maybe I have to build it other way.

Apache itself shouldn't require a restart, just the Django FastCGI
processes. I run FastCGI behind lighttpd, and change stuff all the
time; I just stop and start my FastCGI processes and leave lighttpd
alone.

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



Re: How do I make something available everywhere?

2006-08-31 Thread Bryan L. Fordham

> What I don't understand (and I know this is a total newbie question) is
> how I do this so it's available to drop in on any page I like.

I'd suggest a template tag. That way you could (for example) put the tag
into your base template and it'll show up on all pages that extend it,
without being tied to any view-specific logic.

-- 
Bryan L. Fordham
socialistsushi.com
Sushi For Everyone

--~--~-~--~~~---~--~~
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: Confirmation email during user registration?

2006-08-31 Thread Iwan Memruk
Thanks. I will dig that.On 8/31/06, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
On 31-Aug-06, at 6:18 PM, Iwan Memruk wrote:> And yet one more question.> Has someone ever enabled Django to send a confirmation email during> user registration?yes--
regardskghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django users" group.  To post to this group, send email to django-users@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/django-users  -~--~~~~--~~--~--~---


Re: How do I make something available everywhere?

2006-08-31 Thread James Bennett

On 8/31/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Do I need a view? Should I just write a template tag?

I'd go with a template tag.

> Or is this what the extra context thing is all about?

It is possible to write "context processor" functions which will add
extra items to the context of every template which uses RequestContext
instead of the base Context class (generic views all use
RequestContext, and using it for your own views is a trivial change).
But given the use case here, I'd lean more toward a template tag --
that gives you a little more flexibility.

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



How do I make something available everywhere?

2006-08-31 Thread [EMAIL PROTECTED]

I want to tap into the Amazon Web Services to provide a little revenue
stream.

I'm pretty confident about writing a funtion that will get the
appropriate xml from Amazon and parse it out, as I'm already tapping
into google maps and bringinig in an external rss feed. That part I
think I've got.

What I don't understand (and I know this is a total newbie question) is
how I do this so it's available to drop in on any page I like.

If I write a view, then that view will be associated with a certain url
through urls.py, right?

Do I need a view? Should I just write a template tag?

Or is this what the extra context thing is all 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
-~--~~~~--~~--~--~---



Re: mod_python-3.2.10/Apache-2.2.2/FreeBSD/

2006-08-31 Thread Ivan Sagalaev

Wiktor Grębla wrote:
> I have lighttpd+fastcgi configuration on the same host, but apache + 
> mod_python looked like a good idea (for a change).

Interesting I've just made as switch in other direction :-). 
Lighty+FastCGI just takes less memory...

--~--~-~--~~~---~--~~
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: Custom SQL in Q objects

2006-08-31 Thread bk

I've got a similar situaton with trying to use 'limit_choices_to' on an
intermediary table, but I haven't been able to get it working...
Here's a quick abbreviated example:

class Category(models.Model):
  name = models.CharField(maxlength=200)

class Photo(models.Model):
  name = models.CharField(maxlength=200)
  category = models.ManyToManyField(Category)

class CategoryPhoto(models.Model):
  category = models.ForeingKey(Category, edit_inline=models.Tabular)
  position = models.PositiveIntegerField(core=True)
  photo = models.ForeignKey(Photo, limit_choices_to={'category__pk':
???})

??? is where I basically want to use the id of the current category
being edited to limit the photo choices to those set for that category
- since there's over 100 records in the db so far.

Any chance this would be possible with a similar Q class?


--~--~-~--~~~---~--~~
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: Redirect from button event?

2006-08-31 Thread Ivan Sagalaev

Russell Keith-Magee wrote:
> Can you make the button an  inside a  action="myurl" method="post">, where myurl is either:

I would say GET here is better instead of POST. Because it's not 
changing anything.

--~--~-~--~~~---~--~~
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: Confirmation email during user registration?

2006-08-31 Thread Kenneth Gonsalves


On 31-Aug-06, at 6:18 PM, Iwan Memruk wrote:

> And yet one more question.
> Has someone ever enabled Django to send a confirmation email during  
> user registration?

yes

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



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



Re: Django Books

2006-08-31 Thread Antonio Cangiano

zenx wrote:
> I don't know when it will be published, but a book is coming:
> http://www.amazon.com/gp/product/1590597257
> It is written by Adrian Holovaty and Jacob Kaplan-Moss (django
> developers) and as far as I know it will be also avaible for free
> download as PDF :D

That's excellent. If Adrian and Jacob need reviewers, I'm willing to
help. :)

Antonio
-- 
http://antoniocangiano.com
Zen and the Art of Ruby Programming


--~--~-~--~~~---~--~~
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: Confirmation email during user registration?

2006-08-31 Thread F.S

Iwan Memruk wrote:
> And yet one more question.
> Has someone ever enabled Django to send a confirmation email during user
> registration?
>
> --
> Iwan

Jeff C has released the source code for his LOST-theories.com
project and I remeber seeing what you are looking for when browsing
the code. You can read about the project and download the source
at the end of the url.
http://www2.jeffcroft.com/2006/jun/06/lost-theories-with-source-code/

// F


--~--~-~--~~~---~--~~
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: foreignKey + manipulator...performance problem, SOLVED

2006-08-31 Thread Laundro

What do you mean with "2000 thing objects"? Are there 2000 records in
the database for that table, or did you have 2000 records in memory at
runtime?


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



Confirmation email during user registration?

2006-08-31 Thread Iwan Memruk
And yet one more question.Has someone ever enabled Django to send a confirmation email during user registration?-- Iwan

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


Re: Django Books

2006-08-31 Thread zenx

voted too! ;)


--~--~-~--~~~---~--~~
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: python manage.py syncdb fails with assertion error

2006-08-31 Thread Jeremy Dunck

On 8/31/06, billybob <[EMAIL PROTECTED]> wrote:
> this is my first shot at using Django.  i've been using php/mysql on my
...
> Adding permission 'site | Can add site'
> Adding permission 'site | Can change site'
> Adding permission 'site | Can delete site'
> python: Objects/object.c:1397: PyObject_GenericGetAttr: Assertion `mro
> != ((void *)0)' failed.
> Aborted
>
> if anyone has seen this error before i would be very greatful for
> suggestions on how to fix it.  i'm sure it's something i'm
> doing/configured wrong...
>

Eeeh, that looks like a low-level Python error.
What version are you running?
Is it possible you have bad RAM?  Anything else interesting about the box?  :-/

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



Re: Django Books

2006-08-31 Thread Jeremy Dunck

On 8/31/06, Daniele Spino <[EMAIL PROTECTED]> wrote:
> Please consider voting it.
> http://showmedo/request ...There only one to vote in the Django category.

91 votes now.  :)

...ShowMeDo is a nice surprise.  :)

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



Re: Using a webservice as the datasource

2006-08-31 Thread Iwan Memruk
Thanks Julio!What I thought of though was a Django application completely without own DB.It would fetch the data using one set of WS operations, and save them back using another set of operations.These are not some public web services, but application-specific ones, which have their own WSDLs and are deployed as a part of the application.
Perhaps that is a bit out of scope for Django, but I still have hope that it is possible to tweak Django a bit to be able to reuse all the nice Django features which are decoupled from the datasource.
On 8/31/06, Julio Nobrega <[EMAIL PROTECTED]> wrote:
On 8/31/06, Iwan Memruk <[EMAIL PROTECTED]> wrote:> Hi,>> Has anyone got any experience of doing that with Django? How> would you estimate the effort necessary for adapting Django to use
> webservices as the data source? What would be your approach?  I am using Django with the Yahoo API. There's even a python moduleto make web searches and other Yahoo stuff (*verrry* easy to use).
  What I did is create a model replicating every field from thereturned data, then my view requests something and I obj.save() it,making it available on the admin interface. Something like (this isfor Yahoo news search):
from yahoo.search.news import NewsSearchsrch = NewsSearch('yahoo_app_id', query = 'something', results = 50,language = 'en')for news in srch.parse_results():publish_date = datetime.fromtimestamp
(float(news.PublishDate))thumbnail = news.Thumbnailif thumbnail is not None:thumbnail = thumbnail['Url'].encode('utf-8')try:obj = News.objects.get(slug = slugify(news.Title)[0:50].encode('utf-8'))
except News.DoesNotExist:obj = News(slug = slugify(news.Title)[0:50].encode('utf-8'))obj.title = news.Title[0:125].encode('utf-8')obj.summary = news.Summary.encode('utf-8')
obj.click_url = news.ClickUrl.encode('utf-8')obj.news_source = news.NewsSource.encode('utf-8')obj.news_source_url = news.NewsSourceUrl.encode('utf-8')obj.language = news.Language.encode
('utf-8')obj.publish_date = publish_date.__str__()obj.thumbnail = thumbnailobj.save()  Then I grab some news from the DB:news_list = News.objects.all().order_by('?')[0:3]
  The encode('utf-8') was necessary because Mysql was complainingabout the data, don't know if it'll happen with your DB/serverconfiguration.--Julio Nobrega - 
http://www.inerciasensorial.com.br-- Iwan

--~--~-~--~~~---~--~~
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: basic question, "greater than" in templates

2006-08-31 Thread Kenneth Gonsalves


On 31-Aug-06, at 4:16 PM, Filipe wrote:

>
> Is it possible to make "less than" and "greater than" comparisons in
> templates?
>
> I was trying to do something similar to this, but without success:
> {% if list|length > max_list_length %}
> Exceeded by {{ list|length - max_list_length }} items
> {% endif %}

write your own tag - someone has done it, you can see it in this file:

http://nrcfosshelpline.in/code/browser/trunk/web/templatetags/ 
base_utils.py

class CompareNode near the end

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



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



Re: Using a webservice as the datasource

2006-08-31 Thread Julio Nobrega

On 8/31/06, Iwan Memruk <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Has anyone got any experience of doing that with Django? How
> would you estimate the effort necessary for adapting Django to use
> webservices as the data source? What would be your approach?

  I am using Django with the Yahoo API. There's even a python module
to make web searches and other Yahoo stuff (*verrry* easy to use).

  What I did is create a model replicating every field from the
returned data, then my view requests something and I obj.save() it,
making it available on the admin interface. Something like (this is
for Yahoo news search):

from yahoo.search.news import NewsSearch
srch = NewsSearch('yahoo_app_id', query = 'something', results = 50,
language = 'en')

for news in srch.parse_results():
publish_date = datetime.fromtimestamp(float(news.PublishDate))
thumbnail = news.Thumbnail
if thumbnail is not None:
thumbnail = thumbnail['Url'].encode('utf-8')

try:
obj = News.objects.get(slug = slugify(news.Title)[0:50].encode('utf-8'))
except News.DoesNotExist:
obj = News(slug = slugify(news.Title)[0:50].encode('utf-8'))
obj.title = news.Title[0:125].encode('utf-8')
obj.summary = news.Summary.encode('utf-8')
obj.click_url = news.ClickUrl.encode('utf-8')
obj.news_source = news.NewsSource.encode('utf-8')
obj.news_source_url = news.NewsSourceUrl.encode('utf-8')
obj.language = news.Language.encode('utf-8')
obj.publish_date = publish_date.__str__()
obj.thumbnail = thumbnail
obj.save()

  Then I grab some news from the DB:

news_list = News.objects.all().order_by('?')[0:3]

  The encode('utf-8') was necessary because Mysql was complaining
about the data, don't know if it'll happen with your DB/server
configuration.

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

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



basic question, "greater than" in templates

2006-08-31 Thread Filipe

Is it possible to make "less than" and "greater than" comparisons in
templates?

I was trying to do something similar to this, but without success:
{% if list|length > max_list_length %}
Exceeded by {{ list|length - max_list_length }} items
{% endif %}


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



Re: mod_python whoes

2006-08-31 Thread Graham Dumpleton


Frank Stüss wrote:
> Thanks again for anticipation.
>
> The strange thing is: Apache *has* been restarted (as of message of my
> provider). That's why i talked about a cache or something. I found others
> experiencing this problem, too. We will see.

If you are using a service provider, ask them whether they have setup
the
mod_python configuration such that your Django instance is isolated
from
any other mod_python based or Django based application instance.

This is mentioned in the Django installation notes for mod_python at:

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

Specifically, ensure that the "PythonInterpreter" directive is set to a
unique
name for your area of the URL namespace. If this isn't done, then
another
web application could be interfering with yours.

> I totally agree that a special module reloading mechanism doesn't belong into
> django code and i shurely can live with this (if the problem mentioned is
> solved). If ever, it must be a middleware something which is totally
> transparent to mod_python and django.

A module loading mechanism which supports reloading can't be middleware
as
it needs to be intimately aware of the context it is used. This is
because you
can't apply reloading to all modules, one can only do it for a selected
subset
of modules. In mod_python this is those modules which make up the web
application.

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



Re: A combined django + apache + mod_python distro

2006-08-31 Thread Iwan Memruk
Now... I believe that coupling it with Linux would be too much. But building a Django + Apache distro is realistic enough.By the way, what about an Eclipse plugin for Django?Actually what I imagine is a 
RadRails-style package.On 8/31/06, Frank Stüss <[EMAIL PROTECTED]> wrote:
I am dreaming of a www.colinux.org package with this configuration.May be this would be nice, too. Or Linux on a stick as django server to handout a customer specific offline catalogue on a nifty usb-stick (*sigh*).
Am Donnerstag, 31. August 2006 10:31 schrieb Iwan Memruk:> Another question: is there something that prevents distributing a full> pre-configured environment for Django, including Apache and mod_python?
> Looks like the licensing for each of the three projects allows that. Such a> distro would be very appealing to the users and it would fit the RAD> ideology of Django. What do you guys think?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django users" group.  To post to this group, send email to django-users@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/django-users  -~--~~~~--~~--~--~---



Re: Django Books

2006-08-31 Thread Daniele Spino

No problem zenx.
Anyway If someone is interested in, ShowmeDo has accepted my request
for a pratical Django screencast, and luckyly in three days It took 18
votes. Please consider voting it.
http://showmedo/request ...There only one to vote in the Django category.
Many thanks JeremyD for all you link I've already started.
Picio

--~--~-~--~~~---~--~~
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: AJAXWidgetComboBox in admin?

2006-08-31 Thread zenx

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: A combined django + apache + mod_python distro

2006-08-31 Thread Frank Stüss

I am dreaming of a www.colinux.org package with this configuration. 
May be this would be nice, too. Or Linux on a stick as django server to hand 
out a customer specific offline catalogue on a nifty usb-stick (*sigh*).



Am Donnerstag, 31. August 2006 10:31 schrieb Iwan Memruk:
> Another question: is there something that prevents distributing a full
> pre-configured environment for Django, including Apache and mod_python?
> Looks like the licensing for each of the three projects allows that. Such a
> distro would be very appealing to the users and it would fit the RAD
> ideology of Django. What do you guys think?

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



Re: Django on shared hosting - no effect until restart

2006-08-31 Thread viestards

> With FCGI, do a touch on your .fcgi file. That always works for me.

I write "aaa" in fcgi file, which must cause syntax error, save it,
but nothing happens.

> Easier way of course is to develop with the built-in development
> server, and only start Apache when your development is done.

My hosting provider will not restart server every time when I need it.
Maybe it's fcgi fault, now default FreeBSD FastCGI package is used,
and it's built as DSO. Maybe I have to build it other way.

> Jay P.
>
> >
>

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



A combined django + apache + mod_python distro

2006-08-31 Thread Iwan Memruk
Another question: is there something that prevents distributing a full pre-configured environment for Django, including Apache and mod_python? Looks like the licensing for each of the three projects allows that. Such a distro would be very appealing to the users and it would fit the RAD ideology of Django. What do you guys think?
-- Iwan

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


Re: Django Books

2006-08-31 Thread zenx

Picio, sorry for the misunderstanding! You will find the links that
Jeremy has posted very useful :D
(PS: I'm from Spain)


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



Re: mod_python whoes

2006-08-31 Thread Graham Dumpleton


Frank Stüss wrote:
> Thanks to you.
>
> So it is like it is. No short changes on a virtually hosted production server
> with mod_python :)
>
> And my second problem doesn't belong in this list. After googling again i
> found that it may be caused by a wrong compiled mod_python (two mod_python
> versions with to python versions on the server). Very strange behaviour:
> every other request apache complains about errors that have been fixed
> sessions ago like missing templates or the like. The next browser reload is
> ok and so on. Like mod_python sessions were cached even after restarting
> apache and some requests got the 'wrong' mod_python instance. Strange.

I don't know what your other problem is, but it sounds like what you
are
experiencing is that your requests are being serviced by different
Apache
child processes. Further, that over time you made changes to the code
base which either were wrong and caused an error with the wrong code
then persisting in one process, or you renamed files required by code
still loaded and in use by some other Apache child process. In other
words,
different Apache child processes have different versions of code
loaded.
Which of the child processes services a request is essentially random
so
which error you see, or whether your code works is also random.

The only way you will solve this when using Django is to restart
Apache.

Making a module importing system that can handle automatic module
reloading is quite hard and there are a lot of considerations. I don't
know
too much about how Django is implemented, but the feeling I get is that
even if they were to try and implement a proper module reloading
system,
it would require some changes to how applications are structured in
directories. This is in part because it is impossible to do automatic
reloading on complex code which is organised as Python packages. To
move Django away from using traditional Python packages would mean
structural changes in user code which people aren't going to want.

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



is_approved patch for django.contrib.auth

2006-08-31 Thread Bryan

In the Django Developers group/mailing-list, I brought up an
enhancement for adding the is_approved field to django's contrib.auth.
This request was declined.  It was suggested that I add this to the
profile class instead.  This doesn't make sense to me, because
authentication should be independent of a user's profile (plus, that's
discrimination :P).

My assumption for django not including this in its trunk is that
SchemaEvolution is not there to assist all of the users that would be
affected by this trunk.  So, if you do decide to use this, be prepared
to ALTER TABLES on existing databases.

Anyways, I just updated my django trunk, so I had to repatch... and
thus, I decided to post this for anyone else wanting to add an approval
field to their user model & authentication.

You can turn on and off this approval requirement by setting the
LOGIN_REQUIRES_APPROVAL boolean in your settings.py.

Below you will find the patch:

Index: latest/django/conf/global_settings.py
===
--- latest/django/conf/global_settings.py   (revision 3688)
+++ latest/django/conf/global_settings.py   (working copy)
@@ -179,6 +179,9 @@
 # is an admin.
 ADMIN_FOR = ()

+# A contrib/auth setting.  True means that the must be approved to
login
+LOGIN_REQUIRES_APPROVAL = False
+
 # 404s that may be ignored.
 IGNORABLE_404_STARTS = ('/cgi-bin/', '/_vti_bin', '/_vti_inf')
 IGNORABLE_404_ENDS = ('mail.pl', 'mailform.pl', 'mail.cgi',
'mailform.cgi', 'favicon.ico', '.php')
Index: latest/django/contrib/auth/create_superuser.py
===
--- latest/django/contrib/auth/create_superuser.py  (revision 3688)
+++ latest/django/contrib/auth/create_superuser.py  (working copy)
@@ -82,6 +82,7 @@
 u = User.objects.create_user(username, email, password)
 u.is_staff = True
 u.is_active = True
+u.is_approved = True
 u.is_superuser = True
 u.save()
 print "Superuser created successfully."
Index: latest/django/contrib/auth/models.py
===
--- latest/django/contrib/auth/models.py(revision 3688)
+++ latest/django/contrib/auth/models.py(working copy)
@@ -3,6 +3,7 @@
 from django.db import backend, connection, models
 from django.contrib.contenttypes.models import ContentType
 from django.utils.translation import gettext_lazy as _
+from django.conf import settings
 import datetime

 def check_password(raw_password, enc_password):
@@ -70,7 +71,7 @@
 def create_user(self, username, email, password):
 "Creates and saves a User with the given username, e-mail and
password."
 now = datetime.datetime.now()
-user = self.model(None, username, '', '',
email.strip().lower(), 'placeholder', False, True, False, now, now)
+user = self.model(None, username, '', '',
email.strip().lower(), 'placeholder', False, True, False, False, now,
now)
 user.set_password(password)
 user.save()
 return user
@@ -94,6 +95,7 @@
 password = models.CharField(_('password'), maxlength=128,
help_text=_("Use '[algo]$[salt]$[hexdigest]'"))
 is_staff = models.BooleanField(_('staff status'),
help_text=_("Designates whether the user can log into this admin
site."))
 is_active = models.BooleanField(_('active'), default=True,
help_text=_("Designates whether this user can log into the Django
admin. Unselect this instead of deleting accounts."))
+is_approved = models.BooleanField(_('approved'), default=True,
help_text=_("Designates whether this user has been approved to
login."))
 is_superuser = models.BooleanField(_('superuser status'),
help_text=_("Designates that this user has all permissions without
explicitly assigning them."))
 last_login = models.DateTimeField(_('last login'),
default=models.LazyDate())
 date_joined = models.DateTimeField(_('date joined'),
default=models.LazyDate())
@@ -109,7 +111,7 @@
 fields = (
 (None, {'fields': ('username', 'password')}),
 (_('Personal info'), {'fields': ('first_name',
'last_name', 'email')}),
-(_('Permissions'), {'fields': ('is_staff', 'is_active',
'is_superuser', 'user_permissions')}),
+(_('Permissions'), {'fields': ('is_staff', 'is_active',
'is_approved', 'is_superuser', 'user_permissions')}),
 (_('Important dates'), {'fields': ('last_login',
'date_joined')}),
 (_('Groups'), {'fields': ('groups',)}),
 )
@@ -203,6 +205,8 @@
 "Returns True if the user has the specified permission."
 if not self.is_active:
 return False
+if settings.LOGIN_REQUIRES_APPROVAL and not self.is_approved:
+return False
 if self.is_superuser:
 return True
 return perm in self.get_all_permissions()
Index: latest/django/contrib/auth/forms.py

Using a webservice as the datasource

2006-08-31 Thread Iwan Memruk
Hi,I'm currently evaluating various web frameworks for my future project. I need an admin interface for a distributed system, in which the data is going to be fetched not from an SQL source but from a SOAP webservice or perhaps a couple of them. Has anyone got any experience of doing that with Django? How would you estimate the effort necessary for adapting Django to use webservices as the data source? What would be your approach?
-- Thanks,Iwan

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