Re: Django + views like a threads

2006-10-13 Thread Malcolm Tredinnick

On Fri, 2006-10-13 at 11:18 -0700, pako wrote:
> It is possible to run view method in new thread?
> For example if i have
> 
> (r'^items/(?P\d)/$', 'cyber.core.views.list_items')
> 
> and function list_items do sleep(10) a new requests to django
> application will not be acceptable, cause main thread is currently
> sleeping by list_items function.
> So any ideas?

No, Django doesn't have a built-in facility to do this. It just doesn't
make a lot of sense for the web-page presentation side of a framework.

If you have a task that is going to do a heavy computation, it is up to
you to fork off a new process or run it in a thread. Since you can put
anything you like in your view, this means you can choose whatever
library or code you want to manage this dispatching.

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: no action logging in admin panel

2006-10-13 Thread Malcolm Tredinnick

On Fri, 2006-10-13 at 17:17 +, [EMAIL PROTECTED] wrote:
> Is there a way to disable logging of actions in the admin panel
> (add/edit/changed entries of models-apps) ?

Not without hacking the source, no.

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: Caching with cache middleware disabled?

2006-10-13 Thread RajeshD


> Any other ideas?

Yes. You mention that you "use some available Django generic views".
Can you show us your urls.py?

It's possible that your QuerySet is being cached. For example, if you
happen to be using the QuerySet through the extra_dict parameter of
your generic views instead of as part of the info_dict parameter. This
would be consistent with your observation that the first time the
server starts it shows the right date and never afterwards.


--~--~-~--~~~---~--~~
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: Model-level DB cache

2006-10-13 Thread nara

wasn't a DB cache issue in my case, just a bug in my model code.
The first run of unittest silently failed, and subsequent ones showed
the above stack trace.

Running stuff in the python interpreter helped find the problem.
I do a connection._rollback() at the start of my unittest now, as
insurance.

/Nara


--~--~-~--~~~---~--~~
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: What IDE do you use? (semi-OT)

2006-10-13 Thread David Sissitka
I think RadRails was created because of the hype that Rails generated, everyone wanted to try it out and a lot of people aren't comfortable with a terminal. Either way, it's more then a Rails aware editor. What features would you like to see, what couldn't be accomplished from an existing Python IDE? All of the features that I can think of present in RadRails are either bloat or not relevant to Django:
Database Administrator - To slow for practical use, and Django lacks migrations.Generators - Based on the generators built in to Rails.Quick switch from controller action to the relevant view. - There isn't a standard convention for such a thing in Django, though I guess the template name could be pulled from the view.
Testing Helpers - Could be done from exisitng Python IDEs.Built in terminal for debugging and launching a develpment server. - There are better applications that do just that, on OS X there is iTerm, on Windows there is Console2 and PromptPal, not sure about Linux.
-David SissitkaOn 10/13/06, Norjee <[EMAIL PROTECTED]> wrote:
Rob Hudson schreef:> Should Django look at creating something like what RadRails is for RoR?> http://www.radrails.org/>> It's built on top of Eclipse.  The screencasts look pretty cool.
>> -RobImho it would be a waste of ressourceries better spend on Djangoitself. As you can already see in this topic, plenty IDE's areavailable for python/django.Rails has/had the problem that it had a lot of "magic"; automagic
import of classes/modules/mixins (and automagic creation of functions)this makes code completion by some form of introspection nearlyimpossible, thus it was usefull to create an ide that was aware of therails syntax. For Django, any half-decent IDE suffices. (But this is
personal, I don't really need an IDE based interface to manage.py orother fancy stuff)Only the templates might benefit a little. But as Django templates areto be void of logic (as should all templates) i don't think it is
really needed to develop an entire ide for that. A few additions to theword-file of your favourite editor shout do the trick.For what's it word. I like Wing IDE (after messing with ultraedit andkomodo) for python stuff, and use ultra-edit for the templates.

--~--~-~--~~~---~--~~
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: What IDE do you use? (semi-OT)

2006-10-13 Thread Norjee

Rob Hudson schreef:

> Should Django look at creating something like what RadRails is for RoR?
> http://www.radrails.org/
>
> It's built on top of Eclipse.  The screencasts look pretty cool.
>
> -Rob

Imho it would be a waste of ressourceries better spend on Django
itself. As you can already see in this topic, plenty IDE's are
available for python/django.

Rails has/had the problem that it had a lot of "magic"; automagic
import of classes/modules/mixins (and automagic creation of functions)
this makes code completion by some form of introspection nearly
impossible, thus it was usefull to create an ide that was aware of the
rails syntax. For Django, any half-decent IDE suffices. (But this is
personal, I don't really need an IDE based interface to manage.py or
other fancy stuff)
Only the templates might benefit a little. But as Django templates are
to be void of logic (as should all templates) i don't think it is
really needed to develop an entire ide for that. A few additions to the
word-file of your favourite editor shout do the trick.

For what's it word. I like Wing IDE (after messing with ultraedit and
komodo) for python stuff, and use ultra-edit for the templates.


--~--~-~--~~~---~--~~
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 with cache middleware disabled?

2006-10-13 Thread [EMAIL PROTECTED]

It doesn't seem to be timezone related because if I restart the server
as soon as I post the blog entry the main page includes that post.

Any other ideas?

Cheers


--~--~-~--~~~---~--~~
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: email_user with text/html type

2006-10-13 Thread Guillermo Fernandez Castellanos

Hi,

This might help you get going (see at the end). I modified a bit the
function that sends the mail in Django. It is probably very far from
as good as it could be.

I am actually surprised as well that there's no function for that.

Hope it helps,

G

# Use this module for e-mailing.

from django.conf import settings
from django.utils.html import strip_tags, strip_spaces_between_tags
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.Header import Header
import smtplib, rfc822

