Re: ChangeManipulator

2006-10-06 Thread Ivan Sagalaev

RajeshD wrote:
> See Ivan's example code here for a hint on this:
> http://groups-beta.google.com/group/django-users/msg/f1635e9a27c6ae68

For this particular case (where you only need disable, not replace 
fields) that example is an overkill. For disabling it's better to use 
'follow' (James Bennett has posted a link in this thread).

--~--~-~--~~~---~--~~
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: Reload Admin interface after model changes

2006-10-06 Thread Russell Keith-Magee

On 10/7/06, Matt <[EMAIL PROTECTED]> wrote:
>
> It is probably number 2. I'm using apache2 w/ mod_python. I'll check
> when I'm back at work next.
>
> As for what I did to dump the old app, I deleted the application folder
> and then recreated everything using manage.py startapp.

Keep in mind that unless you are using sqlite, deleting the
application folder and starting from scratch won't clear the database
of any tables that were created the first time around.

> Thanks for the quick reply. I'll post here again to confirm that it was
> a problem with not restarting apache.

Glad to be of help.

Yours,
Russ Magee %-)

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



Re: Storing UTC Time Zone Deviations In My Model?

2006-10-06 Thread Malcolm Tredinnick

On Fri, 2006-10-06 at 13:17 -0700, [EMAIL PROTECTED] wrote:
> All,
>   In my locations model, I'm trying to add UTC time zone deviations.  I
> have tried a number of things, but haven't had any success.  I would
> appriciate any suggestions on how to solve this problem(Note: I'm using
> Postgresql + RLP Branch).

I think you left out a bit of necessary information here. What problems
are you seeing?

These sorts of questions are always easier to help with if you can say
"Here's what I tried. Here's what I expected to happen, instead this
happened."
Regards,
Malcolm



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



Re: Reload Admin interface after model changes

2006-10-06 Thread Matt

It is probably number 2. I'm using apache2 w/ mod_python. I'll check
when I'm back at work next.

As for what I did to dump the old app, I deleted the application folder
and then recreated everything using manage.py startapp.

Thanks for the quick reply. I'll post here again to confirm that it was
a problem with not restarting apache.

Matt


--~--~-~--~~~---~--~~
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: "choices" option - possible bug?

2006-10-06 Thread MerMer

Many thanks, that sorted it.

Interesting to note that using the string format the data still got
stored in the Database and was getting displayed back in the admin
detailed view, but not in the list view.

MerMer


--~--~-~--~~~---~--~~
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: Apache authentication: AttributeError: 'module' object has no attribute 'auth'

2006-10-06 Thread Graham Dumpleton


[EMAIL PROTECTED] wrote:
> Hi.. thanks for your replies guys.
>
> You're probably right... I'm running mod_python from the Ubuntu dapper
> repositories which currently has version 3.1.4. Unfortunately the Edgy
> package (which is 3.2.8) depends on a newer version of libc6 which
> means that I really don't want to upgrade the package.
>
> So if anyone know about a mod-python 3.2.8 package that would work
> properly for Ubuntu Dapper I'd surely appreciate it.

You might be able to fudge it to get around the mod_python problem with
that version. Use the PythonImport directive to force import the
modules at Apache child process startup.

  PythonImport django.contrib.auth
  etc ...

It just so happens that the PythonImport directive in that version
underneath does the equivalent of using the "import" statement, thus
bypassing the flawed behaviour of the mod_python.apache.import_module()
function that the Python*Handler directives use.

The PythonImport directive must be at global scope within Apache
configuration.

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: Reload Admin interface after model changes

2006-10-06 Thread Russell Keith-Magee

On 10/7/06, Matt <[EMAIL PROTECTED]> wrote:
>
> What can I do to reload the admin interface so that it uses the new
> models?

Sounds like either:
1) You aren't actually recreating the models. When you say 'dumping
the old app and creating it again', what procedure are you using?
2) The webserver is caching your 'old' models. How are you deploying
your application? If you are using apache, you will need to restart
httpd after changing the model.

Yours,
Russ Magee %-)

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



Re: ChangeManipulator

2006-10-06 Thread James Bennett

On 10/6/06, Steve Wedig <[EMAIL PROTECTED]> wrote:
> ** Here is the general question **
> How can I use a ChangeManipulator to validate a subset of a model's fields.

http://www.rossp.org/blog/2006/aug/23/changemanipulators-only-part-model/

-- 
"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: ChangeManipulator

2006-10-06 Thread Michael
On 10/7/06, Steve Wedig <[EMAIL PROTECTED]> wrote:
** Here is the general question **How can I use a ChangeManipulator to validate a subset of a model's fields.** Here is the specific situation **I am using django.contrib.auth.models.User for my user accounts. I
would like to create a change/edit form that lets the user change justtheir email address, and perhaps other fields.Using User.ChangeManipulator, I would like to validate only the subsetof fields being changed (basically just the email address).
Unfortunately manipulator.get_validation_errors(new_data) expects allfields to be in new_data (including things like date_join_time, etc).How can I validate only the relevant/changed fields? I could put all
of the other fields into the form as hidden inputs, but there must bea better way :)Thanks!SteveYes, hit the same problem, I've been pulling nymy hairs out..Than find very easy solution:
in views: (using  User.ChangeManupulator)    if request.POST:    old_data = manipulator.flatten_data()    new_data = request.POST.copy()    new_data.update(old_data)
    for i in request.POST:    new_data[i]=request.POST[i]    errors = manipulator.get_validation_errors
(new_data)    if not errors:    new_data['user']=request.user.id    manipulator.do_html2python(new_data)    manipulator.save(new_data)
in form:    {% if form.email.errors %}     {{ form.email.errors|join:", " }}{% 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  -~--~~~~--~~--~--~---


django - kit

2006-10-06 Thread Picio

hello,
do you know about some kit to have:

a web server
python
postgres
and Django?

something like Wamp.
In other words is there any real PAID (made in AH) kit available?

thanks a lot
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: customizing the admin interface

2006-10-06 Thread patrickk

say you want to have a different list-template for app "blog" model  
"entries", just add
/admin/blog/entries/change_list.html to your templates directory and  
customize it.
we´re using that a lot to add buttons for specific models.

I didn´t figure out how to customize the view yet. I guess it´s not  
as flexible as I´d like it to be.

the purpose of the admin interface, as I understand it, is that you 
´re able to pre-fill the tables.
for a more complex application (or a CMS), you may need to write your  
own views and templates (which is not so easy with the current custom  
manipulators ...).

if you´re more specific with your question, it´s easier to answer ...

patrick.

Am 06.10.2006 um 22:18 schrieb Paul Barry:

>
> I'm still trying to understand the purpose of the admin interface.  I
> don't think STACKED does exactly what I want, but my question is more
> of a broad one.  Is it meant to be used with a complex application?
> It seems to me that you can't make changes to the admin interface
> because you have no control over the template or the view.  Say I
> wanted to create my own template and view for handling a specfic weird
> object, is there even a way to add a link on the main admin page to my
> custom view/template?  I get the impression for some projects you have
> to end up writing your own whole new custom admin interface, is that
> true?
>
> On 10/3/06, Michael <[EMAIL PROTECTED]> wrote:
>>
>>
>> On 10/3/06, Paul Barry <[EMAIL PROTECTED]> wrote:
>>>
>>> Is the admin interface customizable at all?  Specifically:
>>>
>>> 1.  Can you create a workflow, like step 1, step 2, step 3, then  
>>> save
>> object?
>>>
>>> 2.  Can you create a lookup select for a foreign key?  For  
>>> example, if
>>> I have an object that has a ForeignKey and there are 10,000  
>>> instances
>>> of the foreign key, I would like to pop-up a new window, have the  
>>> user
>>> search for the foreign key instance, and then set the value back on
>>> the original form, because:
>>>
>>> a)  loading 10,000 options in a select will be slow
>>> b)  an admin user will most likely not be able to find the specific
>>> foreign key instance they are looking for in a drop-down.  This  
>>> can be
>>> true with even smaller lists, where you might want to look for
>>> instance based on a couple of properties, such as name or
>>> date_published.
>>>
>>
>> use "raw_id_admin=True,"  in your model, like :
>> user=models.ForeignKey 
>> (User,edit_inline=models.STACKED,raw_id_admin=True,)
>>
>>
>> --
>> --
>> Michael
>>
>>>
>>
>
> >


--~--~-~--~~~---~--~~
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: DB question: OR-ing LIKES

2006-10-06 Thread Tom Smith


On 6 Oct 2006, at 21:26, RajeshD wrote:

>
>> for word in words:
>> q = q.filter(  Q(title__icontains=word) )
>>
> Try something like this instead of the above:
>
> q_fragment = Q(title__icontains=words[0])
> for word in words[1:]
>   q_fragment = q_fragment | Q(title__icontains=word)
> q = q.filter(q_fragment)

Thanks... I can't believe that worked...

a = b | c

wow...

Still can't...




--~--~-~--~~~---~--~~
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: "choices" option - possible bug?

2006-10-06 Thread RajeshD


>
> RATING_CHOICES=(
> ('5', '5 stars'),
> ('4', '4 stars'),
> ('3', '3 stars'),
> ('2', '1 stars'),
> ('1', '1 star'),
> )

Replace the first element of each tuple with an integer as you are
feeding it to an IntegerField. Like this:

RATING_CHOICES=(
(5, '5 stars'),
(4, '4 stars'),
(3, '3 stars'),
(2, '1 stars'),
(1, '1 star'),
)


--~--~-~--~~~---~--~~
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: Diamanda Wiki and MyghtyBoard Forum on SVN now

2006-10-06 Thread Lucas Vogelsang

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

[EMAIL PROTECTED] wrote:
> Link: http://code.google.com/p/diamanda/
> The SVN repository contains the latest code for diamanda wiki and
> MyghtyBoard forum (NEW).
>
> Requiremens:
> - django svn or 0.95 with sitemap package (get from svn/trac and place
> the folder in contrib)
> - strip-o-gram http://www.zope.org/Members/chrisw/StripOGram
> - PIL
> - read the readme
>
> SyncDB note:
> - currently both apps have extra SQL data which is imported on first
> syncdb. THE SQL work only on mysql (should on postgres - not tested,
> doesn't work with sqlite) will be fixed in the next days.
> [...]
> -~--~~~~--~~--~--~---
>
Hi,

I'm trying to set up a wiki for our DjangoForge. We try to use django
for as much as possible. So I thought, I'd give diamanda wiki a shot.

Doing a svn co, syncing the (sqlite) db worked fine. However I have
problems with the install script.

It doesn't seem to work at all:

[EMAIL PROTECTED]:~/org/djangoforge/wiki$
PYTHONPATH=/home/lucas/org/djangoforge:/home/lucas/org/djangoforge/wiki
python install.py
Traceback (most recent call last):
  File "install.py", line 5, in ?
from wiki.models import *
ImportError: No module named models
[EMAIL PROTECTED]:~/org/djangoforge/wiki$


thanks for your help!

lucas
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Signed with GPG & Enigmail - see http://www.vincisolutions.ch/pgp/

iD8DBQFFJs503RQ/RpGW2HgRApb6AJ9+A23b6gHiCmfIqIIRUK1qEzHhJgCghhTa
vzycCFsO3PumWoOk++XVFdI=
=El4n
-END PGP SIGNATURE-


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



Re: "choices" option - possible bug?

2006-10-06 Thread Don Arbow

On Oct 6, 2006, at 2:20 PM, MerMer wrote:
>
> Ray,
>
> The code is below. The RATINGS_CHOICES are defined inside the Model
> Class.
>
> MerMer
>
> RATING_CHOICES=(
> ('5', '5 stars'),
> ('4', '4 stars'),
> ('3', '3 stars'),
> ('2', '1 stars'),
> ('1', '1 star'),
> )
> rating=models.IntegerField("user
> rating",choices=RATING_CHOICES)



Your rating field is an integer field, but your choice values are  
strings. Try:

RATINGS_CHOICES = (
(5, '5 Stars'),
(4, '4 Stars'),
...

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: Django's target applications?

2006-10-06 Thread Don Arbow

On Oct 6, 2006, at 1:47 PM, Paul Barry wrote:
>
> The link on
>
> http://code.djangoproject.com/wiki/DjangoPoweredSites
>
> points to the blog.  I guess that link should be updated.



Melt is the Django application (next to the link it says "social  
networking *software*", not *site*), the link points to the developer  
blog page where you can download the software from the repository. If  
you scroll up to the heading "Community-Building Web Sites", you see  
a link to cooltheplanet.net, which is the actual website that uses  
the Melt software.

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: 'bool' object has no attribute 'get' ??

2006-10-06 Thread Nicolas Steinmetz

Nicolas Steinmetz wrote:

> class Comment(models.Model):
> author = models.CharField(maxlength=50)
> email = models.EmailField()
> title = models.CharField(maxlength=50)
> comment = models.TextField()
> post = models.ForeignKey(Post)
> parent = models.ForeignKey('self', blank=True, null=True,
> related_name='child')

It looks django do not like multiple ForeignKey... I'll bypass it in a
different way ;)


--~--~-~--~~~---~--~~
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: "choices" option - possible bug?

2006-10-06 Thread MerMer

Ray,

The code is below. The RATINGS_CHOICES are defined inside the Model
Class.

MerMer

RATING_CHOICES=(
('5', '5 stars'),
('4', '4 stars'),
('3', '3 stars'),
('2', '1 stars'),
('1', '1 star'),
)
rating=models.IntegerField("user
rating",choices=RATING_CHOICES)


--~--~-~--~~~---~--~~
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 documentation search bar plugin for Firefox

2006-10-06 Thread Noah

Fair enough.

I actually didn't know those existed. I still like the search box tho


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



'bool' object has no attribute 'get' ??

2006-10-06 Thread Nicolas Steinmetz

Hello,

I have the following code but I do not understand why I have the error
below... could someone help me ?

class Comment(models.Model):
author = models.CharField(maxlength=50)
email = models.EmailField()
title = models.CharField(maxlength=50)
comment = models.TextField()
post = models.ForeignKey(Post)
parent = models.ForeignKey('self', blank=True, null=True,
related_name='child')
submitted_at = models.DateTimeField(auto_now_add=True)
pub_date = models.DateTimeField()
pub_status = models.BooleanField()

def __str__(self):
return self.comment

class Admin:
list_display = ('author', 'title', 'pub_status')
list_filter = ['pub_date']
date_hierarchy = 'pub_date'
search_fields = ['author', 'title', 'comment']

AttributeError at /admin/blog/comment/add/
'bool' object has no attribute 'get'
Request Method: GET
Request URL:http://localhost:8000/admin/blog/comment/add/
Exception Type: AttributeError
Exception Value:'bool' object has no attribute 'get'
Exception
Location:   
/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/related.py
in get_manipulator_fields, line 116




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

2006-10-06 Thread RajeshD


>
> Couple that with the generic model create/update view and you are set.

Doh', strike that last sentence from my reply -- generic create/update
views use automatic manipulators and not custom ones. So, you will need
your own view to go with 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: ChangeManipulator

2006-10-06 Thread RajeshD

> ** Here is the specific situation **
> I am using django.contrib.auth.models.User for my user accounts. I
> would like to create a change/edit form that lets the user change just
> their email address, and perhaps other fields.

You would need to use a CustomManipulator here.

You can even create your custom manipulator by extending the model's
ChangeManipulator and then in __init__ removing the fields you don't
need to be updatable in your form.

See Ivan's example code here for a hint on this:
http://groups-beta.google.com/group/django-users/msg/f1635e9a27c6ae68

If you are going to be accepting only a couple of fields, a fresh
CustomManipulator (i.e. one not derived from ChangeManipulator) would
be simpler and cleaner.

Couple that with the generic model create/update view and you are set.


--~--~-~--~~~---~--~~
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's target applications?

2006-10-06 Thread Paul Barry

The link on

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

points to the blog.  I guess that link should be updated.

On 10/6/06, Antonio Cavedoni <[EMAIL PROTECTED]> wrote:
>
> On 6 Oct 2006, at 22:02, Paul Barry wrote:
> > The social networking site with ~1 millions users, are you referring
> > to grono.net?  The action of the login page is do-login.jsp and the
> > Server header is "Apache-Coyote/1.1".  Melt points to a MovableType
> > blog.
>
> I have no idea about grono.net, but this is the result of the
> "Custard Melt" project (you stumbled upon the development blog):
>
> http://www.cooltheplanet.net/
>
> Cheers.
> --
> Antonio
>
>
>
>
> >
>

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



fulltime Django job in Chicago (+ Scrum, testing)

2006-10-06 Thread Kumar McMillan

Hello.
As a developer at a fast growing, online marketing firm in Chicago
(Evanston to be precise) I'd like to announce that we are looking
specifically for Django developers.  If you are gainfully employed but
know of someone who may be interested, please pass this on.  We are
unable to offer telecommuting as an option but this may be an option
in the future once you are familiar with the team.

Our tech dept. is currently a mid-sized team of 6 developers, 1 DBA, 2
QA-ers, and 3 project managers (i.e. still small enough that you will
get a face cake for your birthday).  Life is fast but finishes at 5
everyday, strictly no weekends (unless dollars are being lost,
emergencies, etc), and we work formally, as in month-long Scrum [1]
sprints, user stories, and have a symbiotic relationship to Trac
(custom modules for ticket tasks, burndown charts, etc).  You'll also
find that we're constantly analyzing and refining the way we manage
ourselves.

Our company is http://www.leapfrogonline.com/ and we do the good kind
of [*ahem* better kind of] marketing : we only get paid when people
are happy ;)  For the most part this means obtaining clients for cable
internet providers or credit cards such as Discover by working with
media properties such as Google, MSN.  We have a more recent ecommerce
venture and a plan to open up some REST services publicly.  We also
have a growing analytics dept. who is busy doing lots of math to help
steer us in the right directions; we may be writing software for them.

But, hey, it's  all code at the end of the day so what this really
means is you get to help us manage things like our 32 million row
event log [2], cluster of buildbot [3] slaves, load-balanced public
facing web applications, REST-ful feeds and services, et cetera.  Most
importantly we are *porting* several apps to Django and Ruby on Rails
[4] and it is going smooth but we don't have enough hands :(

Do you like to test?  So do we.  In fact, any new code we write *must*
be tested.  This doesn't mean we are TDD nazis or anything.  I think
innately we practice something more like BDD [5] though.  Most of our
apps are written using existing open source libraries, but members of
our team work on open source projects such as:

http://somethingaboutorange.com/mrl/projects/nose/
http://code.google.com/p/nose-watch/
http://testtools.python-hosting.com/
(and of course, some patches to django)

If you're interested, please privately send me a resume and, if
possible, Django code samples.
thanks, Kumar

.. [1]: http://www.controlchaos.com/about/
.. [2]: why, postgresql of course!
.. [3]: http://buildbot.sourceforge.net/
.. [4]: don't ask
.. [5]: http://behaviour-driven.org/

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



Storing UTC Time Zone Deviations In My Model?

2006-10-06 Thread [EMAIL PROTECTED]

All,
  In my locations model, I'm trying to add UTC time zone deviations.  I
have tried a number of things, but haven't had any success.  I would
appriciate any suggestions on how to solve this problem(Note: I'm using
Postgresql + RLP Branch).


Model:


from django.db import models
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType

# Create your models here.

COUNTRY = (
('United States', 'United States'),
('Canada', 'Canada'),
)

UTC_TIME_ZONE_DEVIATION = (
 ('-12:00',  'UTC-12:00 M|Y   (IDLW, Baker Island, Bikini
Atolls)'),
 ('-11:00',  'UTC-11:00 X (American Samoa, Midway Atoll)'),
 ('-10:00',  'UTC-10:00 W (Hawaii-Aleutian Standard Time,
Aleutian Islands)'),
 ('-09:30',  'UTC-09:30 V*(French Polynesia, Marquesas
Islands)'),
 ('-09:00',  'UTC-09:00 V (Alaska Standard Time, French
Polynesia)'),
 ('-08:00',  'UTC-08:00 U (Pacific Standard Time, British
Columbia)'),
 ('-07:00',  'UTC-07:00 T (Mountain Standard Time, Arizona)'),
 ('-06:00',  'UTC-06:00 S (Central Standard Time, Belize)'),
 ('-05:00',  'UTC-05:00 R (Eastern Standard Time, Brazil)'),
 ('-04:00',  'UTC-04:00 Q (Atlantic Standard Time, Dominica)'),
 ('-03:30',  'UTC-03:00 P*(Newfoundland Standard Time)'),
 ('-03:00',  'UTC-03:00 P (Argentina,Uruguay)'),
 ('-02:00',  'UTC-02:00 O (Mid-Atlantic, South Georgia)'),
 ('-01:00',  'UTC-01:00 N (Cape Verde, Azores)'),
 ('+00:00',   'UTC 00:00 Z (UTC, GMT, Zulu)'),
 ('+01:00',   'UTC+01:00 A (Oslo,Zurich,Vienna)'),
 ('+02:00',   'UTC+02:00 B (South Africa, Ukraine)'),
 ('+03:00',   'UTC+03:00 C (Russia, Saudi Arabia)'),
 ('+03:30',   'UTC+03:30 C*(Iran)'),
 ('+04:00',   'UTC+04:00 D (Russia, United Arab Emirates)'),
 ('+04:30',   'UTC+04:30 D*(Afghanistan)'),
 ('+05:00',   'UTC+05:00 E (Tajikistan, Uzbekistan)'),
 ('+05:30',   'UTC+05:30 E*(Indian Standard Time, Sri Lanka)'),
 ('+06:00',   'UTC+06:00 F (Bangladesh, Kazakhstan)'),
 ('+06:30',   'UTC+06:30 F*(Cocos Islands, Myanmar)'),
 ('+07:00',   'UTC+07:00 G (Cambodia, Indonesia)'),
 ('+08:00',   'UTC+08:00 H (Australian Western Standard Time,
China)'),
 ('+08:45',   'UTC+08:45 H (Western Austrailia,
Caiguna-Eucla-Border)'),
 ('+09:00',   'UTC+09:00 I (Japan Standard Time, Korea Standard
Time)'),
 ('+09:30',   'UTC+09:30 I*(Australian Central Standard Time,
Northern Territory)'),
 ('+10:00',   'UTC+10:00 K (Australian Eastern Standard Time,
Queensland)'),
 ('+10:30',   'UTC+10:30 K*(New South Wales)'),
 ('+11:00',   'UTC+11:00 L (Solomon Islands, Magadan Oblast)'),
 ('+11:30',   'UTC+11:30 L*(Norfold Island)'),
 ('+12:00',   'UTC+12:00 M|Y   (Fiji, Marshall Islands)'),
)

class Location(models.Model):
created_by = models.ForeignKey(User)
created_on = models.DateTimeField(auto_now_add=True)
content_type = models.ForeignKey(ContentType)
country = models.CharField(maxlength=100, choices=COUNTRY,
default='United States', help_text="Example: United States, Canada,
Germany")
address_1 = models.CharField(maxlength=100, help_text="Example:
100N 1st Street.")
address_2 = models.CharField(maxlength=100, blank=True, null=True,
help_text="Example: 100N 1st Street.")
area = models.CharField(maxlength=100,  help_text="Eample: A City,
Town, or Village.")
region = models.CharField(maxlength=100, help_text="Example: A
State, Provice, or Territory.")
postal_code = models.CharField(maxlength=50, blank=True, null=True,
help_text="Example: 82072")
latitude = models.FloatField(max_digits=11, decimal_places=6,
blank=True, null=True)
longitude = models.FloatField(max_digits=11, decimal_places=6,
blank=True, null=True)
show_on_map = models.BooleanField(default=False)
time_zone = models.TimeField('Time Zone',
choices=UTC_TIME_ZONE_DEVIATION, blank=True, null=True,
help_text="Optional: You can specify the UTC Time Zone for this
location.")


def __str__(self):
return "%s, %s, %s, %s" % (self.country, self.address_1,
self.region, self.area )

def get_absolute_url(self):
#return "/posts/%s/%s/" %
(self.date.strftime("%Y/%b/%d").lower(), self.slug)
return "/locations/%i/" % self.id

class Admin:
ordering = ['country']
list_display = ('country', 'address_1', 'address_2',
'region','area', 'postal_code', 'time_zone',)
#list_filter =
('created_on','last_modified','enable_comments','pub_state',)


 
Thanks!
--Nick Pavlica


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

Re: Django's target applications?

2006-10-06 Thread Antonio Cavedoni

On 6 Oct 2006, at 22:02, Paul Barry wrote:
> The social networking site with ~1 millions users, are you referring
> to grono.net?  The action of the login page is do-login.jsp and the
> Server header is "Apache-Coyote/1.1".  Melt points to a MovableType
> blog.

I have no idea about grono.net, but this is the result of the  
“Custard Melt” project (you stumbled upon the development blog):

http://www.cooltheplanet.net/

Cheers.
-- 
Antonio




--~--~-~--~~~---~--~~
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: customizing the admin interface

2006-10-06 Thread Paul Barry

I'm still trying to understand the purpose of the admin interface.  I
don't think STACKED does exactly what I want, but my question is more
of a broad one.  Is it meant to be used with a complex application?
It seems to me that you can't make changes to the admin interface
because you have no control over the template or the view.  Say I
wanted to create my own template and view for handling a specfic weird
object, is there even a way to add a link on the main admin page to my
custom view/template?  I get the impression for some projects you have
to end up writing your own whole new custom admin interface, is that
true?

On 10/3/06, Michael <[EMAIL PROTECTED]> wrote:
>
>
> On 10/3/06, Paul Barry <[EMAIL PROTECTED]> wrote:
> >
> > Is the admin interface customizable at all?  Specifically:
> >
> > 1.  Can you create a workflow, like step 1, step 2, step 3, then save
> object?
> >
> > 2.  Can you create a lookup select for a foreign key?  For example, if
> > I have an object that has a ForeignKey and there are 10,000 instances
> > of the foreign key, I would like to pop-up a new window, have the user
> > search for the foreign key instance, and then set the value back on
> > the original form, because:
> >
> > a)  loading 10,000 options in a select will be slow
> > b)  an admin user will most likely not be able to find the specific
> > foreign key instance they are looking for in a drop-down.  This can be
> > true with even smaller lists, where you might want to look for
> > instance based on a couple of properties, such as name or
> > date_published.
> >
>
> use "raw_id_admin=True,"  in your model, like :
> user=models.ForeignKey(User,edit_inline=models.STACKED,raw_id_admin=True,)
>
>
> --
> --
> Michael
>
>  >
>

--~--~-~--~~~---~--~~
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: DB question: OR-ing LIKES

2006-10-06 Thread RajeshD

> for word in words:
> q = q.filter(  Q(title__icontains=word) )
>
Try something like this instead of the above:

q_fragment = Q(title__icontains=words[0])
for word in words[1:]
q_fragment = q_fragment | Q(title__icontains=word)
q = q.filter(q_fragment)


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

2006-10-06 Thread Steve Wedig

** Here is the general question **
How can I use a ChangeManipulator to validate a subset of a model's fields.

** Here is the specific situation **
I am using django.contrib.auth.models.User for my user accounts. I
would like to create a change/edit form that lets the user change just
their email address, and perhaps other fields.

Using User.ChangeManipulator, I would like to validate only the subset
of fields being changed (basically just the email address).
Unfortunately manipulator.get_validation_errors(new_data) expects all
fields to be in new_data (including things like date_join_time, etc).

How can I validate only the relevant/changed fields? I could put all
of the other fields into the form as hidden inputs, but there must be
a better way :)

Thanks!
Steve

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



DB question: OR-ing LIKES

2006-10-06 Thread Tom Smith

I am trying to iterate through a list of strings to create...

OR titile LIKE '%This%' OR title LIKE '%That%'

q= Product.objects.filter( some stuff )
for word in words:
q = q.filter(  Q(title__icontains=word) )

return q[:10]


...but the contains Queries get AND-ed together...

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: Django's target applications?

2006-10-06 Thread Paul Barry

The social networking site with ~1 millions users, are you referring
to grono.net?  The action of the login page is do-login.jsp and the
Server header is "Apache-Coyote/1.1".  Melt points to a MovableType
blog.

On 10/6/06, James Bennett <[EMAIL PROTECTED]> wrote:
>
> On 10/6/06, Serg Kovrov <[EMAIL PROTECTED]> wrote:
> > I'm asking because rapid web application development (RAD, RWAD?) is
> > indeed cool (and in real life deadlines are quite issues), but I'm more
> > interested in development of robust, maintainable, and scalable (mostly
> > big) applications.
>
> I'm seconding the recommendation that you check out the list of
> Django-powered sites; you'll find things like:
>
> * A browsable database of *every vote* in both houses of the US
> Congress, going back about a decade and constantly updated while
> Congress is in session.
> * More newspapers (of all sizes) than you can shake a stick at, with
> more always in development (one of the biggest news publishers in
> America has bought in to a Django-based platform).
> * A social networking site with ~1million users.
>
> And so on and so forth. Don't confuse "development can go quickly"
> with "development can't scale" -- Django scales very easily to both
> ends of the spectrum, whether you're just building a one-off internal
> app or a huge deployment.
>
> --
> "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: Django's target applications?

2006-10-06 Thread James Bennett

On 10/6/06, Serg Kovrov <[EMAIL PROTECTED]> wrote:
> I'm asking because rapid web application development (RAD, RWAD?) is
> indeed cool (and in real life deadlines are quite issues), but I'm more
> interested in development of robust, maintainable, and scalable (mostly
> big) applications.

I'm seconding the recommendation that you check out the list of
Django-powered sites; you'll find things like:

* A browsable database of *every vote* in both houses of the US
Congress, going back about a decade and constantly updated while
Congress is in session.
* More newspapers (of all sizes) than you can shake a stick at, with
more always in development (one of the biggest news publishers in
America has bought in to a Django-based platform).
* A social networking site with ~1million users.

And so on and so forth. Don't confuse "development can go quickly"
with "development can't scale" -- Django scales very easily to both
ends of the spectrum, whether you're just building a one-off internal
app or a huge deployment.

-- 
"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: Can I pre-populate fields in the admin interface?

2006-10-06 Thread Waylan Limberg

On 10/5/06, carlwenrich <[EMAIL PROTECTED]> wrote:
>
> Models:
>
> ---
> class Week(models.Model):
> beginning = models.DateField(core=True)
>
> def __str__(self):
> return str(self.beginning)
>
> class Admin:
> pass
>
>
> class Day(models.Model):
> week = models.ForeignKey(Week, edit_inline=models.TABULAR,
> num_in_admin=7)
> name = models.CharField(maxlength=50)
> opens = models.TimeField()
> closes = models.TimeField()
>
> def __str__(self):
> return self.name
> ---
>
> The admin screen (add) comes up with a week and seven days. Each day
> has a name field, and opens field, and a closes field. I'd like it to
> come up with those fields pre-populated with default values.
>
> Can I do it? If so, how?
>
http://www.djangoproject.com/documentation/model_api/#default


-- 

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: Django's target applications?

2006-10-06 Thread Adrian Holovaty

On 10/6/06, Serg Kovrov <[EMAIL PROTECTED]> wrote:
> Is Django meant to be used to create a sophisticated (as opposite to
> rapid) web applications such as (for example) forums or e-shops? With
> all bells and whistles, you know...

Hello Serg,

I'd encourage you to check out the list of the Django-powered sites on
this page:

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

You'll find a variety of sophisticated Web applications on that page.

Also, check out our FAQ, in which we answer the questions about
scaling and sophistication.

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

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



Reload Admin interface after model changes

2006-10-06 Thread Matt

Hey. I'm a Django. I've got in installed and I've created a model and
tested out the admin interface. Then I wanted to make some changes to
the model and reload the change to the DB and the admin console.

After searching around for a bit, I haven't found a good way to do
this, although it appears to be something that is being worked on. I
was able to use sqlreset to change the DB, but I wasn't able to the
changes to occur in the admin console. Instead I get errors indicating
that it is still trying to use the old DB model.

I ended up dumping the old app and creating it again (with the same
name). However, the admin interface is still trying to use the old DB
model.

What can I do to reload the admin interface so that it uses the new
models?

Matt


--~--~-~--~~~---~--~~
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: Anybody know of an example of a Django app that uses a JavaScript module?

2006-10-06 Thread Tyson Tate

No JavaScript needed.



-Tyson


On Oct 2, 2006, at 6:43 PM, carlwenrich wrote:

> What I want to do is call a JavaScript module with clickable images,
> and then go to a Django view when a user clicks on an image.


--~--~-~--~~~---~--~~
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: Caching bug?

2006-10-06 Thread RajeshD

When you log on to the admin area, you are no longer anonymous -- The
anonymous caching mechanism will therefore not cache any pages you
access across your site until you logout of admin and become anonymous
again.

This is correct behaviour when CACHE_MIDDLEWARE_ANONYMOUS_ONLY is set
to True.


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



Caching bug?

2006-10-06 Thread Tom Smith

When I turn on caching... and use...

CACHE_MIDDLEWARE_ANONYMOUS_ONLY= True

...then, if I am logged into the admin part of my site... all pages  
are not cached...

Is this right? I'd prefer it if the Admin screens weren't cached but  
the rest were

regards

tom

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



SSL Middleware

2006-10-06 Thread Antonio Cavedoni

Hello everyone,

yesterday I came up with a Django middleware that has the potential  
to be actually useful!

I called it SSL Middleware, and what it does is take a tuple of paths  
(HTTPS_PATHS in the settings file) and redirect all the http://  
requests for paths starting with these values to their https://  
counterpart.

In reverse, if an https:// request is made on a path that does *not*  
start with one of the values in the tuple, that will be redirected to  
its http:// version.

The code is here:

http://unicoders.org/code/django/trunk/middleware/sslmiddleware.py

Cheers!
-- 
Antonio



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



comment framework: lookup question

2006-10-06 Thread patrickk

I´m currently trying to use the comment framework and I´m trying to  
retrieve the last 10 comments given for postings by a specific user.

the lookup I´d like to have is:

select * from comments
join posting on comments.object_id = postings.id
join user on posting.user_id = user.id

more detailed:

I´m on the weblog-site of a user, so I have the users id (which is  
different from the logged-in user).
this user has postings and there are comments to this postings.
now, I´d like to have a list with the last 10 comments on this users  
postings.

I hope this is not too confusing.

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



IE ignores Content-disposition on Apache but not development server

2006-10-06 Thread Steve M

I want my view to respond with a file for downloading, so that the
browser pops up the download/file save dialog.
I am using the 'Content-Disposition' header to specify the name of the
file.
When I use the django development server, it works perfectly in Firefox
and IE6 (latest versions). When I switch to Apache with mod_python, it
continues to work with Firefox, but IE6 apparently ignores the
'Content-Disposition' header and tries to save the file as the GET
parameters part of the URL, including the question mark.  (For example,
if the URL is 'http://192.168.1.109/report?id=12345' then IE will offer
to save the file as '?id=12345', while Firefox will use the filename
specified in Content-Disposition header. )

Regarding mimetype, I have some alternatives that may work with
development server or Firefox, but not with Apache and IE.

Regarding the filename format in the Content-Disposition value, Firefox
requires quotation marks around the filename if it has spaces in it,
but on the development server at least IE can handle them with no
spaces.

So, can anyone suggest why IE would respect Content-Disposition on
development server but not on Apache ? I have the default Apache
configuration on Ubuntu 6.06 server, with a modified httpd.conf as
described in the django mod_python deployment document.

Hmm, one last point to mention: the contents of the report is not a
regular Excel file - did you know that you can save an HTML file that
has a table in it with a .xls extension and Excel will treat it just
like a regular Excel file? (If you modify and save it in Excel it will
be converted to a regular Excel file.) So I make the report using an
HTML table, but save it as a .xls file and the web service consumer
thinks they're getting an Excel file, and everyone is happy. I mention
this because I realize IE might be inspecting the contents of the file
and deciding it is not really an Excel file. But this would be contrary
to the description I read of its behavior, which is that IE respects
the Content-Disposition header; and anyway, why would it happen on
Apache but not on the Django development server?

Enough, here is the view code:

from django.http import HttpResponse
from mymodule import prepare_report

def get_report(request):
try:
id = request.GET["id"]
int(id)
except KeyError, ValueError:
raise Http404

report_filename, report = prepare_report(id)

#response = HttpResponse(mimetype='application/octet-stream')
#response = HttpResponse(mimetype='application/msexcel')
response = HttpResponse(mimetype='application/vnd.ms-excel')
#response['Content-Disposition'] = 'attachment; filename=%s' %
report_filename
response['Content-Disposition'] = 'attachment; filename="%s"' %
report_filename
response.write(report)
return response


--~--~-~--~~~---~--~~
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: long-running process. how to do it?

2006-10-06 Thread Corey Oordt

You, know I just found that utility last week.

As far as just doing an os.spawn*, my recollection is that if your  
process ends, the spawned process ends, even if you are not waiting  
for it to return.

In the case with a web server, as soon as you return from your view,  
the spawned process ends. The daemonize process, full detaches itself  
from the spawning process so it can survive after the spawning  
process ends.

Corey

On Oct 6, 2006, at 2:39 AM, Holger Schurig wrote:

>
>> I wrote a daemonize method that can be called by the view to
>> spawn a new process that executes your code.
>
> Looks very similar to django.utils.daemonize :-)
>
> >


--~--~-~--~~~---~--~~
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 documentation search bar plugin for Firefox

2006-10-06 Thread Rob Hudson

I simply added a Firefox keyword search on the Django search box on the
docs page.  Now I type this into my URL: "dj template tags" and I get
what 'm looking for.

More info are smart keywords:
http://www.mozilla.org/products/firefox/smart-keywords.html

-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: "choices" option - possible bug?

2006-10-06 Thread RajeshD

Hi,

Can you copy the definition of your RATING_CHOICES? Also, where is it
defined in your models file?

-Raj


--~--~-~--~~~---~--~~
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's target applications?

2006-10-06 Thread Tim Chase

> or work with. Django provides an incredibly simple framework with a
> multitude of options for different caching and other low level
> implementation decisions (which it achieves through decoupled code)

In addition to Fascis's good comments, if you google for

django shared-nothing

you'll find hits that describe some of the underlying 
architecture that should allow multiple instances of Django to be 
put behind a load-balancer with minimal fuss.  Thus, you should 
always be able to scale out by just throwing more 
machines/hardware at the problem.  Some architectures require 
shared state information for session maint. and thus don't scale 
to the same degree.

Just a few more thoughts (and one of the reasons I like Django).

-tkc



--~--~-~--~~~---~--~~
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: Serialization on part of a model

2006-10-06 Thread Daniel Roseman

Deryck Hodge wrote:
> I submitted http://code.djangoproject.org/ticket/2701 which provides a
> small patch to limit by field for the serializers module.  Something
> like -- serializers.serialize('xml', stories, fields=('headline',
> 'name'))
>
> Perhaps you could try the patch attached to the ticket.  Also, I
> mention it just to draw the core dev's attention to the patch.

Thanks a lot, this is exactly the sort of thing I was after.
Unfortunately, it doesn't seem to work on JSON. Running from the shell,
I get the following:

>>> serializers.serialize('json', sec.article_set.all(), fields=('id', 'name'))
Traceback (most recent call last):
  File "", line 1, in ?
  File "c:\mydown~1\django_mr\django\core\serializers\__init__.py",
line 55, in serialize
s.serialize(queryset, **options)
  File "c:\mydown~1\django_mr\django\core\serializers\base.py", line
52, in serialize
self.end_serialization()
  File "c:\mydown~1\django_mr\django\core\serializers\json.py", line
19, in end_serialization
simplejson.dump(self.objects, self.stream,
cls=DateTimeAwareJSONEncoder, **self.options)
  File "c:\mydown~1\django_mr\django\utils\simplejson\__init__.py",
line 115, in dump
check_circular=check_circular, allow_nan=allow_nan,
TypeError: __init__() got an unexpected keyword argument 'fields'

It works OK on XML, though. Any ideas?

--
Daniel.


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



"choices" option - possible bug?

2006-10-06 Thread MerMer

I have a field inside a model that uses the "choices" attribute:-

rating=models.IntegerField(choices=RATING_CHOICES).

This field is then being shown in the Class Admin list:-

class Admin:

list_display=('rating','promotion','review_headline','review_date','is_viewable')


Using the above code, the data for 'rating', within the Admin list
display is being shown as "(none)".

However, when I remove the choice=RATING_CHOICES, the data shows up.

This looks like a bug - can anybody explain this to me?

MerMer


--~--~-~--~~~---~--~~
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: Meta Data - How is it used effectively.

2006-10-06 Thread MerMer

Malcom,

Many thanks.  That's a big help.

MerMer


--~--~-~--~~~---~--~~
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: long-running process. how to do it?

2006-10-06 Thread Adam Blinkinsop

Couldn't you just fork a process (os.spawn*)?

My vote is for an email queue -- analogous to a print queue.  Do the
entire producer/consumer thing.


--~--~-~--~~~---~--~~
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's target applications?

2006-10-06 Thread fasces

Alot of marketing firms go through great lengths to discredit different
projects. With some of the RAD projects, they hit it right on the head.
There are alot of "RAD" frameworks out there that are easy and fast
TTM, but they don't scale and they lack the necessary weight in the
right areas. However, on the other hand, they fail to tell you about
their own demons. Like the XML pushups you have to go through or
architecture design decisions which you have to jump through to change
or work with. Django provides an incredibly simple framework with a
multitude of options for different caching and other low level
implementation decisions (which it achieves through decoupled code)
while keeping the design language at a "RAD" level. It's able to run on
mod_python which hooks straight into the C api of the apache framework.
It has 6 different caching mechanisms and an array of different schemes
or Middleware for controlling it's operation all of which are able to
manipulated and configured usually with less than 1-4 LOC. All the
while it maintains a simple API for rolling your own solutions. It's
also is based on python which has the added advantage of not being a
pain in the ass to use and keeping a low footprint and profile. If I
could describe it to somebody coming from a java background, it's like
springframework with out the java... or the j2ee... or the xml

Take a look for yourself.
http://www.djangoproject.com/documentation/cache/
http://www.djangoproject.com/documentation/middleware/
http://www.djangoproject.com/documentation/tutorial1/


--~--~-~--~~~---~--~~
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: show_all_rows = False returns db error message

2006-10-06 Thread schotm

Ok updated and everything is working fine. 
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: sharing session information with plone

2006-10-06 Thread ian

spacedman wrote:
> 
> ashwoods wrote:
>> does anybody have experience of sharing session information from a
>> plone site. I want our intranet users that are authenticaded in plone
>> to be able to access django without having to relog.
> 
>  Haven't done this directly, but what you'd have to do is get the __ac
> cookie that plone uses for sessions and use that.
> 
>  So, your django site would have to be on the same domain as your plone
> site.
> 
>  Then your django code would get the __ac cookie from the request.
> 
>  Then it would have to use something in the zope/plone API to get the
> username.
> 
>  Tricky bit would be talking to zope - I'm not sure how deep in the
> zope authentication system you'd have to go. It might be something we'd
> want to do on our site, so I might ponder it more later. If you get any
> ideas yourself, share them!
> 
> Barry
> 
> 
> > 
> 
Ola,
the Plone site says that Plone 2.5 uses a:

Pluggable Authentication Service
The new authentication structure in Plone 2.5 makes it very easy to
integrate any kind of authentication with Plone.  Roles, groups,
authentication, and user data are all managed with separate plugins, and
each can potentially get its data from a different source.  This offers
integrators substantial flexibility.  Plugins for LDAP and GMail (!)
already exist, and more are easily added.

there is an example of the GMail plugin here:
http://plone.org/products/gmailauthplugin

which is very simple and and can be used as a learning tool or even a
template.
If you do write something for Django send it to the list
[]'s

-- 
Ian Lawrence
Centre for Bioinformatics
INSTITUTO NACIONAL DE PESQUISAS DA AMAZÔNIA-INPA
RUA ANDRÉ ARAÚJO N º .2936 , BAIRRO DO ALEIXO
MANAUS-AMAZONAS-BRAZIL
Research Program in Biodiversity
http://ppbio.inpa.gov.br
PHONE: 055-92-3643-3358
CEP. 69011 -970

| Please do not send me documents in a closed
| format.(*.doc,*.xls,*.ppt)
| Use the open alternatives. (*.pdf,*.html,*.txt)
http://www.gnu.org/philosophy/no-word-attachments.html

"We are all in the gutter, but some of us are looking at the stars."

--~--~-~--~~~---~--~~
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: HTML entities

2006-10-06 Thread Dirk Eschler

Am Donnerstag, 5. Oktober 2006 23:11 schrieb Ivan Sagalaev:
> Dirk Eschler wrote:
> > In theory i can just use utf-8, but what if one participant in the line
> > (os, db, browser, whatever) can't handle it?
>
> Talking about client side, only very old browsers can't handle utf-8
> (NN4 and IE4 can). Same goes for email clients. And even such simple and
>   'legacy' software as Windows' Notepad can read and write utf-8 files
> since year 2000.
>
> And talking about server side that store and transfer your data, this is
> also safe as utf-8 was specifically designed to be compatible with old
> software that treats characters as bytes.
>
> All this means that currently in most cases there is no reason to do
> things in anything but utf-8 (edge cases where you can't do this are
> cases like shared DB server in some legacy encoding that you can't change).
>
> > Encodings stay one of those long time
> > mysteries to me. I'd happily adopt a practice that's fool proof.
>
> Unicode and utf-8 is specifically designed to eliminate all these
> encoding problems, to be the one universal encoding (though many
> Japanese developers don't think Unicode suits this goal).

Jup, i just stumbled into encoding problems with utf-8 pretty often. And that 
were situations where i thought that i didn't make any mistake. Mostly 
desktop related though, using older toolkits etc..

Nonetheless, i think it's about time to drop old habids and give utf-8 another 
try. Thanks everyone!

-- 
Dirk Eschler 
http://www.krusader.org

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



unable to find css when using '/'

2006-10-06 Thread Kenneth Gonsalves

hi,
i have a server hosting several django apps. most of the live in  
domainname/web/, where '/web/' is the name of the app. In apache,  
there is an alias '/media/' to django.media and an alias 'site_media'  
to project/site_media. Works. I am now hosting a new project where  
there are a set of subdomains - all configured identically to the  
above, but instead of '/web/' in the modpython config part, we have  
'/'. Neither admin nor the main site can find the media. The sites in  
question, on the same server are:

http://nrcfosshelpline.in/web/ <--- works
http://cms.rk.edu.pl<- doesnt work

help please, indo-polish friendship is at stake ;-)
-- 

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



Django's target applications?

2006-10-06 Thread Serg Kovrov

Hello, I'm new to Django (and Python) and have a few general questions.

Is Django meant to be used to create a sophisticated (as opposite to
rapid) web applications such as (for example) forums or e-shops? With
all bells and whistles, you know...

Does applications written on top of Django framework are scalable (for
example - newsgroup application like this one (Google groups) and
systems like eBay or Amazon)?

My questions are both in terms of performance and domain logic. E.g.
How easy/painful to maintain big Django-based project and how small/big
is performance overhead in such applications.

I'm asking because rapid web application development (RAD, RWAD?) is
indeed cool (and in real life deadlines are quite issues), but I'm more
interested in development of robust, maintainable, and scalable (mostly
big) applications.

Thanks.

-- serg.


--~--~-~--~~~---~--~~
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: Pydev and Django

2006-10-06 Thread olive

You are right Malcolm,

My project's PYTHONPATH was not set and Eclipse global one was pointing
to an old Django version used by another project.

Now all is OK.

THX


--~--~-~--~~~---~--~~
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: Meta Data - How is it used effectively.

2006-10-06 Thread Malcolm Tredinnick

On Fri, 2006-10-06 at 05:03 -0700, MerMer wrote:
> I'm trying to get my head around what Meta Data is - and more
> importantly how to use it effectively.
> 
> I've read that it is "anything in the data model that's not a field,
> such as ordering options etc" but I still don't quite get it.
> 
> Specifically.
> 
> 1. Are we constrained to those Meta Options listed in the Model
> documentation?  If not, how does one add a custom option? Are there any
> tuturials and examples of this?

You are constrained to what's in the documentation. The various
attributes in the Meta class are managed by the Options class in
django/db/models/options.py -- an instance of that class is created when
the model is imported into Python and attached to the model's class.

> 2. How are the Meta Options used exactly. For example if the option
> "order_with_respect_to = question" is set for a specific Model, will
> that be enforced every time that Models Manager is called?

I don't really understand this question. The various Meta attributes are
a bit of a grab bag of functionality; some of them act as data integrity
constraints, some for diagnostic purposes, some provide the natural
ordering on the model items, etc. So they come into effect at different
times.

> 3. Many of the Meta Model options seem to be heavily linked to how the
> data is to be viewed. Why isn't it in the View.Py instead?  I'm
> assuming that I haven't got the big picture on this.

In fact almost none of the Meta options are linked to view
functionality. Many of them control how the items are naturally ordered
or conditions on the fields when you are creating a model instance. They
come into play when you are creating new items or selecting the items in
order to use them in code (often in preparation for passing to a view,
but not exclusively so). The Meta attributes relate to the intrinsic
behaviour of the model itself. Models know nothing about views.

Only verbose_name and verbose_name_plural are really visual attributes
and they are more useful in back-end interfaces and debugging/logging
scenarios than actual code. It would be fairly rare to display those
names in a template (the admin application being an obvious exception).


Regards,
Malcolm


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



Re: Pydev and Django

2006-10-06 Thread Łukasz Langa

olive:
> Fabio,
>
> I'm using Django 0.95 and the console says :
>
> manage.py: error: no such option: --noreload
>
> Do I need a fresh SVN copy ?
>
> Olivier.
Here is a command that works for me:

manage.py runserver 8080 --noreload

Do you happen to forget the "runserver" part? The port is optional.

Regards,
Luke Langa



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



Meta Data - How is it used effectively.

2006-10-06 Thread MerMer

I'm trying to get my head around what Meta Data is - and more
importantly how to use it effectively.

I've read that it is "anything in the data model that's not a field,
such as ordering options etc" but I still don't quite get it.

Specifically.

1. Are we constrained to those Meta Options listed in the Model
documentation?  If not, how does one add a custom option? Are there any
tuturials and examples of this?

2. How are the Meta Options used exactly. For example if the option
"order_with_respect_to = question" is set for a specific Model, will
that be enforced every time that Models Manager is called?

3. Many of the Meta Model options seem to be heavily linked to how the
data is to be viewed. Why isn't it in the View.Py instead?  I'm
assuming that I haven't got the big picture on this.


MerMer


--~--~-~--~~~---~--~~
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: Odd self referencing behavior

2006-10-06 Thread fasces

Code posted for reference.

class Sect (models.Model):
shortName = models.CharField(maxlength=30)
superSect = models.ForeignKey(to='self', related_name="shortName",
null=True)

---in bash---
$ python manage.py validate site

site.sect: Accessor for field 'superSect' clashes with field
'Sect.shortName'. Add a related_name argument to the definition for
'superSect'.
site.sect: Reverse query name for field 'superSect' clashes with field
'Sect.shortName'. Add a related_name argument to the definition for
'superSect'.

Thank you Malcolm. That makes sense.


--~--~-~--~~~---~--~~
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: Odd self referencing behavior

2006-10-06 Thread Malcolm Tredinnick

On Fri, 2006-10-06 at 04:19 -0700, fasces wrote:
> I'm trying to run a simple model where a class references a member in
> itself, and I keep getting validation errors. I can't for the life of
> me figure out what's wrong. I'm using .95.
> 
> ---site.Sect.py---
> from django.db import models
> 
> class Sect (models.Model):
> shortName = models.CharField(maxlength=30)
> superSect = models.ForeignKey(to='self',related_name="shortName",
> null=True)
> 
> Then in the terminal I get the following on validation:
> $ python manage.py validate site.Sect
> site.sect: Accessor for field 'superSect' clashes with field
> 'Sect.shortName'. Add a related_name argument to the definition for
> 'superSect'.
> site.sect: Reverse query name for field 'superSect' clashes with field
> 'Sect.shortName'. Add a related_name argument to the definition for
> 'superSect'.

This warning is correct. The related_name attribute has the effect of
adding a new attribute to your class that you can use to work your way
backwards along the relationship (if superSect points to the containing
Sect, then the related_name attribute points to the set of contained
Sect objects).

However, you can't use shortName as the attribute name here, since you
already have an attribute called shortName. You need to pick a different
related_name.

Regards,
Malcolm



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



Re: Form/manipulator advanced tutorial?

2006-10-06 Thread Malcolm Tredinnick

On Fri, 2006-10-06 at 02:02 -0700, Peter Klein wrote:
> Hi Malcolm,
> 
> 
> > It's slightly lame justification, but one of the reasons there isn't an
> > advanced tutorial in this area is that we have been intending to replace
> > the current manipulator stuff for quite a few months now. Writing a
> > detailed tutorial takes a long time and, at least in my case, I've been
> > a little reluctant to invest more than a few hours into something that
> > is going to obsoleted fairly quickly.
> 
> Could you give a kind of preview of what is going to change with the
> upcoming 'forms' revision? Is there any way to prepare for the changes?
> We're currently developing an application with a lot of forms and I
> would like to reduce the refactoring to a minimum.

See this thread on django-developers:
http://groups.google.com/group/django-developers/browse_frm/thread/7eceb616b251cbd0/2615be5ec6d13bd1#2615be5ec6d13bd1

Not a lot you can do to "prepare" at the moment for that beyond keeping
it in mind, as far as I can see.

Regards,
Malcolm



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



Re: Pydev and Django

2006-10-06 Thread Malcolm Tredinnick

On Fri, 2006-10-06 at 06:07 +, olive wrote:
> Fabio,
> 
> I'm using Django 0.95 and the console says :
> 
> manage.py: error: no such option: --noreload
> 
> Do I need a fresh SVN copy ?

Strange. Russell add the "noreload" option back in July
(http://code.djangoproject.com/changeset/3348 ) and 0.95 wasn't released
until July 29. Are you sure you are running the code you think you are
are?

Regards,
Malcolm


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



Re: Odd self referencing behavior

2006-10-06 Thread fasces

Works fine with the svn version, so I'm quite sure you guys are aware
of it. Must be why you recommend it.

Sorry


--~--~-~--~~~---~--~~
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: HTML entities

2006-10-06 Thread Dirk Eschler

Am Freitag, 6. Oktober 2006 09:48 schrieb Holger Schurig:
> > >   
>
> Oh, I just noticed this with Konqueror from KDE 3.5.4: you can
> have this meta line in your base.html template as long as you
> want. When you use "./manage.py runserver", it won't be honored,
> the value from DEFAULT_CHARSET from settings.py takes
> precedence.

Aha! Funny you should mention that. I've run into the same problem yesterday 
(Konq is my main browser). It's one of those things that fuels my confusion 
about encodings. :)

-- 
Dirk Eschler 
http://www.krusader.org

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



Odd self referencing behavior

2006-10-06 Thread fasces

I'm trying to run a simple model where a class references a member in
itself, and I keep getting validation errors. I can't for the life of
me figure out what's wrong. I'm using .95.

---site.Sect.py---
from django.db import models

class Sect (models.Model):
shortName = models.CharField(maxlength=30)
superSect = models.ForeignKey(to='self',related_name="shortName",
null=True)

Then in the terminal I get the following on validation:
$ python manage.py validate site.Sect
site.sect: Accessor for field 'superSect' clashes with field
'Sect.shortName'. Add a related_name argument to the definition for
'superSect'.
site.sect: Reverse query name for field 'superSect' clashes with field
'Sect.shortName'. Add a related_name argument to the definition for
'superSect'.


--~--~-~--~~~---~--~~
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: Serialization on part of a model

2006-10-06 Thread Nikolaus Schlemm

> I submitted http://code.djangoproject.org/ticket/2701 which provides a
> small patch to limit by field for the serializers module.  Something
> like -- serializers.serialize('xml', stories, fields=('headline',
> 'name'))

excellent, definetely a "+1" from me!
-- 
cheers,

Nikl

--~--~-~--~~~---~--~~
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: Apache authentication: AttributeError: 'module' object has no attribute 'auth'

2006-10-06 Thread [EMAIL PROTECTED]

Hi.. thanks for your replies guys.

You're probably right... I'm running mod_python from the Ubuntu dapper
repositories which currently has version 3.1.4. Unfortunately the Edgy
package (which is 3.2.8) depends on a newer version of libc6 which
means that I really don't want to upgrade the package.

So if anyone know about a mod-python 3.2.8 package that would work
properly for Ubuntu Dapper I'd surely appreciate it.

Kind regards, Stefan Freyr.


--~--~-~--~~~---~--~~
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: Form/manipulator advanced tutorial?

2006-10-06 Thread Peter Klein

Hi Malcolm,


> It's slightly lame justification, but one of the reasons there isn't an
> advanced tutorial in this area is that we have been intending to replace
> the current manipulator stuff for quite a few months now. Writing a
> detailed tutorial takes a long time and, at least in my case, I've been
> a little reluctant to invest more than a few hours into something that
> is going to obsoleted fairly quickly.

Could you give a kind of preview of what is going to change with the
upcoming 'forms' revision? Is there any way to prepare for the changes?
We're currently developing an application with a lot of forms and I
would like to reduce the refactoring to a minimum.

Greetings,
Peter Klein


--~--~-~--~~~---~--~~
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: HTML entities

2006-10-06 Thread Holger Schurig

> >   

Oh, I just noticed this with Konqueror from KDE 3.5.4: you can 
have this meta line in your base.html template as long as you 
want. When you use "./manage.py runserver", it won't be honored, 
the value from DEFAULT_CHARSET from settings.py takes 
precedence.

--~--~-~--~~~---~--~~
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: Manipulators problem -- anyone? please help!

2006-10-06 Thread Carlos Yoder

Patrick, thanks for your reply.

I had actually tried similar methods to what you wrote -- the trouble
was with using the default Manipulators, since they need the passed
request collection to have the proper names, and since I was
"injecting" my PK via a template, the trouble was there... no idea why
this was not triggered in my local environment (maybe Sqlite is not as
picky ;-)

Regards and thanks again,

Carlos

On 10/6/06, patrickk <[EMAIL PROTECTED]> wrote:
>
> don´t know if this might help, but:
>
> let´s say you have this in your manipulator:
>
>  def save(self, data):
>  temp = UserExtendedProfile(
>  user = data['user'],
> 
>  )
>  temp.save()
>
> you could also use this:
>
>  def save(self, data):
>  temp = UserExtendedProfile(
>  user_id = data['user_id'],
> 
>  )
>  temp.save()
>
> so, depending on which version you choose ... your view could look
> like this:
>
> new_data = request.POST.copy()
> new_data['user'] = request.user
> errors = manipulator.get_validation_errors(new_data)
>
> or this:
>
> new_data = request.POST.copy()
> new_data['user_id'] = request.user.id
> errors = manipulator.get_validation_errors(new_data)
>
> patrick.
>
>
>
> Am 06.10.2006 um 09:04 schrieb Carlos Yoder:
>
> >
> > Here you go Gábor, it's three views. my_data(request) find out what to
> > do (change or add), and calls the proper view, either userprofile_add
> > or userprofile_change.
> >
> > Hope the python code is not too ugly!
> >
> > Thanks a million for taking the time to help, köszönöm szépen!
> >
> >
> > def my_data(request):
> > """ allow a logged user to change his data. proxy view that
> > calls proper views (add or change) """
> >
> > if request.user.is_anonymous():
> > return redirect_to_login(request.path)
> >
> > u = User.objects.get(pk=request.user.id)
> > try:
> > up = u.userprofile # trigger exception, if not found
> > return userprofile_change(request, u.id)
> > except UserProfile.DoesNotExist:
> > return userprofile_add(request)
> >
> > def userprofile_add(request):
> > """ Handle adding new userprofiles (one2one rel to User
> > objects) """
> >
> > from django import forms
> >
> > manipulator = UserProfile.AddManipulator()
> >
> > if request.POST:
> > # If data was POSTed, we're trying to create a new
> > UserProfile.
> > new_data = request.POST.copy()
> > user_id = request.user.id
> >
> > # Check for errors.
> > errors = manipulator.get_validation_errors(new_data)
> >
> > if not errors:
> > # No errors. This means we can save the data!
> > manipulator.do_html2python(new_data)
> > if new_data['user_id']:
> > pass
> > else:
> > new_data['user_id'] = user_id
> > new_userprofile = manipulator.save(new_data)
> >
> > # Redirect to the object's "edit" page. Always
> > use a redirect
> > # after POST data, so that reloads don't
> > accidently create
> > # duplicate entires, and so users don't see
> > the confusing
> > # "Repost POST data?" alert box in their
> > browsers.
> > return HttpResponseRedirect("/my_data/")
> > else:
> > # No POST, so we want a brand new form without any
> > data or errors.
> > errors = new_data = {}
> >
> > # Create the FormWrapper, template, context, response.
> > form = forms.FormWrapper(manipulator, new_data, errors)
> >
> > rc = RequestContext(request, {
> > 'form': form,
> > })
> > return render_to_response('userprofile.html', rc)
> >
> >
> > def userprofile_change(request, userprofile_id):
> > """ Handle editing userprofiles (one2one rel to User
> > objects) """
> > from django import forms
> >
> > from django.http import Http404
> >
> > try:
> > manipulator = UserProfile.ChangeManipulator
> > (userprofile_id)
> > except UserProfile.DoesNotExist:
> > raise Http404
> >
> > # Grab the  object in question for future use.
> > userprofile = manipulator.original_object
> >
> > if request.POST:
> > new_data = request.POST.copy()
> > errors = manipulator.get_validation_errors(new_data)
> > if not errors:
> > manipulator.do_html2python(new_data)
> > manipulator.save(new_data)
> > # Do a 

Re: Manipulators problem -- anyone? please help!

2006-10-06 Thread patrickk

don´t know if this might help, but:

let´s say you have this in your manipulator:

 def save(self, data):
 temp = UserExtendedProfile(
 user = data['user'],

 )
 temp.save()

you could also use this:

 def save(self, data):
 temp = UserExtendedProfile(
 user_id = data['user_id'],

 )
 temp.save()

so, depending on which version you choose ... your view could look  
like this:

new_data = request.POST.copy()
new_data['user'] = request.user
errors = manipulator.get_validation_errors(new_data)

or this:

new_data = request.POST.copy()
new_data['user_id'] = request.user.id
errors = manipulator.get_validation_errors(new_data)

patrick.



Am 06.10.2006 um 09:04 schrieb Carlos Yoder:

>
> Here you go Gábor, it's three views. my_data(request) find out what to
> do (change or add), and calls the proper view, either userprofile_add
> or userprofile_change.
>
> Hope the python code is not too ugly!
>
> Thanks a million for taking the time to help, köszönöm szépen!
>
>
> def my_data(request):
> """ allow a logged user to change his data. proxy view that
> calls proper views (add or change) """
>
> if request.user.is_anonymous():
> return redirect_to_login(request.path)
>
> u = User.objects.get(pk=request.user.id)
> try:
> up = u.userprofile # trigger exception, if not found
> return userprofile_change(request, u.id)
> except UserProfile.DoesNotExist:
> return userprofile_add(request)
>
> def userprofile_add(request):
> """ Handle adding new userprofiles (one2one rel to User  
> objects) """
>
> from django import forms
>
> manipulator = UserProfile.AddManipulator()
>
> if request.POST:
> # If data was POSTed, we're trying to create a new  
> UserProfile.
> new_data = request.POST.copy()
> user_id = request.user.id
>
> # Check for errors.
> errors = manipulator.get_validation_errors(new_data)
>
> if not errors:
> # No errors. This means we can save the data!
> manipulator.do_html2python(new_data)
> if new_data['user_id']:
> pass
> else:
> new_data['user_id'] = user_id
> new_userprofile = manipulator.save(new_data)
>
> # Redirect to the object's "edit" page. Always
> use a redirect
> # after POST data, so that reloads don't
> accidently create
> # duplicate entires, and so users don't see
> the confusing
> # "Repost POST data?" alert box in their  
> browsers.
> return HttpResponseRedirect("/my_data/")
> else:
> # No POST, so we want a brand new form without any
> data or errors.
> errors = new_data = {}
>
> # Create the FormWrapper, template, context, response.
> form = forms.FormWrapper(manipulator, new_data, errors)
>
> rc = RequestContext(request, {
> 'form': form,
> })
> return render_to_response('userprofile.html', rc)
>
>
> def userprofile_change(request, userprofile_id):
> """ Handle editing userprofiles (one2one rel to User  
> objects) """
> from django import forms
>
> from django.http import Http404
>
> try:
> manipulator = UserProfile.ChangeManipulator 
> (userprofile_id)
> except UserProfile.DoesNotExist:
> raise Http404
>
> # Grab the  object in question for future use.
> userprofile = manipulator.original_object
>
> if request.POST:
> new_data = request.POST.copy()
> errors = manipulator.get_validation_errors(new_data)
> if not errors:
> manipulator.do_html2python(new_data)
> manipulator.save(new_data)
> # Do a post-after-redirect so that reload  
> works, etc.
> return HttpResponseRedirect("/my_data/")
> else:
> errors = {}
> # This makes sure the form accurately represents the
> fields of the object.
> new_data = manipulator.flatten_data()
>
> form = forms.FormWrapper(manipulator, new_data, errors)
>
> rc = RequestContext(request, {
> 'form': form,
> 'userprofile': userprofile,
> })
>
> return render_to_response('userprofile.html', rc)
>
> Best regards,
>
> -- 
> Carlos Yoder
> http://blog.argentinaslovenia.com/
>
>
>> Carlos Yoder wrote:
>>> I'm really sorry to bug you 

Re: long-running process. how to do it?

2006-10-06 Thread Holger Schurig

> I wrote a daemonize method that can be called by the view to
> spawn a new process that executes your code.

Looks very similar to django.utils.daemonize :-)

--~--~-~--~~~---~--~~
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: Manipulators problem -- anyone? please help!

2006-10-06 Thread Carlos Yoder

ATTENTION ATTENTION ATTENTION!

I fixed it!

Brownie points to Raj for pointing to the right direction, so boys and
girls, when you're trying to pass a PK (such as user.id for a OneToOne
field exntending the User model) via a form, make sure you do it as
follows:



and NOT something like:



... because it won't work, and you'll get all sorts of crazy errors.
Trust me, I've been there!

Thanks all, and once again, the Django community rocks!


-- 
Carlos Yoder
http://blog.argentinaslovenia.com/


> Here you go Gábor, it's three views. my_data(request) find out what to
> do (change or add), and calls the proper view, either userprofile_add
> or userprofile_change.
>
> Hope the python code is not too ugly!
>
> Thanks a million for taking the time to help, köszönöm szépen!
>
>
> def my_data(request):
> """ allow a logged user to change his data. proxy view that
> calls proper views (add or change) """
>
> if request.user.is_anonymous():
> return redirect_to_login(request.path)
>
> u = User.objects.get(pk=request.user.id)
> try:
> up = u.userprofile # trigger exception, if not found
> return userprofile_change(request, u.id)
> except UserProfile.DoesNotExist:
> return userprofile_add(request)
>
> def userprofile_add(request):
> """ Handle adding new userprofiles (one2one rel to User objects) """
>
> from django import forms
>
> manipulator = UserProfile.AddManipulator()
>
> if request.POST:
> # If data was POSTed, we're trying to create a new 
> UserProfile.
> new_data = request.POST.copy()
> user_id = request.user.id
>
> # Check for errors.
> errors = manipulator.get_validation_errors(new_data)
>
> if not errors:
> # No errors. This means we can save the data!
> manipulator.do_html2python(new_data)
> if new_data['user_id']:
> pass
> else:
> new_data['user_id'] = user_id
> new_userprofile = manipulator.save(new_data)
>
> # Redirect to the object's "edit" page. Always
> use a redirect
> # after POST data, so that reloads don't
> accidently create
> # duplicate entires, and so users don't see
> the confusing
> # "Repost POST data?" alert box in their browsers.
> return HttpResponseRedirect("/my_data/")
> else:
> # No POST, so we want a brand new form without any
> data or errors.
> errors = new_data = {}
>
> # Create the FormWrapper, template, context, response.
> form = forms.FormWrapper(manipulator, new_data, errors)
>
> rc = RequestContext(request, {
> 'form': form,
> })
> return render_to_response('userprofile.html', rc)
>
>
> def userprofile_change(request, userprofile_id):
> """ Handle editing userprofiles (one2one rel to User objects) """
> from django import forms
>
> from django.http import Http404
>
> try:
> manipulator = UserProfile.ChangeManipulator(userprofile_id)
> except UserProfile.DoesNotExist:
> raise Http404
>
> # Grab the  object in question for future use.
> userprofile = manipulator.original_object
>
> if request.POST:
> new_data = request.POST.copy()
> errors = manipulator.get_validation_errors(new_data)
> if not errors:
> manipulator.do_html2python(new_data)
> manipulator.save(new_data)
> # Do a post-after-redirect so that reload works, etc.
> return HttpResponseRedirect("/my_data/")
> else:
> errors = {}
> # This makes sure the form accurately represents the
> fields of the object.
> new_data = manipulator.flatten_data()
>
> form = forms.FormWrapper(manipulator, new_data, errors)
>
> rc = RequestContext(request, {
> 'form': form,
> 'userprofile': userprofile,
> })
>
> return render_to_response('userprofile.html', rc)
>
> Best regards,
>
> --
> Carlos Yoder
> http://blog.argentinaslovenia.com/
>
>
> > Carlos Yoder wrote:
> > > I'm really sorry to bug you like this, but I don't know what to do --
> > > being a newbie to both Python and Django, debugging for me is more
> > > like 'aha, the problem should be around here', but nothing concrete
> > > about fixing!
> > >
> >
> > hi,
> >
> > could you also post your view code?
> >
> > gabor
>

--~--~-~--~~~---~--~~
You received this messag

Re: Manipulators problem -- anyone? please help!

2006-10-06 Thread Carlos Yoder

Here you go Gábor, it's three views. my_data(request) find out what to
do (change or add), and calls the proper view, either userprofile_add
or userprofile_change.

Hope the python code is not too ugly!

Thanks a million for taking the time to help, köszönöm szépen!


def my_data(request):
""" allow a logged user to change his data. proxy view that
calls proper views (add or change) """

if request.user.is_anonymous():
return redirect_to_login(request.path)

u = User.objects.get(pk=request.user.id)
try:
up = u.userprofile # trigger exception, if not found
return userprofile_change(request, u.id)
except UserProfile.DoesNotExist:
return userprofile_add(request)

def userprofile_add(request):
""" Handle adding new userprofiles (one2one rel to User objects) """

from django import forms

manipulator = UserProfile.AddManipulator()

if request.POST:
# If data was POSTed, we're trying to create a new UserProfile.
new_data = request.POST.copy()
user_id = request.user.id

# Check for errors.
errors = manipulator.get_validation_errors(new_data)

if not errors:
# No errors. This means we can save the data!
manipulator.do_html2python(new_data)
if new_data['user_id']:
pass
else:
new_data['user_id'] = user_id
new_userprofile = manipulator.save(new_data)

# Redirect to the object's "edit" page. Always
use a redirect
# after POST data, so that reloads don't
accidently create
# duplicate entires, and so users don't see
the confusing
# "Repost POST data?" alert box in their browsers.
return HttpResponseRedirect("/my_data/")
else:
# No POST, so we want a brand new form without any
data or errors.
errors = new_data = {}

# Create the FormWrapper, template, context, response.
form = forms.FormWrapper(manipulator, new_data, errors)

rc = RequestContext(request, {
'form': form,
})
return render_to_response('userprofile.html', rc)


def userprofile_change(request, userprofile_id):
""" Handle editing userprofiles (one2one rel to User objects) """
from django import forms

from django.http import Http404

try:
manipulator = UserProfile.ChangeManipulator(userprofile_id)
except UserProfile.DoesNotExist:
raise Http404

# Grab the  object in question for future use.
userprofile = manipulator.original_object

if request.POST:
new_data = request.POST.copy()
errors = manipulator.get_validation_errors(new_data)
if not errors:
manipulator.do_html2python(new_data)
manipulator.save(new_data)
# Do a post-after-redirect so that reload works, etc.
return HttpResponseRedirect("/my_data/")
else:
errors = {}
# This makes sure the form accurately represents the
fields of the object.
new_data = manipulator.flatten_data()

form = forms.FormWrapper(manipulator, new_data, errors)

rc = RequestContext(request, {
'form': form,
'userprofile': userprofile,
})

return render_to_response('userprofile.html', rc)

Best regards,

-- 
Carlos Yoder
http://blog.argentinaslovenia.com/


> Carlos Yoder wrote:
> > I'm really sorry to bug you like this, but I don't know what to do --
> > being a newbie to both Python and Django, debugging for me is more
> > like 'aha, the problem should be around here', but nothing concrete
> > about fixing!
> >
>
> hi,
>
> could you also post your view code?
>
> 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
-~--~~~~--~~--~--~---