class BadHeaderError(ValueError):
pass

class SafeMIMEMultipart(MIMEMultipart):
def __setitem__(self, name, val):
"Forbids multi-line headers, to prevent header injection."
if '\n' in val or '\r' in val:
raise BadHeaderError, "Header values can't contain
newlines (got %r for header %r)" % (val, name)
if name == "Subject":
val = Header(val, settings.DEFAULT_CHARSET)
MIMEText.__setitem__(self, name, val)

def send_mass_mail(datatuple, fail_silently=False,
auth_user=settings.EMAIL_HOST_USER,
auth_password=settings.EMAIL_HOST_PASSWORD):
"""
Given a datatuple of (subject, message, from_email, recipient_list), sends
each message to each recipient list. Returns the number of e-mails sent.

If from_email is None, the DEFAULT_FROM_EMAIL setting is used.
If auth_user and auth_password are set, they're used to log in.
"""
# We prepare the server to send messages.
try:
server = smtplib.SMTP(settings.EMAIL_HOST, settings.EMAIL_PORT)
if auth_user and auth_password:
server.login(auth_user, auth_password)
except:
#print 'Server preparation did not work'
if fail_silently:
return
raise
num_sent = 0
# We prepare the message to be sent.
for subject, message, from_email, recipient_list in datatuple:
if not recipient_list:
continue
from_email = from_email or settings.DEFAULT_FROM_EMAIL
# Create the root message and fill in the basic headers
msgRoot = MIMEMultipart('related')
msgRoot['Subject'] = subject
msgRoot['From'] = from_email
msgRoot['To'] = ', '.join(recipient_list)
msgRoot['Date'] = rfc822.formatdate()
msgRoot.preamble = 'This is a multi-part message in MIME format.'
# Encapsulate the plain and HTML versions of the message body in an
# 'alternative' part, so message agents can decide which they
want to display.
msgAlternative = MIMEMultipart('alternative')
msgRoot.attach(msgAlternative)
# This is the html message.
msgText = MIMEText(message, 'html', settings.DEFAULT_CHARSET)
msgAlternative.attach(msgText)
# This is the alternative plain text message.
msgText =
MIMEText(strip_spaces_between_tags(strip_tags(message)), 'plain',
settings.DEFAULT_CHARSET)
msgAlternative.attach(msgText)
# We send the actual message
try:
server.sendmail(from_email, recipient_list, msgRoot.as_string())
num_sent += 1
except:
if not fail_silently:
raise
# We quit elegantly
try:
server.quit()
except:
if fail_silently:
return
raise
return num_sent


On 10/14/06, Don Arbow <[EMAIL PROTECTED]> wrote:
>
> On Oct 13, 2006, at 2:58 PM, sdm wrote:
> >
> > Hi, I look in the documentation, but don't have found how can I
> > send an
> > email with html content, how can I do it?
>
>
>
> That's because it's not a Django question, but a Python one. Here's a
> link to a page showing how to send HTML emails using the Python
> libraries:
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/473810
>
> 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: Paginator Overhall

2006-10-13 Thread sago


Adrian Holovaty wrote:
> I love the idea of a Paginator class that knows what page it's on.
Maybe a solution is to get a 'page' object back from the original
paginator. So you can still call its methods to get individual morsels
of data, or call a get_page_info method to get a PageInfo object back
with all its bits in place. Then the paginator doesn't have to be page
aware.

> > 5. Orphans - see Chris' ticket.
> I'm not 100% sold on this, but I'll give it some more thought...

I've only ever needed this once, when the paginator was paginating
(sic?) the sections of a report. In normal lists I don't mind orphans,
but if the facility was there, I think I'd probably use it, because I
rarely _need_ exactly n items on a page.

> The problem with QuerySets implementing __len__ is that sometimes you
> care about the length of the QuerySet *after* the query has been done,
> and sometimes you care about the number of records (i.e., *before* the
> query has been done).

Couldn't __len__ then do likewise: if the query hasn't been dispatched
it runs a count query, if it has it runs len on the result set.

> I like this suggestion for the paginator, though. What about one of
> these solutions:
>
> * Try .count() first. If the method doesn't exist, use len().
Exactly what I was thinking. A relatively minimal change, and very
useful.

> * Pass an optional count_method to the constructor, which defaults to
> 'count', but people could pass in '__len__' if they wanted. This is
> slightly less elegant than the previous solution.
Personally doesn't float my boat, but still very usable.

>> 7. You should be able to get a whole dictionary of data ...
> I think this wouldn't be necessary if we had a PaginatorPage (as
> suggested in #2576), because, in theory, the PaginatorPage would have
> access to all the stuff you needed in your template. Am I missing
> something?

No, that's right. To me this is the absolute biggest thing. When I want
to render a page, I want an object accessible through template methods
only (so no tedious processing in the view) that can give me everything
I need to render the links to give context and to navigate through
pages in the list. Ideally this would be an object (like
PaginatorPage), otherwise a dictionary would do.
 
Ian.


--~--~-~--~~~---~--~~
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: email_user with text/html type

2006-10-13 Thread Don Arbow

On Oct 13, 2006, at 2:58 PM, sdm wrote:
>
> Hi, I look in the documentation, but don't have found how can I  
> send an
> email with html content, how can I do it?



That's because it's not a Django question, but a Python one. Here's a  
link to a page showing how to send HTML emails using the Python  
libraries:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/473810

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



email_user with text/html type

2006-10-13 Thread sdm

Hi, I look in the documentation, but don't have found how can I send an
email with html content, how can I do it?


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



Re: [tool] Autodoc (a script to grap and generate django documentation at html format)

2006-10-13 Thread Jyrki Pulliainen

On 10/13/06, Nicolas Steinmetz <[EMAIL PROTECTED]> wrote:
>
> Jyrki Pulliainen wrote:
>
> > Script seems to work. However: Python-docutils package (at least on my
> > Ubuntu Dapper) ships with buildhtml.py-script, which can be found in
> > /usr/share/python-docutils/ directory. That recurses through
> > directories converting all .txt files to .html. Recursive conversion
> > is default behaviour and it can be changed with a switch. That way, a
> > 2 line command line script would do the same thing that your thing.
>
> That's what I was afraid of ;-)

I've been through the same experience many many times too =)

>
> > Though, making that one, you've propably learned something. If you
> > want to process your script further, I'd suggest exploring the
> > docutils package for generating the html with python instead of
> > calling command line script. Would make the solution neater. Also, the
> > svn has a client libraries for python too.
>
> I know it's not the perfect script and that it could be optimised in many
> ways. As I discover the python world, I tried to make a first simple
> script. I was guessing that docutils could be used directly, I now have to
> dive into this (and also into svn lib...).

Own trivial projects are the best way to learn things. Have fun diving
in to that world =)

-- 
Jyrki // [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: [tool] Autodoc (a script to grap and generate django documentation at html format)

2006-10-13 Thread Nicolas Steinmetz

Jyrki Pulliainen wrote:

> Script seems to work. However: Python-docutils package (at least on my
> Ubuntu Dapper) ships with buildhtml.py-script, which can be found in
> /usr/share/python-docutils/ directory. That recurses through
> directories converting all .txt files to .html. Recursive conversion
> is default behaviour and it can be changed with a switch. That way, a
> 2 line command line script would do the same thing that your thing.

That's what I was afraid of ;-)
 
> Though, making that one, you've propably learned something. If you
> want to process your script further, I'd suggest exploring the
> docutils package for generating the html with python instead of
> calling command line script. Would make the solution neater. Also, the
> svn has a client libraries for python too.

I know it's not the perfect script and that it could be optimised in many
ways. As I discover the python world, I tried to make a first simple
script. I was guessing that docutils could be used directly, I now have to
dive into this (and also into svn lib...).

Nicolas


--~--~-~--~~~---~--~~
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: [tool] Autodoc (a script to grap and generate django documentation at html format)

2006-10-13 Thread Jyrki Pulliainen

On 10/13/06, Nicolas Steinmetz <[EMAIL PROTECTED]> wrote:
> New to django/python, and as I work often in the train, I was interested in
> reading the djando doc offline.
>
> So I wrote my first python script that :
> * grap last version of the doc on the svn
> * generate html version of all files (via rst2html).
>
> autodoc is available here :
>
> 
>
> It may help some of you, that's why I report it here ;-)
>
> I'm open to all your remarks/comments/suggestions
>

Script seems to work. However: Python-docutils package (at least on my
Ubuntu Dapper) ships with buildhtml.py-script, which can be found in
/usr/share/python-docutils/ directory. That recurses through
directories converting all .txt files to .html. Recursive conversion
is default behaviour and it can be changed with a switch. That way, a
2 line command line script would do the same thing that your thing.

Though, making that one, you've propably learned something. If you
want to process your script further, I'd suggest exploring the
docutils package for generating the html with python instead of
calling command line script. Would make the solution neater. Also, the
svn has a client libraries for python too.
-- 
Jyrki // [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
-~--~~~~--~~--~--~---



new site, satellite internet, and the django admin

2006-10-13 Thread rp

here's a sporadic after work project motivated
by my cousin, she and her partner are avid poker players
travelling in an airstream trailer/using the django admin . . .

  http://www.thepokeratlas.com  (no links/connections to online poker)

e.g. of tournament data:

http://www.thepokeratlas.com/venue/connecticut/foxwoods-resort-casino/tournaments/thisweek/

still in "pre-beta" development (adding basic functions, dev/live
restart on same low-cost server, etc)

however, there was no way to get even this much venue/tournament
information together in w/o the django data models, admin, and this
user list:)

thanks,

raman


--~--~-~--~~~---~--~~
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 + views like a threads

2006-10-13 Thread pako

orestis wrote:
> Why do you sleep(10) ? I can't think of any possible reason...

It's only example which is simulating very big system load. I want to
create application which will be creating threads with nonblocking
tasks list (in queue). If application has new request - he's adding new
task to list, but previous tasks can be not completed.
It's hard to describe...


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



[tool] Autodoc (a script to grap and generate django documentation at html format)

2006-10-13 Thread Nicolas Steinmetz

Hi,

New to django/python, and as I work often in the train, I was interested in
reading the djando doc offline.

So I wrote my first python script that :
* grap last version of the doc on the svn
* generate html version of all files (via rst2html).

autodoc is available here :



It may help some of you, that's why I report it here ;-)

I'm open to all your remarks/comments/suggestions

Nicolas


--~--~-~--~~~---~--~~
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 + views like a threads

2006-10-13 Thread orestis

Why do you sleep(10) ? I can't think of any possible reason...


--~--~-~--~~~---~--~~
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: What IDE do you use? (semi-OT)

2006-10-13 Thread Rob Hudson

Should Django look at creating something like what RadRails is for RoR?
http://www.radrails.org/

It's built on top of Eclipse.  The screencasts look pretty cool.

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



wsgi server

2006-10-13 Thread hv @ Fashion Content

Does anyone use the wsgi server? in particular with ajp binding?

I continue to get an access forbidden message, but see nothing in the logs.

Any ideas of how I can debug it ?

Henrik 

--~--~-~--~~~---~--~~
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 + views like a threads

2006-10-13 Thread pako

It is possible to run view method in new thread?
For example if i have

(r'^items/(?P\d)/$', 'cyber.core.views.list_items')

and function list_items do sleep(10) a new requests to django
application will not be acceptable, cause main thread is currently
sleeping by list_items function.
So any ideas?

(sorry for poor english)


--~--~-~--~~~---~--~~
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: AttributeError thrown by Validator

2006-10-13 Thread RajeshD


> if request.FILES:
> new_data = new_data.update(request.FILES)
>

Change that to:

if request.FILES:
new_data.update(request.FILES)


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



AttributeError thrown by Validator

2006-10-13 Thread Paul Childs

I am sure that I have read everything there is available in the
newsgroup and docs concerning uploading files.
If I missed something I apologize in advance.

Right now all I am trying to do is upload a file and use the
manipulator to validate that it is not missing. Everything seems to be
working except when I call the manipulator.get_validation_errors
method. It throws an exception (see traceback below).

If I don't update the new_data dictionary with request.FILES then I get
a  'This field is required.' error.

I commented out the method call and did verify that the file was
uploaded to the view.

Any help would be most appreciated.

I am using Django 0.95

-
View:
-
def upload_album(request):

manipulator = AlbumUploadManipulator()

if request.POST:
new_data = request.POST.copy()


# if this if statement is commented out then
# 'error_dict': {'album_file': ['This field is required.']}
if request.FILES:
new_data = new_data.update(request.FILES)

# exception gets thrown here
errors = manipulator.get_validation_errors(new_data)


if not errors:



return HttpResponseRedirect("/albums/")

else:
errors = new_data = {}

form = forms.FormWrapper(manipulator, new_data, errors)
return render_to_response('upload_form.html', {'form': form})


-
Manipulator:
-
from django import forms

class AlbumUploadManipulator(forms.Manipulator):

def __init__(self):
self.fields = (
forms.TextField(field_name="album_name",
length=30, maxlength=200,
is_required=True),
forms.FileUploadField(field_name="album_file",
is_required=True),
)
--
Template:
--



 Name:
 {{ form.album_name }}
 
 File:
 {{ form.album_file }}
 {{ form.album_file_file }}







--
Traceback:
--
Traceback (most recent call last):
File
"c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core\handlers\base.py"
in get_response
  74. response = callback(request, *callback_args, **callback_kwargs)
File "C:\Documents and Settings\HIAPRC\My
Documents\Python\wilds\..\wilds\albums\views.py" in upload_album
  29. errors = manipulator.get_validation_errors(new_data)
File
"c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\forms\__init__.py"
in get_validation_errors
  58. errors.update(field.get_validation_errors(new_data))
File
"c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\forms\__init__.py"
in get_validation_errors
  345. if self.is_required and not new_data.get(self.field_name,
False):

  AttributeError at /albums/upload_album/
  'NoneType' object has no attribute 'get'


--~--~-~--~~~---~--~~
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: Extending the user model

2006-10-13 Thread Stefán Freyr Stefánsson
Sorry to "fork" this thread. And thank you to Dirk for pointing out the article and verifying that it is the "right thing to do"(tm).I have to do this as well (that is, enhance the User object a bit) but not quite in the same way as this is intended I believe. The thing is that I'm using mod_auth_mysql for Apache authentication and I want to use that against the Django auth system. For reasons I won't go into here I cannot use the recommended way of authenticating a user directly against the django auth database (having mostly to do with outdated mod_python packages in my distro etc.).
So I'd like to ask if there's any mechanism of "intersecting" when a user is updated through the admin interface. What I will need to store in my UserProfile table is the "pure" SHA-1 hash of the user to enable mod_auth_mysql to use that field (it won't understand the alg$seed$hash syntax used in the django user table.
So I would of course like to do this transparently, by intersepting both create user and update user queries where I get the password in plaintext and put the pure hash in my database. Other than that I want the exact same behavior of what the auth system in django does right now.
Can anybody think of a way of accomplishing this? Am I destined to have to duplicate and modify my own version of the django user administration interface/handler layer? What is in your oppinion the least painful (as in duplication of code) way of accomplishing this?
Kind regards, Stefan Freyr.On 10/13/06, Dirk Eschler <[EMAIL PROTECTED]> wrote:
Am Freitag, 13. Oktober 2006 13:58 schrieb Malcolm Tredinnick:> On Fri, 2006-10-13 at 13:20 +0200, Dirk Eschler wrote:> > Hello,> >> > is the method described at the below link still the recommended one?
> > http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model>> Yes. Is there something you are trying to do that isn't accomplished by
> that method?Thanks for the quick response. And sorry for not being more precise. I haven'ttried it yet. Just wanted to be sure, that the article doesn't refer to anobsolete version of Django. It mentioned that things might change in future
releases, model subclassing in particular.Best Regards,Dirk Eschler--Dirk Eschler [EMAIL PROTECTED]>
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  -~--~~~~--~~--~--~---


no action logging in admin panel

2006-10-13 Thread [EMAIL PROTECTED]

Is there a way to disable logging of actions in the admin panel
(add/edit/changed entries of models-apps) ?


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



Re: mod_python

2006-10-13 Thread doug

test server is running at http://oviparo.us  with configs listed- Doug

On Oct 13, 12:23 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> http://oviparo.us/redirects tohttp://oviparo.us/
>
> please post here your VirtualHost config. also, 1st thing to make sure,
> you are
> coming to right VirtualHost (so place some file in your htdocs to see
> if you can fetch it)
>
> 2nd step is make sure you have your  directives point to
> right place.


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



Re: mod_python

2006-10-13 Thread Serg Kovrov

Note, that you have to restart apache after you make changes in your
python source files.

On Oct 13, 4:04 am, "doug" <[EMAIL PROTECTED]> wrote:
> I am setting up mod_python on test server and having some problems. I
> am getting 'it worked!' initially- I am able to access admin and set up
> flatpages. But I hit a wall when just trying to do 'polls' app ...
> getting 404s only . No problem when using development server.
>
> test server with settings is  here->  http://oviparo.us
> 
> Thanks-Doug


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



Re: mod_python

2006-10-13 Thread [EMAIL PROTECTED]

http://oviparo.us/ redirects to http://oviparo.us/

please post here your VirtualHost config. also, 1st thing to make sure,
you are
coming to right VirtualHost (so place some file in your htdocs to see
if you can fetch it)

2nd step is make sure you have your  directives point to
right place.


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



Re: Custom Template Tag - What do I need in my actual template?

2006-10-13 Thread MerMer

Tim,

Many thanks - that works a treat.  I was getting myself very confused
about where and how to use the context.

Cheers

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



How can I inspect the content of bound_related_object in admin/edit_inline_tabular.html ?

2006-10-13 Thread [EMAIL PROTECTED]

Hi

I make some hack on admin/edit_inline_tabular.html template but I don't
know the content of bound_related_object. In general, how can I inspect
(debug ?) this objects ?

Thanks for your help.
Stephane


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



mod_python

2006-10-13 Thread doug

I am setting up mod_python on test server and having some problems. I
am getting 'it worked!' initially- I am able to access admin and set up
flatpages. But I hit a wall when just trying to do 'polls' app ...
getting 404s only . No problem when using development server.

test server with settings is  here->  http://oviparo.us   

Thanks-Doug


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

2006-10-13 Thread Guillermo Fernandez Castellanos

Hi,

I think I am going to go to the DateField solution.
I did not want to store the year because:
1) I do not know the years of all my friends, although I know the days.
2) Not everyone likes everybody to see how old they are :-)

Thanks all for your answer.

G

On 10/13/06, Antonio Cavedoni <[EMAIL PROTECTED]> wrote:
>
> On 13 Oct 2006, at 0:24, Guillermo Fernandez Castellanos wrote:
> > I am trying to keep a birthday field in the database. But i am only
> > interested in the day and month. Is there a way of using a DateField
> > but only with day and month fields? Or should I use another solution?
>
> A DateField looks like what you want: instead of storing just day and
> month, why not store also the year somebody was born? That way you
> can calculate stuff like "ZOMG, it's your 27th birthday, you're
> getting old!" :-)
>
> 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: Custom Template Tag - What do I need in my actual template?

2006-10-13 Thread Tim Shaffer

Your code looks valid as it is right now. The get_latest_polls function
should return a QuerySet of the three latest polls.

When you call this function it will get the polls and assign the
QuerySet to the "polls" variable for use in your template.

In order to display the polls, you would need to do something like
this:

{% get_latest_polls 3 %}

{% for poll in polls %}
{{ polls.question }}
{% endfor %}


--~--~-~--~~~---~--~~
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: Paginator Overhall

2006-10-13 Thread Adrian Holovaty

On 10/12/06, sago <[EMAIL PROTECTED]> wrote:
> So I suggest, its time to see what people need from Paginator and make
> a serious joint contribution to a complete system.

Thanks for bringing this up. I'd like to make some big improvements to
the paginator class, and you touched on most (all?) things that I'd
like to improve...

> 1. Is there any point in having a paginator object and then having to
> request data from it on a page by page basis? IMHO the use-case is:
> create a query set, feed it to a paginator, tell the paginator which
> page of results you want, render that page. So the paginator should
> have a set_page method (related to 7 below).

I love the idea of a Paginator class that knows what page it's on. The
patch in http://code.djangoproject.com/ticket/2576 does exactly this.
I'd prefer to have it be a separate class, rather than make Paginators
optionally page-aware.

> 2. Most page-by-page views have this data:
> a) The list of objects on that page.
> b) The 1-indexed number of the first and last object on the page (e.g.
> results 1-10).
> c) The total number of results (e.g. results 1-10 of 100).

We already cover c) with paginator.hits. As for b), it'd be nice to
have a paginator.firstindex and paginator.lastindex, or some better
name. And a) is achieved by paginator.get_page().

> 3. I can think of many applications where it is useful to be able to
> move between pages. Has next and Has previous is fine. But forums,
> google &c often have a page list. It would be useful to have paginator
> returning a list of pages (e.g. if pages returns 4, it would be nice to
> have something returne range(1,5)). It isn't hard to trap the number of
> pages and run it through range, of course, but DRY suggests this could
> be in the paginator class rather than any view that needs it. This
> becomes more critical with...

Yes! I've implemented this so many times on my own that I think it
should be in the paginator class.

> 4. More intelligent lists of pages. In my application there may be many
> tens of pages. So I do a google-like thing of having a subset of the
> pages as direct links. If the user is on page 15 of 50, for example, I
> might have links to pages [1,2,12,13,14,15,16,17,18,49,50]. Actually I
> like to have dots to signify non-contiguous numbering. So currently I
> return [1,2,None,12,13... etc], but that may just be me.

I've done the [1, 2, None, 12, 13...] thing myself. Let's do this in
paginator as well.

> 5. Orphans - see Chris' ticket.

I'm not 100% sold on this, but I'll give it some more thought...

> 6. Fallback to finding the number of hits with len() rather than
> .count(). That single change would allow paginators to paginate any
> sequence-like object, not just query sets. [As an aside Django's query
> sets should probably implement __len__ as an alias for .count() to be
> more 'pythonic'. Would this cause any side-effects?]

The problem with QuerySets implementing __len__ is that sometimes you
care about the length of the QuerySet *after* the query has been done,
and sometimes you care about the number of records (i.e., *before* the
query has been done).

I like this suggestion for the paginator, though. What about one of
these solutions:

* Try .count() first. If the method doesn't exist, use len().

* Pass an optional count_method to the constructor, which defaults to
'count', but people could pass in '__len__' if they wanted. This is
slightly less elegant than the previous solution.

* Or, both!

> 7. You should be able to get a whole dictionary of data about the page
> back in one go. So I can just get my page information (consisting of
> the above) and pass it right along to the template renderer. This again
> is a DRY principle related to the most common use-case of getting
> paginator to group objects onto a page and return the data needed to
> render it. Having to pull individual bits of data out of paginator and
> add them to a dictionary or to the context is very timeconsuming. It
> should be a separate dictionary rather than writing to the context so
> that multiple paginated lists can sit on one page easily.

I think this wouldn't be necessary if we had a PaginatorPage (as
suggested in #2576), because, in theory, the PaginatorPage would have
access to all the stuff you needed in your template. Am I missing
something?

> And to any of the Django admins - would a substantial upgrade of this
> kind to paginator be allowable, or are you locked down on its API until
> v2?

The paginator class has never been documented in the official docs
(with a small exception being in a model example), so we're not locked
down on its API. And really, the types of things we're talking about
here are enhancements, not necessarily backwards-incompatibilities.

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 th

Custom Template Tag - What do I need in my actual template?

2006-10-13 Thread MerMer

I'm steadily working through the excellent custom template tag
tutorial:-

http://www.b-list.org/weblog/2006/06/07/django-tips-write-better-template-tags

I've got the following code to create a template tag.  However,  I'm
unclear as to what
I need to put into my actual template.

The author states, that based on the code below,  I would need to add
{% get_latest_polls 3 %} to the template, where 3 is a variable.
However, while this not not create any errors, it is also not returning
the latest 3 Polls.   What else do I need to add?

MerMer

from django import template
from mysite.polls.models import Poll, Choice

class LatestPollsNode(template.Node):
def __init__(self,num):
self.num = num
def render(self, context):
context['polls'] = Poll.objects.all()[:self.num]
return ''

def get_latest_polls(parser, token):
bits = token.contents.split()
if len(bits) !=2:
raise TemplateSyntaxError, "get latest_latest_polls tag take
exactly one arguement"
return LatestPollsNode(bits[1])

get_latest_polls = register.tag(get_latest_polls)


--~--~-~--~~~---~--~~
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: Extending the user model

2006-10-13 Thread Dirk Eschler

Am Freitag, 13. Oktober 2006 13:58 schrieb Malcolm Tredinnick:
> Yes. Is there something you are trying to do that isn't accomplished by
> that method?

Ok now that i have tried, there is indeed something i can't accomplish. :) 
Here's a simplified version of my model:

class UserProfile(models.Model):
  academic_title = models.CharField(maxlength=255)
  user = models.ForeignKey(User, unique=True,
 edit_inline=models.STACKED,
 num_in_admin=1, min_num_in_admin=1,
 max_num_in_admin=1, num_extra_on_change=0)

Using the above code, i get a "User profile #1" fieldset at the bottom of the 
admin interface. Great so far, however, is it still possible to reorder the 
fields? As far as i understand i can't just use a inner Admin class in this 
case, can i?

I'm trying to achieve a field ordering like that:

Personal info
==
Academic title: []
First name: []
Last name:  []
E-mail address: []

Or in case this is impossible, i would like to put the "User profile" fieldset 
below the "Personal info" fieldset.

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



Re: Paginator Overhall

2006-10-13 Thread sago

Malcom,

Yes, I agree that it is better to have a generally useful framework,
rather than an all singing and dancing solution to everybody's solution
but yours. I also agree with a lot of your post.

> Pagination is something that can and is presented in many
> different ways.

This is a subtext of my post really. I wanted to garner people's
use/expectation from the system.

Mainly because my use/expectation was so clearly different from the
facilities that it provided, and it seemed to me that I wouldn't be
alone.

If there are three common ways that people always use paginator, and
90% of people use one, and the other two are exotic, then it makes
sense (at least to me) to add a class that supports those 90%.

> Some pages do operate in this way, it's true. Making it possible to work
> like this is a good goal. Encouraging people to work this way is less of
> a goal, since it's only one way to operate.

So, I guess the question is what are the other ways ?

> > 3.
> > 4.
> There's just no end to the bells and whistles
> department and once you walk in there, it's hard to leave.
On reflection, you're probably right.

> There's no
> "DRY" violation, because you end up writing your utility method exactly
> once (it only becomes 'R' on the second and subsequent times).

The Y in DRY can be plural 'you', not just singular. If both you, and I
and a thousand other programmers are all writing functionally the same
bit of code, that is wasteful.

In the admin interface for example, Django sensibly assumes that 90% of
people will want roughly the same thing, and provides the support for
the other 10% (actually, strictly, LJW happened to have requirements
from its admin interface that 90% of the rest of us happen to share).

As long as you continue to support the other 10% its a noble aim, IMHO,
to provide for the needs of the 90%.


> >  [As an aside Django's query
> > sets should probably implement __len__ as an alias for .count() to be
> > more 'pythonic'. Would this cause any side-effects?]

Anyone want to comment on this?

> > 7. You should be able to get a whole dictionary of data about the page
> > back in one go.
> This kind of assumes there is a universal concept of "the right data". I
> would dispute that.

There is already a concept of "the right data" because the class
supports querying of some data but not others (as you've said, some
bits of data you need to calculate yourself, the paginator shouldn't
provide them). Since the queries that are involved in calculating the
paginators internal data are effectively redundant (hence the
assignment to ._hits etc. in the class). Having a method to get all the
data and return it in a dictionary would be very useful and
non-controversial, surely. And it would solve the 'set_page' problem
too. Just call get_page_data(page_number) and get all the information
in a dictionary, or object.

> Your "most common" use-case isn't necessarily somebody elses. Locking
> people in at the framework level is not nice.
I agree with the second sentence. But not the first - what more common
use-case for paginator is there than grouping objects on a page? Surely
the name gives it away.

> You forgot to mention the elephant in the room, though: people are going
> to want to use this functionality through generic views.

Yes, but its a small elephant, a baby Indian, I guess.

> custom paginator object, then you can't use generic views. They are an
> aid, not a crutch, after all. I expect that to fly like a lead balloon.

I think you're right. Generic views are all about assuming things. For
example, I rarely use Generic views because most of the work I do needs
other information on the page, so even if you're looking at one db
object, I need other objects rendered in some way.

So it seems fine to me to assume that people who use generic views get
generic parameters in a generic paginator. Anyone else can write a
custom view.

Thanks for the response Malcom,

Ian.


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



Re: mod_python help needed

2006-10-13 Thread doug

1-link above 'is' the test server/

2-source is linked to svn code directly as described on
djangoproject.com

3- 404 is django's   see it here: http://oviparo.us/polls   -



Thanks Doug


On Oct 13, 7:57 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2006-10-13 at 11:30 +, doug wrote:
> > I am setting up mod_python on test server and having some problems. I
> > am getting 'it worked!' initially- I am able to access admin and set up
> > flatpages. But I hit a wall when just trying to do 'polls' app ...
> > getting 404s only . No problem when using development server.
>
> > test server with settings is  here->  http://oviparo.usReverse-engineering 
> > your configuration files, it looks like you must
> have a directory called /home/cottage/mysite4/ and the django source is
> either on the system python path (/usr/lib*/python*/site-packages/, for
> example) or also in /home/cottage.
>
> Are either of those two statements incorrect? If so, you need to tweak
> the PythonPath directive.
>
> When you receive a 404 page, I assume this is coming from Django? Not
> the default Apache 404 message? Assuming it is coming from Django, what
> is the error message you are seeing? Is it saying it cannot find a match
> for the URL you are submitting, or it cannot import a module, or
> something else?
>
> Your settings look basically sane, so my guess is that you have either
> made a spelling error somewhere (e.g. it should be /home/cotage/ instead
> of /home/cottage/ or something similar) or you haven't got the path to
> your Django project directory quite correct.
> 
> 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: Birthday

2006-10-13 Thread Antonio Cavedoni

On 13 Oct 2006, at 0:24, Guillermo Fernandez Castellanos wrote:
> I am trying to keep a birthday field in the database. But i am only
> interested in the day and month. Is there a way of using a DateField
> but only with day and month fields? Or should I use another solution?

A DateField looks like what you want: instead of storing just day and  
month, why not store also the year somebody was born? That way you  
can calculate stuff like “ZOMG, it’s your 27th birthday, you’re  
getting old!” :-)

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: Auth and flash

2006-10-13 Thread olive

This is a question you should also ask to openlaszlo.org users.

Openlaszlo is a framework which helps in building rich Flash GUI in a
XUL fashion.


--~--~-~--~~~---~--~~
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: Extending the user model

2006-10-13 Thread Dirk Eschler

Am Freitag, 13. Oktober 2006 13:58 schrieb Malcolm Tredinnick:
> On Fri, 2006-10-13 at 13:20 +0200, Dirk Eschler wrote:
> > Hello,
> >
> > is the method described at the below link still the recommended one?
> > http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model
>
> Yes. Is there something you are trying to do that isn't accomplished by
> that method?

Thanks for the quick response. And sorry for not being more precise. I haven't 
tried it yet. Just wanted to be sure, that the article doesn't refer to an 
obsolete version of Django. It mentioned that things might change in future 
releases, model subclassing in particular.

Best Regards,
Dirk Eschler

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



Re: Rich Text Fields in Admin

2006-10-13 Thread comechao

See that:
http://www.dehora.net/journal/2006/05/using_tinymce_in_djangos_admin.html


--~--~-~--~~~---~--~~
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: Extending the user model

2006-10-13 Thread Malcolm Tredinnick

On Fri, 2006-10-13 at 13:20 +0200, Dirk Eschler wrote:
> Hello,
> 
> is the method described at the below link still the recommended one?
> http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model

Yes. Is there something you are trying to do that isn't accomplished by
that method?

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: mod_python help needed

2006-10-13 Thread Malcolm Tredinnick

On Fri, 2006-10-13 at 11:30 +, doug wrote:
> I am setting up mod_python on test server and having some problems. I
> am getting 'it worked!' initially- I am able to access admin and set up
> flatpages. But I hit a wall when just trying to do 'polls' app ...
> getting 404s only . No problem when using development server.
> 
> test server with settings is  here->  http://oviparo.us

Reverse-engineering your configuration files, it looks like you must
have a directory called /home/cottage/mysite4/ and the django source is
either on the system python path (/usr/lib*/python*/site-packages/, for
example) or also in /home/cottage.

Are either of those two statements incorrect? If so, you need to tweak
the PythonPath directive.

When you receive a 404 page, I assume this is coming from Django? Not
the default Apache 404 message? Assuming it is coming from Django, what
is the error message you are seeing? Is it saying it cannot find a match
for the URL you are submitting, or it cannot import a module, or
something else?

Your settings look basically sane, so my guess is that you have either
made a spelling error somewhere (e.g. it should be /home/cotage/ instead
of /home/cottage/ or something similar) or you haven't got the path to
your Django project directory quite correct.

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



mod_python help needed

2006-10-13 Thread doug

I am setting up mod_python on test server and having some problems. I
am getting 'it worked!' initially- I am able to access admin and set up
flatpages. But I hit a wall when just trying to do 'polls' app ...
getting 404s only . No problem when using development server.

test server with settings is  here->  http://oviparo.us

Thanks-Doug


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



Extending the user model

2006-10-13 Thread Dirk Eschler

Hello,

is the method described at the below link still the recommended one?
http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model

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



Re: Relation query stops working when moving to Linux (from Mac)

2006-10-13 Thread Malcolm Tredinnick

On Fri, 2006-10-13 at 03:16 -0700, mrstone wrote:
> I'm getting a strange error that I have not been able to sort out.
> 
> When moving my project to the production server the below query stops
> working. (It works fine on Mac)
> 
> I noticed that using CamelCase in fieldnames is an issue when moving
> code, but that doesn't seem to be the problem here.
> 
> Any other hints that could point me in any direction?

Are you using the same versions of Django on both machines? We fixed a
couple of bugs with related name lookups a couple of months ago, so if
you have some old source on the production server, this might be
tripping over it.

Another thing to look at is whether you are running that query before
you have finished importing the files containing InfoProxy and/or
InfoLocation. If so and you have suddenly switched to using, say,
mod_python, rather than the development server, you might find this
problem popping up. Basically, running queries against the models in the
global scope of a model file (so things that are going to be executed at
import time) will not work reliably (related to ticket #2438. It's
almost impossible to fix that problem, too, although I keep going back
to think about it from time to time). So don't run queries at the
file-level in model files.

If neither of those suggestions help and nobody else has better ideas,
maybe you could work out in more detail what the differences are between
the two systems. What Django versions are you using? What database
versions? What webserver and webserver interface on each system.
Basically, work out each difference. That might help identify where the
problem is. Failing that, start trimming the code down to the smallest
possible example that fails. Then we can examine it as a complete
example and working out what is going on.

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: How can I inspect the content of bound_related_object in admin/edit_inline_tabular.html ?

2006-10-13 Thread Malcolm Tredinnick

On Fri, 2006-10-13 at 12:01 +0200, KLEIN Stéphane wrote:
> Hi
> 
> I make some hack on admin/edit_inline_tabular.html template but I don't
> know the content of bound_related_object. In general, how can I inspect
> (debug ?) this objects ?

Look in the render() method of the EditInlineNode class in
contrib/admin/templatetags/admin_modify.py.

The way I found this was to grep through the admin source code for the
template fragment name and then worked out where it was being used.

You could also use the {% debug %} tag in your template, but that might
be harder than just putting some logging statements into the source.

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



Relation query stops working when moving to Linux (from Mac)

2006-10-13 Thread mrstone

I'm getting a strange error that I have not been able to sort out.

When moving my project to the production server the below query stops
working. (It works fine on Mac)

I noticed that using CamelCase in fieldnames is an issue when moving
code, but that doesn't seem to be the problem here.

Any other hints that could point me in any direction?


Thanks
Sten


qs = InfoProxy.objects.filter(info_locations__country_code =
where.country_code)

the related model:

class InfoLocation(models.Model):
info_proxy = models.ForeignKey(InfoProxy,
db_column="info_proxy_id", related_name='info_locations')
country_code = models.CharField(maxlength=2, db_index=True)


.
The trace:

  File
"/usr/local/lib/python2.4/site-packages/django/db/models/query.py",
line 171, in iterator
select, sql, params = self._get_sql_clause()

  File
"/usr/local/lib/python2.4/site-packages/django/db/models/query.py",
line 444, in _get_sql_clause
joins2, where2, params2 = self._filters.get_sql(opts)

  File
"/usr/local/lib/python2.4/site-packages/django/db/models/query.py",
line 574, in get_sql
joins2, where2, params2 = val.get_sql(opts)

  File
"/usr/local/lib/python2.4/site-packages/django/db/models/query.py",
line 622, in get_sql
return parse_lookup(self.kwargs.items(), opts)

  File
"/usr/local/lib/python2.4/site-packages/django/db/models/query.py",
line 730, in parse_lookup
joins2, where2, params2 = lookup_inner(path, lookup_type, value,
opts, opts.db_table, None)

  File
"/usr/local/lib/python2.4/site-packages/django/db/models/query.py",
line 831, in lookup_inner
raise TypeError, "Cannot resolve keyword '%s' into field" % name

TypeError: Cannot resolve keyword 'info_locations' into field


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



Auth and flash

2006-10-13 Thread Roodie

Hi,

I am working on a web application at the moment, and I have a question 
about the authentication mechanism.
The interface of the application will be a flash app. No page reloading, 
no redirects - only a big flash file which will send the requests using 
post and get back the responses in a custom XML format.

The question is - how can I log the users in in this case? The 
requirement is doing it without reloading the HTML page where the flash 
is embedded... SO I have to do it from flash. My only idea is to get / 
create sime kind of session identifier and send it back to the flash 
client when the login successful, and then check it every time the flash 
app sends a new request... Any other ideas, suggestions, links to hidden 
documents? :-)

Roodie

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



Re: How can I inspect the content of bound_related_object in admin/edit_inline_tabular.html ?

2006-10-13 Thread KLEIN Stéphane

Hi

I make some hack on admin/edit_inline_tabular.html template but I don't
know the content of bound_related_object. In general, how can I inspect
(debug ?) this objects ?

Thanks for your help.
Stephane

--~--~-~--~~~---~--~~
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-13 Thread Nicolas Steinmetz

Russell Keith-Magee a écrit :

> Sorry for the long delay in responding to this message.

no problem, it happens ;)

> Django models can have multiple foreign keys; however, there are some
> known issues with manipulators on models with self-referential foreign
> keys that give the error message you are describing.
> 
> A good starting point is http://code.djangoproject.com/ticket/2536 -
> this ticket has references to a few other tickets with similar
> problems. Some of these tickets may give you some hints for
> workarounds.

Thanks for your support, I'll take a look at it during the week end :-)

Nicolas


--~--~-~--~~~---~--~~
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: When to

2006-10-13 Thread MerMer

I can see that I could use inclusion tags or template tags.  I've read
the documentation  however, I'm still unclear when you would use one
over the other.

What would be the appropriate use case for a template tag versus an
inclusion tag?

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