Re: Grouping a list of entries by month name

2009-02-18 Thread Malcolm Tredinnick

On Wed, 2009-02-18 at 23:35 -0800, Marlun wrote:
> I believe this will work perfectly in my case.
> 
> To easy my curiosity, how would you do it differently if you wanted
> the sequence object to be grouped by date but have the month name
> instead of number? I mean right now I get a list of entry objects. How
> would you change your view code to retrieve a sequense sorted by month
> name and year in the template?

The month or year are more presentation details than data retrieval
operations. You still sort the result set by date, which brings all the
entries for month X in a particular year together. Then, in your
template, you can format the display however you like (including using
the "ifchanged" template tag if you want to display some value only when
it changes).

Use the "date" template filter to format the results: if "obj" is a date
object, the {{ obj|date:"M" }} will display the month name in a
template.

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Grouping a list of entries by month name

2009-02-18 Thread Marlun

I believe this will work perfectly in my case.

To easy my curiosity, how would you do it differently if you wanted
the sequence object to be grouped by date but have the month name
instead of number? I mean right now I get a list of entry objects. How
would you change your view code to retrieve a sequense sorted by month
name and year in the template?

-Martin

On Feb 18, 12:13 pm, Lee Braiden  wrote:
> 2009/2/18 Marlun :
>
> > December. What I want is something like:
>
> > January 2009
> > --
> > EntryXXX - date
> > EntryXXX - date
>
> > December 2008
>
> > EntryXXX - date
> > EntryXXX - date
>
> > What is the way to do this?
>
> An easy way is to simply order by date, and then use an {% ifchanged
> yourdatefield.month %} tag in your template, to check if the month has
> changed, and display a heading if so.  Whether it suits your needs
> depends on your circumstances though.
>
> http://docs.djangoproject.com/en/dev/ref/templates/builtins/#ifchanged
>
> --
> Lee
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: unicode/str not callable

2009-02-18 Thread Nicolas Steinmetz

Malcolm Tredinnick a écrit :

> Method #2: create a dictionary mapping "engine" values to the right
> callable.
> 
> try:
> {'google': google,
>  'yahoo': yahoo,
>  # ...
> }[engine](...)
> except KeyError:
> # Engine name is not valid. Handle appropriately here.
> 
> The drawback is the percieved redundancy between the string name and the
> function name. Still, I would prefer this solution. It automatically
> only allows "permitted" value through -- and if, say, you wanted to
> temporariliy disable the yahoo functionality, you would just comment out
> or remove that line from the dictionary. It also means you don't *have*
> to call your functions by the same name as the search engine, which
> would be useful if you ever included an engine whose name was not a
> valid Python identifier, for example.
> 
> By the way, this second pattern is more-or-less idiomatic Python for a
> C-style switch-statement. Usually preferable to a series of if...elif...
> statements, particularly for a large number of choices.

Thanks for the answer. I'll implement the 2nd method, which makes far 
more sens than my first "harsh and straight away" approach ;-)

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Struggling with annotations / aggregations

2009-02-18 Thread Russell Keith-Magee

On Thu, Feb 19, 2009 at 2:32 AM, Stefan Tunsch  wrote:
>
> Hi there!
>
> I'm trying to see what's the best approach in my scenario.
> The problem is how to make a list display different sums and
> calculations based on it's child objects.
>
> My scenario could be the following:
> Two models: Project and Task
> One Project has many Task.
> Task has a boolean "open" field (open,closed) and a due_date.
>
> I want to retrieve a list of projects that includes the total number of
> tasks (that one is easy ;), number of open tasks and number of tasks
> with due_date today.
>
> First of all, I understand that this would not be possible with the new
> Aggregation / Annotation functionality, right? (Maybe I'm mistaken)

Not possible as a single statement. The individual components are
certainly possible.

> I cannot do something like:
> projects = Project.objects.all(),annotate(total=Count('task'),
> open_tasks=Count('task__open=True'),
> due_today=Count('task__due_date=datetime.today()')

Obviously, this syntax isn't legal (as you would have found if you tried that)

> Second, if not, what would be the best way to approach this scenario?

The problem here is that your query, although simple to pose, isn't
that simple to answer in a single SQL statement. You can't just do it
with simple joins, because you need three separate joins on the task
table to filter out the three different row counts. The only way I can
see to answer this question as a single query is to use three
subqueries that compute the counts, and join those subqueries.

The same is essentially true of Django. You could easily pose your
question with as three separate queries:

Project.objects.annotate(total=Count('task'))
Project.objects.filter(task__open=True).annotate(open_tasks=Count('task"))
Project.objects.filter(task__due_date=datetime.today()).annotate(due_today=Count('task"))

However, there isn't a way (that I am aware of) for combining these
standalone queries as sub-queries of a larger query. You could,
however, manually merge the three results sets into a single unified
set. If you choose to take this approach, I would suggest using the
.values() operator to constrain the amount of data that you need to
retrieve and merge.

This broad problem is something that is currently logged as ticket
#10060; the issue is how to deal with multiple joins in query
statements. It's not a simple problem to solve; even catching the
cases where it is potentially a problem is difficult. I hope to be
able to sort something out before we cut version 1.1.

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Modifying pythonpath in settings.py

2009-02-18 Thread Alex Gaynor
On Thu, Feb 19, 2009 at 12:42 AM, David Zhou  wrote:

>
> Nevermind -- I'd always imported settings first, but since that's not
> always the case (such as third party apps), things act strangely.
>
> Short of changing something in django core, is there any way of adding
> to sys.path dynamically before any django code gets run?
>
> -- dz
>
>
>
> On Thu, Feb 19, 2009 at 12:10 AM, David Zhou  wrote:
> > I've been doing the following for a while, but I'm not sure if it has
> > unintended side effects:
> >
> > #settings.py
> > import os, sys
> > sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),
> > 'apps'))
> >
> > I keep pluggable apps in an svn repo, and do checkouts of the ones I
> > need in the apps folder that's specific to whatever site I'm working
> > on.  And since I do this for most of my projects, I figured it'd be
> > easier to make sure it was in the pythonpath rather than relying on
> > the environment to properly define pythonpath.
> >
> > Is it considered bad practice to dynamically modify the pythonpath in
> > something like settings.py?
> >
> > -- dz
> >
>
> >
>
There is no 1 generic way to handle it but IME the following 3 will handle
any application:
1) in manage.py for runserver(probably not an issue since it's using your
users PYTHONPATH anyway)
2) in the .wsgi file for wsgi, this is a bit of a no brainer
3) in the httpd.conf for apache(or whatever that file is named).

Hope this helps some,
Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

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



Re: Modifying pythonpath in settings.py

2009-02-18 Thread David Zhou

Nevermind -- I'd always imported settings first, but since that's not
always the case (such as third party apps), things act strangely.

Short of changing something in django core, is there any way of adding
to sys.path dynamically before any django code gets run?

-- dz



On Thu, Feb 19, 2009 at 12:10 AM, David Zhou  wrote:
> I've been doing the following for a while, but I'm not sure if it has
> unintended side effects:
>
> #settings.py
> import os, sys
> sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),
> 'apps'))
>
> I keep pluggable apps in an svn repo, and do checkouts of the ones I
> need in the apps folder that's specific to whatever site I'm working
> on.  And since I do this for most of my projects, I figured it'd be
> easier to make sure it was in the pythonpath rather than relying on
> the environment to properly define pythonpath.
>
> Is it considered bad practice to dynamically modify the pythonpath in
> something like settings.py?
>
> -- dz
>

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



Modifying pythonpath in settings.py

2009-02-18 Thread David Zhou

I've been doing the following for a while, but I'm not sure if it has
unintended side effects:

#settings.py
import os, sys
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),
'apps'))

I keep pluggable apps in an svn repo, and do checkouts of the ones I
need in the apps folder that's specific to whatever site I'm working
on.  And since I do this for most of my projects, I figured it'd be
easier to make sure it was in the pythonpath rather than relying on
the environment to properly define pythonpath.

Is it considered bad practice to dynamically modify the pythonpath in
something like settings.py?

-- dz

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



Re: Registration Behavior

2009-02-18 Thread Alex Gaynor
On Thu, Feb 19, 2009 at 12:04 AM, Praveen wrote:

>
> Hi could you please tell me more about sorry i could not get you. are
> you using django-profiles?
>
> On Feb 19, 8:24 am, timlash  wrote:
> > I'm running Python 2.4, Django 1.0.2 and Django_Registration-0.7 on my
> > Debian Etch box.  I'm making decent progress on developing my first
> > Django web app.  I've got models, tables, views, templates,
> > registration has successfully sent Gmail and test users have been
> > activated.
> >
> > My first noob problem: I don't understand how Django and/or
> > Registration is controlling the order in which web pages are
> > requested.  After logging in a test user on the development server at:
> >
> >http://localhost:8000/mysite/accounts/login/
> >
> > the following page is requested:
> >
> >http://localhost:8000/accounts/profile/
> >
> > Obviously, this throws an error since urls.py only includes references
> > to mysite.  This line is also inurls.py:
> >
> > (r'^mysite/accounts/', include('registration.urls')),
> >
> > I've searched the Django doc and poked through all the registration
> > files but I can't find any instructions that tell the web server to go
> > (upon successful login) from .../login/ to .../profile/
> >
> > Any pointers would be greatly appreciated.
> >
> > Cheers,
> >
> > Tim
> >
>
There is a setting in django which controls where you are redirected to
after logging in:
http://docs.djangoproject.com/en/dev/ref/settings/?from=olddocs#login-redirect-url

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

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



get_latest template tag and django-syncr issue

2009-02-18 Thread BradMcGonigle

I can't figure out what is going on here but I'm hoping someone can
help.  I am using James Bennett's get_latest templatetag (
http://www.b-list.org/weblog/2006/jun/07/django-tips-write-better-template-tags/
) and am using django-syncr.  Django Syncr works fine and syncs my
twitter tweets just fine.  However it seems that the my get_latest
call in my template is just grabbing the first 9 tweets it finds in
the database rather than the latest additions to the database.


{% get_latest twitter.tweet 9 as latest_tweets %}


The odd part is that I'm also using django-syncr to sync my flickr
photos and using the exact same template tag and it works perfectly
fine.


{% get_latest flickr.photo 21 as latest_flickr %}


I realize that this is a pretty specific issue but I thought maybe
someone else would have run into 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Registration Behavior

2009-02-18 Thread Praveen

Hi could you please tell me more about sorry i could not get you. are
you using django-profiles?

On Feb 19, 8:24 am, timlash  wrote:
> I'm running Python 2.4, Django 1.0.2 and Django_Registration-0.7 on my
> Debian Etch box.  I'm making decent progress on developing my first
> Django web app.  I've got models, tables, views, templates,
> registration has successfully sent Gmail and test users have been
> activated.
>
> My first noob problem: I don't understand how Django and/or
> Registration is controlling the order in which web pages are
> requested.  After logging in a test user on the development server at:
>
>                http://localhost:8000/mysite/accounts/login/
>
> the following page is requested:
>
>                http://localhost:8000/accounts/profile/
>
> Obviously, this throws an error since urls.py only includes references
> to mysite.  This line is also inurls.py:
>
>                 (r'^mysite/accounts/', include('registration.urls')),
>
> I've searched the Django doc and poked through all the registration
> files but I can't find any instructions that tell the web server to go
> (upon successful login) from .../login/ to .../profile/
>
> Any pointers would be greatly appreciated.
>
> Cheers,
>
> Tim
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: checkboxInput values

2009-02-18 Thread Mark Jones

and you do that like so:

answer0 = forms.IntegerField(label='', widget=forms.CheckboxInput
(attrs={'value':0}))

for the next bloke that doesn't want to have to figure it out.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Registration Behavior

2009-02-18 Thread timlash

I'm running Python 2.4, Django 1.0.2 and Django_Registration-0.7 on my
Debian Etch box.  I'm making decent progress on developing my first
Django web app.  I've got models, tables, views, templates,
registration has successfully sent Gmail and test users have been
activated.

My first noob problem: I don't understand how Django and/or
Registration is controlling the order in which web pages are
requested.  After logging in a test user on the development server at:

http://localhost:8000/mysite/accounts/login/

the following page is requested:

http://localhost:8000/accounts/profile/

Obviously, this throws an error since urls.py only includes references
to mysite.  This line is also inurls.py:

(r'^mysite/accounts/', include('registration.urls')),

I've searched the Django doc and poked through all the registration
files but I can't find any instructions that tell the web server to go
(upon successful login) from .../login/ to .../profile/

Any pointers would be greatly appreciated.

Cheers,

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



Re: Differen unicode behaviour between mac os x and linux

2009-02-18 Thread Polat Tuzla

Thanks a lot for your responses. I managed to track down the problem
further with the help of the information you provided.

In my wsgi script I have:
sys.stdout = sys.stderr
(So that's the reason why output is redirected to error files as
Graham mentioned.)

My view file is:
# coding=utf-8
...
def home(request):
print u"İşÖ"

Both of the machines have default encoding of 'ascii'. Linux box have
mod_wsgi 2.3 installed.
1- When running on the Mac OS X box as development sever (./manage.py
runserver) the view prints "İşÖ" as expected
2- When running on the Linux box as development sever (./manage.py
runserver) the view prints "İşÖ" as expected, too
3- When running on the Linux box on apache+mod_wsgi, the print
statement raises
"UnicodeEncodeError: 'ascii' codec can't encode character u'\u0130' in
position 0: ordinal not in range(128)"

This leads me to the conclusion that it's related to mod_wsgi and one
should not try to 'print' unicode strings within it.
Although I can't understand the exact reason event after your
explanations, I wanted to mention my findings, for future reference
for anyone who comes across the same problem.

Regards,
Polat Tuzla

On Feb 17, 12:48 pm, Graham Dumpleton 
wrote:
> On Feb 17, 3:01 pm, Malcolm Tredinnick 
> wrote:
>
> > > I think I should have clarified some more facts about my setup.
> > > 1- On mac, django is running on dev mode, so stdout is the console. On
> > > linux, it'smod_wsgi, so stdout is redirected to apache error log
> > > files, on which I'm issuing a "tail -f" thorough ssh.
>
> > I was a little surprised that stdout was redirected to the error logs in
> > mod_wsgi, but it seems that that is indeed the case.
>
> In default configuration mod_wsgi does not send stdout to the Apache
> error logs. In fact if you try and output to stdout mod_wsgi will
> complain and raise an exception. This is because mod_wsgi deliberately
> restricts writing to stdout to discourage people using 'print' for
> debug. This is done because by doing so you make your WSGI application
> less portable. In particular, your WSGI application would break in a
> WSGI hosting mechanism which uses stdout to communicate the response
> back to the web server. Such a mechanism is used for CGI-WSGI bridges.
>
> Thus, if stdout is going to the Apache error logs it is because the
> user made a conscious decision to redirect it there by disabling the
> mod_wsgi restriction on using stdout. This can be done by using
> WSGIRestrictStdout directive, or explicitly reassigning sys.stdout to
> be sys.stderr.
>
> All this stuff about stdout is described in:
>
>  http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Writing_To_St...
>  http://code.google.com/p/modwsgi/wiki/DebuggingTechniques
>
> > I don't know what
> > mod_wsgi might be doing to character encoding on output (maybe nothing,
> > but maybe that's playing a role).
>
> Uses:
>
>   PyArg_ParseTuple(args, "s#:write", , )
>
> so presumably the default encoding. If the default encoding isn't
> UTF-8, then you may have problems in trying to outputUnicodestrings
> if it cannot be represented in whatever default encoding is. This
> would likely result in exception and so perhaps what you are seeing.
>
> > However, instead of using print, I
> > would recommend using Python's logging module and sending the results to
> > a dedicated logging file.
>
> > Apache error logs aren't a great place for audit-style logging, since
> > there's so much other (Apache-specific) stuff in there.
>
> If the integrity of the information being logged is important, then I
> also would be recommending logging to your own files.
>
> The mapping of sys.stderr to Apache error logging mechanism should be
> seen as more of a failsafe default for minor logging. If you need a
> more serious logging system, implement your own.
>
> Mapping to Apache error logging mechanism has a couple of
> shortcomings, plus a bug in mod_wsgi 2.3. The bug stems from fact that
> it is trying to force data into a C API call that takes NULL
> terminated C strings. Forgot about that aspect of it so it is
> currently truncating at any embedded null in something which is
> logged. So, okay if text, but shove binary data down it and it will
> not be happy. This is addressed in mod_wsgi 3.0. All it can do though
> is interpret an embedded null as if it was a newline because Apache
> logging API doesn't understand concept of length.
>
> The reason that Apache logging API is used rather than just stuffing
> it direct into file descriptor for log file, is that it allows Apache
> to use syslog for logging or for it to be intercepted by any other
> custom Apache modules that want to process error log messages. Also
> Apache adds useful date/time information to each line. A limitation of
> the logging API though is that also has a maximum line length. Thus,
> it also throws away anything over about 8192 bytes when have a really
> long 

Re: Django "tracking" app

2009-02-18 Thread DougC

Thanks Jacob, looks like a good place to start.

Doug

On Feb 18, 6:09 pm, Jacob Kaplan-Moss 
wrote:
> On Wed, Feb 18, 2009 at 6:10 PM, DougC  wrote:
> > Any thoughts from experienced Django developers?
>
> Two things you might want to look into:
>
> The first is model inheritance
> (http://docs.djangoproject.com/en/dev/topics/db/models/#id4). You
> could, for example, have an abstract ``TrackedObject`` model and a set
> of concrete subclasses for each type of thing to be tracked.
>
> Or, you might want to look at ``django.contrib.contenttypes``
> (http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/),
> paying careful attention to generic relations
> (http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1).
> This would let you have a generic ``TrackedObject`` object with a
> (sort of) foreign key to *any* other object of any type.
>
> Jacob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django "tracking" app

2009-02-18 Thread Jacob Kaplan-Moss

On Wed, Feb 18, 2009 at 6:10 PM, DougC  wrote:
> Any thoughts from experienced Django developers?

Two things you might want to look into:

The first is model inheritance
(http://docs.djangoproject.com/en/dev/topics/db/models/#id4). You
could, for example, have an abstract ``TrackedObject`` model and a set
of concrete subclasses for each type of thing to be tracked.

Or, you might want to look at ``django.contrib.contenttypes``
(http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/),
paying careful attention to generic relations
(http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1).
This would let you have a generic ``TrackedObject`` object with a
(sort of) foreign key to *any* other object of any type.

Jacob

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



Re: how to make a field uneditable in admin site

2009-02-18 Thread adelevie

According to Djangobook, the philosophy of the admin site is that all
users of it are "trusted" not just "authenticated," meaning you will
trust them to do the right thing.

On Feb 18, 8:42 pm, mermer  wrote:
> You need to create a custom ReadOnlyField that subclasses the
> FileField.
> You also need to create a ReadOnlyWidget that subclasses Forms.Widget
>
> The link below, explains how the whole thing hangs together.
>
> http://lazypython.blogspot.com/search?updated-min=2008-01-01T00%3A00%...
>
> On 17 Feb, 07:22, guptha  wrote:
>
> > hi ,
> > i need to know how to create a non editable field in admin site .I
> > tried , one like  below
>
> > acct_number=models.CharField(max_lenght=100,editable=False)
>
> > but it doesn't work
> > please any other ideas,
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to make a field uneditable in admin site

2009-02-18 Thread mermer

You need to create a custom ReadOnlyField that subclasses the
FileField.
You also need to create a ReadOnlyWidget that subclasses Forms.Widget

The link below, explains how the whole thing hangs together.


http://lazypython.blogspot.com/search?updated-min=2008-01-01T00%3A00%3A00-05%3A00=2009-01-01T00%3A00%3A00-05%3A00=35

On 17 Feb, 07:22, guptha  wrote:
> hi ,
> i need to know how to create a non editable field in admin site .I
> tried , one like  below
>
> acct_number=models.CharField(max_lenght=100,editable=False)
>
> but it doesn't work
> please any other ideas,
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



trouble with django-admin.py

2009-02-18 Thread adelevie

This used to work fine until around the time I upgraded from python
2.5 to 2.6. I use a windows pc.
When I cd into the directory that I want to start my project in I type
"django-admin.py startproject somesite" and get the Windows "choose
program to open file" list. What is a starting point towards solving
this?


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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Query that grabs objects before and after object

2009-02-18 Thread Kevin Audleman

When you say "come before this object" and "come after this object",
how is this represented in your data model? Do you have a field called
show_order where you are capturing this information? In that case you
could do something like

current_show = 5 #Presumably you get this in your request
show_range = (current_show - 4, current_show + 4)
shows = Show.objects.filter(show_order__range=show_range)


FYI I haven't tested this and my Python is not good enough that I can
guarantee my syntax.

Kevin Audleman

On Feb 18, 4:06 pm, Sean Brant  wrote:
> Is there a simple way to say get me 4 objects from model that come
> before this object and 4 that come after this object.
>
> So lets say I have a Show. I would like to know which 4 shows come
> before the current show and which 4 come after, however I must limit
> the shows based on a category type. Would slicing work for this?
>
> If this is not sure clear let me know and I will try and clarify more.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Query that grabs objects before and after object

2009-02-18 Thread Alex Gaynor
On Wed, Feb 18, 2009 at 7:06 PM, Sean Brant  wrote:

>
> Is there a simple way to say get me 4 objects from model that come
> before this object and 4 that come after this object.
>
> So lets say I have a Show. I would like to know which 4 shows come
> before the current show and which 4 come after, however I must limit
> the shows based on a category type. Would slicing work for this?
>
> If this is not sure clear let me know and I will try and clarify more.
> >
>
You can do this with slicing fairly easily, basically find whatever field
you want to order by and do something like:
Model.objects.filter(field__gt=obj.field).order_by('field')[:4] to get the 4
greater than it and
Model.objects.filter(field__lt=obj.field).order_by('-field')[:4] to get the
4 less than it.

Hope this helps,
Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

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



Re: Query that grabs objects before and after object

2009-02-18 Thread Malcolm Tredinnick

On Wed, 2009-02-18 at 16:06 -0800, Sean Brant wrote:
> Is there a simple way to say get me 4 objects from model that come
> before this object and 4 that come after this object.
> 
> So lets say I have a Show. I would like to know which 4 shows come
> before the current show and which 4 come after, however I must limit
> the shows based on a category type. Would slicing work for this?

Presumably you already have an ordering on the model so that "before"
and "after" make sense. The difficulty in your question is working out
how far to search in each direction. I can't think, for the general
case, how to do it in one query.

You could do it in two queries providing you can generate a queryset for
"this object and everything before it" (I'm presuming you already have a
queryset for "this object and everything after it). If you order the
"this one and everything before it" queryset by the opposite of the
default ordering, then you can slice off four items("[:4]") to get "this
one and the previous four".

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django "tracking" app

2009-02-18 Thread DougC

Hi all,

I'm not sure if this is the right forum, so please redirect me if it's
not.

I'm new to Django/Python, but not to coding. I've run through the
Django tutorial and I like what I see.

A very common problem that I work on is a webapp that "tracks"
something. People, computers, assets, you name it. The data model is
nearly always the same. Track objects that have metadata and are
associated to other objects, be able to query that data and possibly
produce reports. It's clear that Django can solve my problem, but
before I start, I'm wondering if someone has already generalized this
problem?

Something like a generic "object tracker" that is 90% complete, just
add the metadata and relationships and you're done. I'd rather not
keep writing the same code over and over, which would violate the
"DRY"(tm) rule. :-)  Maybe there's no such thing as a "generic
tracking model", and if not, I'd be tempted to create one before I
start on my first app.

Any thoughts from experienced Django developers?

TIA,

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: unicode/str not callable

2009-02-18 Thread Malcolm Tredinnick

On Thu, 2009-02-19 at 00:43 +0100, Nicolas Steinmetz wrote:
[...]
> The issue is that engine in engine(request.POST['search'], 10) does not 
> become google(request.POST['search'], 10) in the case where the user 
> chosed "google" as engine.
> 
> Is there a solution or did I have to test all values with a if or case 
> loops ?

Two solutions spring to mind. The problem you are trying to solve is:
given a string naming a function, call that function. So you have to map
the string name to the function object.

Method #1: use the globals() dictionary to look up the function object.

globals()[engine]()

The drawback here is that you should still sanitise the contents of
"engine", since otherwise the POST data could be used to call anything
in your globals() namespace. That could be a denial-of-service attack,
at a minimum (a security exploit at worst).

Method #2: create a dictionary mapping "engine" values to the right
callable.

try:
{'google': google,
 'yahoo': yahoo,
 # ...
}[engine](...)
except KeyError:
# Engine name is not valid. Handle appropriately here.

The drawback is the percieved redundancy between the string name and the
function name. Still, I would prefer this solution. It automatically
only allows "permitted" value through -- and if, say, you wanted to
temporariliy disable the yahoo functionality, you would just comment out
or remove that line from the dictionary. It also means you don't *have*
to call your functions by the same name as the search engine, which
would be useful if you ever included an engine whose name was not a
valid Python identifier, for example.

By the way, this second pattern is more-or-less idiomatic Python for a
C-style switch-statement. Usually preferable to a series of if...elif...
statements, particularly for a large number of choices.

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Any way to show progress during a short process job?

2009-02-18 Thread Kevin Audleman

Ajax would only be necessary if you want a status bar that reflects
accurately the progress. You can probably get by with something
simpler. I would write some Javascript that is triggered on clicking
the submit button that replaces the button with this graphic:
http://yesmagazine.org/store/images/pleasewait.gif


Your Javascript looks like this:

?>


And your HTML code looks like this:






   Please wait while your request is being processed...


Cheers,
Kevin Audleman

On Feb 18, 2:52 pm, Malcolm Tredinnick 
wrote:
> On Wed, 2009-02-18 at 12:20 +, Adam Stein wrote:
> > Maybe somebody can suggest how to get the functionality I'm trying to
> > duplicate.  I looked and can't find anything that seemed similiar.
>
> > I have a form with checkboxes.  User selects one or more and submits the
> > form.  The processing currently goes like this:
>
> > 1) Write JavaScript to display moving progress bar
> > 2) Process based on checked boxes (which in my specific example is to
> > copy the specified databases into a sandbox area)
> > 3) Write JavaScript to turn off progress bar
>
> > The database copying is short, up to about 20 seconds.  Short enough to
> > let the user wait, long enough that I want to indicate the computer
> > hasn't frozen :-{}
>
> > It seems that I can only return HTML to be displayed once from a view.
> > Is there a way to get the functionality described above somehow?
>
> It's called AJAX. You have to keep asking the server for an update and
> then updating the page.
>
> 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Query that grabs objects before and after object

2009-02-18 Thread Sean Brant

Is there a simple way to say get me 4 objects from model that come
before this object and 4 that come after this object.

So lets say I have a Show. I would like to know which 4 shows come
before the current show and which 4 come after, however I must limit
the shows based on a category type. Would slicing work for this?

If this is not sure clear let me know and I will try and clarify more.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: 1.0 branch?

2009-02-18 Thread Lloyd Budd

On Feb 17, 9:04 pm, Alex Gaynor  wrote:
>
> Django has a 1.0.X branch 
> here:http://code.djangoproject.com/browser/django/branches/releases/1.0.X 
> that is
> the work that becomes the various point releases(currently 1.0.2).

Thanks Alex!

On Feb 17, 9:17 pm, James Bennett  wrote:
>
> You might want to spend a couple minutes looking at the repository.

Thanks for the suggestion. I missed the 'releases' folder in the mess
that is http://code.djangoproject.com/svn/django/branches/ which
includes what looked like 0.9X branches.

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



Re: OT: hide directory listing on server

2009-02-18 Thread Lloyd Budd

On Feb 18, 10:08 am, PeteDK  wrote:
>
> However when i go to .com/media/profile_pics/ i get a directory
> listing of all the folders in this directory.

The easiest solution is just to put a blank index.html file in the
directory.

We do the equivalent in WordPress, example wp-content/index.php
contains



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



unicode/str not callable

2009-02-18 Thread Nicolas Steinmetz

Hello,

I have in mind in a tiny app to allow user to set a search box with the 
provider they wish.

I base this on web_search and then did the following :

# Create your models here.
class SearchBox(models.Model):
 CROP_ANCHOR_STR = ('dmoz', 'ask', 'google', 'googlefr', 'excite', 
'msn', 'yahoo')
 CROP_ANCHOR_CHOICES = zip(range(len(CROP_ANCHOR_STR)), CROP_ANCHOR_STR)
 engine = models.SmallIntegerField(choices=CROP_ANCHOR_CHOICES)

 class Meta:
 verbose_name, verbose_name_plural = "Search Engine", "Search 
Engines"

and in my views, I did :


# Create your views here.
def results(request):
 """
 Get search engine set up for the site
 Get results for the query
 """
 engine_list=SearchBox.objects.all()
 for eng in engine_list:
 engine=eng.get_engine_display()
 if request.POST:
 return render_to_response('results.html', {'result': 
engine(request.POST['search'], 10), 'search_query': request.POST['search']})
 else:
return render_to_response('results.html')

The issue is that engine in engine(request.POST['search'], 10) does not 
become google(request.POST['search'], 10) in the case where the user 
chosed "google" as engine.

Is there a solution or did I have to test all values with a if or case 
loops ?

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Formsets issue

2009-02-18 Thread Malcolm Tredinnick

On Wed, 2009-02-18 at 09:16 -0800, Thomas Hill wrote:
> Hey all,
> 
> Been trying to display multiple form rows for a project lately, and I  
> just wanted to confirm that I'm doing this right. I found a solution  
> on http://www.pointy-stick.com/blog/2009/01/23/advanced-formset-usage-django/ 
> , and I took what I needed from it (my code below), but I found that  
> whenever I passed in my request.POST data it was getting overwritten  
> by the users and resource data.


Because your code is saying that the "user" and "resource" values should
always be looked up from the database. In the blog post you're referring
to, the data that is retrieved from the database is completely
orthogonal to the values supplied by the HTML form. Rather, the database
values are used to provide things like the quiz question and determine
the right answer, whilst the HTML form provides the question answers.

If you only want those database values to be used as initial data, it's
probably a bit simpler. Pass in "user" and "resource" as initial data
values to each subform. That is, you'll want to do the equivalent of 

r_form = ResourceRoleForm(initial={'user': ...,
'resource': ...})

so you can simplify the ResourceRoleForm.__init__ method, for example.
Actually, on closer inspection, it's not quite "user" and "resource"
that are the initial data values, but something derived from them. So
construct the right initial data values and then in _construct_form()
you pass through a dictionary that looks like this:

{"initial": {"user": ..., "resource": ...}}

I hope that gives you a few hints. If it's still a bit confusing, step
away from trying to work with multiple forms all at once. Get it working
using initial data and only a single form. Then you'll have your form
class working properly and can work out how it should be constructed,
which means you can work out what _construct_form() has to pass through.

When I wrote my code in that article (in both versions -- the most
recent one and the earlier non-formset version), I first worked out what
a single form case would look like and then generalised.

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Simply adding GROUP BY to a QuerySet

2009-02-18 Thread Malcolm Tredinnick

On Wed, 2009-02-18 at 09:12 -0800, Deniz Dogan wrote:
> Hi
> 
> I'm having trouble understanding the new aggregation support in Django
> 1.1, and here is what I want to do:
> 
> Let's say I have a model called Bike with a DateField called
> "production_date". Now I want to get all of the Bikes and group them
> by their production date. How would I do this in Django? I can't seem
> to figure it out.

We intentionally haven't exposed raw "group by". Rather, "group by" is
used to implement particular functionality, such as aggregates.

In your case, you can group similar production dates together simply by
ordering by production date. There shouldn't be any need to use SQL's
"GROUP BY" there.

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Add value to request header?

2009-02-18 Thread Malcolm Tredinnick

On Wed, 2009-02-18 at 07:16 -0800, Brandon Taylor wrote:
> Hi everyone,
> 
> I know how to modify a response header value, but not a request header
> value. I need to integrate with an external system that is injecting a
> value in the request header that I need to check for.
> 
> Is it possible to mock this behavior in Django? I'm not very familiar
> with how these values get added to the request/response from Apache in
> the first place.

Are you trying to modify them in the test system? If so, you can add
headers via the test.client.Client class. That simulates setting them on
the  client side.

If you're trying to modify them some other way, then the answer is
"don't do that". Request objects are read-only, not modifiable.

Your final question, above, doesn't make a lot of sense. Headers are
part of the HTTP data. They are just lines of text at the start of the
request. Apache (or other web server) parses those lines and passes
them, via some data structure or other, to consumers such as Django.
Django then uses that data structure (it's different for, say,
mod_python and WSGI interfaces) to create the request.META dictionary.

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Customizing Admin to display non-editable fields

2009-02-18 Thread Malcolm Tredinnick

On Wed, 2009-02-18 at 06:15 -0800, mermer wrote:
> Thanks,  that works very well - but as you mentioned is certainly not
> intuitive.
> 
> Can you use a similar technique to prepopulate fields?  My use case is
> this:-
> 
> I want to display an INLINE formset.  Though records which already
> exist I want to display but make certain fields uneditable
> Using the "Extra"  I want to give the adminstrator the ability to add
> an inline record, but restrict certain fields, by making sure that
> they are prepopulated with data, which are also uneditable.

Anything is possible, since this is Python. Can it be done
out-of-the-box? No. As already mentioned, the admin doesn't support
read-only data like that yet.

Creating read-only form fields isn't really that unintuitive. It might
take a bit of fiddling to get it working properly, but that's life in
the software development business.

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Any way to show progress during a short process job?

2009-02-18 Thread Malcolm Tredinnick

On Wed, 2009-02-18 at 12:20 +, Adam Stein wrote:
> Maybe somebody can suggest how to get the functionality I'm trying to
> duplicate.  I looked and can't find anything that seemed similiar.
> 
> I have a form with checkboxes.  User selects one or more and submits the
> form.  The processing currently goes like this:
> 
> 1) Write JavaScript to display moving progress bar
> 2) Process based on checked boxes (which in my specific example is to
> copy the specified databases into a sandbox area)
> 3) Write JavaScript to turn off progress bar
> 
> The database copying is short, up to about 20 seconds.  Short enough to
> let the user wait, long enough that I want to indicate the computer
> hasn't frozen :-{}
> 
> It seems that I can only return HTML to be displayed once from a view.
> Is there a way to get the functionality described above somehow?

It's called AJAX. You have to keep asking the server for an update and
then updating the page.

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Authentication with LDAP

2009-02-18 Thread Antoni Aloy

2009/2/18 João Olavo Baião de Vasconcelos :
> Hi all,
>
> I'd like to login in Admin site and authenticate with LDAP. Is there a "most
> used LDAP authentication backend"?
> I found the backend ldapauth.py [1], that seems to be the one. Is this the
> best solution?
>
> I see that in [2] that are many patches. Is the file in [1] updated, or do I
> have to apply the patches?
>
> [1] http://code.djangoproject.com/attachment/ticket/2507/ldapauth.py
> [2] http://code.djangoproject.com/ticket/2507
>

This is a quite nice tutorial, perphaps it would help you.

http://www.carthage.edu/webdev/?p=12

The LDAP backend is quite simple, as it Active Directory backend, so
perhaps you can debug it and tell where is your problem. On the other
hand, remember that the ldap backend would be begore the default
backend.

-- 
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.net

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



Re: sql query for manytomany table

2009-02-18 Thread Karen Tracey
On Wed, Feb 18, 2009 at 4:14 PM, May  wrote:

>
> Hello Karen,
>
> What I need then is to rewrite the model statement.  I imported the
> tables from MySQL, so the table structures were already set.  Should I
> add a manytomany field in the contact table?  I'm concerned about
> django creating a new separate table from the intermed table I already
> have. Resolving this problem will probably solve my admin template
> issue, which is that on the publication screen, I can reveal a contact
> for the publication, but I can't reveal the institutions the contact
> is associated with.
>

? Switching from what you have to a ManyToMany field in Contact doesn't
fundamentally change anything -- you still retain the possibility of
multiple Institutions per Contact.

You first need to answer the question as to whether that data model is
correct.  If it makes no sense that Contacts are associated with multiple
Institutions in whatever real data situation you are modeling, if Contacts
are logically associated with only a single Institution, then it would
probably be more appropriate for your Contact model to have a ForeignKey to
Institution.  Then the question "What Institution is associated with this
Contact?" will have exactly one answer (or None, iff null/blank is allowed
for that ForeignKey). This seemed to be what you were assuming in your
template code, but I don't know if it matches the real data you are
modeling, as it does not match your defined data models.

If, however, in your real data model it makes sense for Contacts to be
associated with multiple Institutions, then the right answer is to fix your
code to recognize that "Institution for this Contact" makes no sense, and
wherever you are looking for that answer the right thing, probably, is to
substitute "list of Institutions for this Contact".

Only someone who understands the actual data being modeled here can say what
the right answer is.  Who set up these tables initially in MySQL?  They seem
to have allowed for a possibility that you don't seem to think is valid, but
I have no idea which one correctly matches the actual data you are modeling.

Karen

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



Re: can template var be passed into template tag?

2009-02-18 Thread Margie


Thanks Karen.  Don't know how I missed that.

On Feb 18, 11:49 am, Karen Tracey  wrote:
> On Wed, Feb 18, 2009 at 2:35 PM, Margie  wrote:
>
> > Is there a way to pass a template variable into a custom template
> > tag?
>
> Certainly.  Please read:
>
> http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#pass...
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: sql query for manytomany table

2009-02-18 Thread May

Hello Karen,

What I need then is to rewrite the model statement.  I imported the
tables from MySQL, so the table structures were already set.  Should I
add a manytomany field in the contact table?  I'm concerned about
django creating a new separate table from the intermed table I already
have. Resolving this problem will probably solve my admin template
issue, which is that on the publication screen, I can reveal a contact
for the publication, but I can't reveal the institutions the contact
is associated with.

May

On Feb 18, 1:01 pm, Karen Tracey  wrote:
> On Wed, Feb 18, 2009 at 3:13 PM, May  wrote:
>
> > Hello Karen,
>
> > Yes, I seem confused here.  I've been trying everything.  The key is
> > that this query works correctly in the postgres database to retrieve
> > the institutionname (institution), using the contact id retrieved from
> > Project:
>
> > select DISTINCT Institution.institution
> > from Contactintermed, Institution, Project
> > where Contactintermed.contact_id=Project.contact_id
> > and Contactintermed.institution_id=Institution.id
>
> What do you mean by "works correctly"?  You mean it retrieves exactly one
> result?  If so, that is an accident of the data you happen to have in your
> DB, not anything guaranteed by the models you have defined.  As you have
> defined your models, any Contact might have multiple associated
> Institutions, so asking how to come up with THE institution associated with
> a Contact is futile.  There isn't one, there is a list (accessible via the
> Contact.contactintermed_set related manager) of 0, 1, or more.  If you want
> to print out all Institutions associated with a Contact, you can iterate
> through that set for each contact in the template, something like (warning
> -- untested syntax, I could be misremembering details):
>
> {% for project in results %}
>     {{project.contact|safe}}
>     {% for ci in project.contact.contactintermed_set.all %}
>         {{ ci.institution }}
>     {% endfor %}
> {% endfor %}
>
> But there is nothing in your data models that guarantees the length of
> contactintermed_set for a given Contact is going to be 1.  If there is
> something in the actual data model that guarantees that then your Django
> model definitions aren't properly reflecting your real data model.
>
> > In Python after I do a search by keyword in the view to get the
> > "results", I cannot get the template to display the institution name
> > (which I call institution).  The query must first retrieve the Project
> > records.  From the project records I can then grab the contactid,
> > which is then used in the Contactintermed table, which then goes to
> > the Institution table to retrieve the institution name (institution).
> > The "results" statement, doesn't seem to drill down through the
> > Contactintermed table, even though I've tried adding the
> > select_related to the statement.
>
> select_related doesn't affect what's accessible via a model, it's purely a
> performance optimization that affects how many SQL queries will be issued
> under the covers when following ForeignKey relationships.  It's also not
> applicable here in terms of 'drilling down' to Contactintermed because
> neither your Project nor your Contact model has a ForeignKey to
> Contactintermed, rather Contactintermed is the one with the ForeignKeys back
> to Contact and Institution.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: sql query for manytomany table

2009-02-18 Thread Karen Tracey
Regarding whether to dpaste or not: Ideally, there is a happy medium were
the bulk of a problem is described in email and dpaste (or simliar) is used
for full specifics of the code, if necessary, to get help.  Usually when the
line (or section) of code that is causing the problem is identified, it is
quoted in the email citing it, making the problem and its solution
understandable even in the absence of the supporting dpaste material.

Please do continue to use dpaste for huge swaths of code that are going to
render poorly in email.  The fix to the resulting problem of the post itself
being largely unintelligible in the absence of the dpaste material is to add
text and code snippets to the email, describing the problem.  The answer is
NOT to move the full code back to the post, where it is just going to make
people's eyes bleed and discourage many from even attempting to help because
they cannot makes heads or tails of what is on the screen.

Karen

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



Re: My app is missing!

2009-02-18 Thread djandrow

I am:

C:\Program Files\Apache2.2\akonline>python "C:\ProgLangs\Python25\Lib
\site-packa
ges\django\conf\project_template\manage.py" sqlall blog
Error: App with label blog could not be found. Are you sure your
INSTALLED_APPS
setting is correct?

On Feb 18, 9:00 pm, Malinka Rellikwodahs  wrote:
> my first gues would be you are not in the akonline folder
>
> On Wed, Feb 18, 2009 at 15:54, djandrow  wrote:
>
> > Hello all,
>
> > I've been trying to add a few extra fields to my model, as part of my
> > blog app. So then I tried sqlall:
>
> > python "C:\ProgLangs\Python25\Lib\site-packages\django\conf
> > \project_template\manage.py" sqlall blog
>
> > theres another thread about why i've included the path, but i don't
> > see why it should make a difference.  Anyway, when i run that i get
> > this error message.
>
> > Error: App with label blog could not be found. Are you sure your
> > INSTALLED_APPS
> > setting is correct?
>
> > my installed apps looks like this ;
>
> > INSTALLED_APPS = (
> >    'django.contrib.auth',
> >    'django.contrib.contenttypes',
> >    'django.contrib.sessions',
> >    'django.contrib.sites',
> >    'django.contrib.admin',
> >    'akonline.blog',
> > )
>
> > it exists in akonline/blog and i created it in the proper way so can
> > someone explain why i get an error? Or are there some things i can try
> > to see whats going on?
>
> > Thanks,
>
> > Andrew
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: sql query for manytomany table

2009-02-18 Thread Karen Tracey
On Wed, Feb 18, 2009 at 3:13 PM, May  wrote:

>
> Hello Karen,
>
> Yes, I seem confused here.  I've been trying everything.  The key is
> that this query works correctly in the postgres database to retrieve
> the institutionname (institution), using the contact id retrieved from
> Project:
>
> select DISTINCT Institution.institution
> from Contactintermed, Institution, Project
> where Contactintermed.contact_id=Project.contact_id
> and Contactintermed.institution_id=Institution.id
>
>
What do you mean by "works correctly"?  You mean it retrieves exactly one
result?  If so, that is an accident of the data you happen to have in your
DB, not anything guaranteed by the models you have defined.  As you have
defined your models, any Contact might have multiple associated
Institutions, so asking how to come up with THE institution associated with
a Contact is futile.  There isn't one, there is a list (accessible via the
Contact.contactintermed_set related manager) of 0, 1, or more.  If you want
to print out all Institutions associated with a Contact, you can iterate
through that set for each contact in the template, something like (warning
-- untested syntax, I could be misremembering details):

{% for project in results %}
{{project.contact|safe}}
{% for ci in project.contact.contactintermed_set.all %}
{{ ci.institution }}
{% endfor %}
{% endfor %}

But there is nothing in your data models that guarantees the length of
contactintermed_set for a given Contact is going to be 1.  If there is
something in the actual data model that guarantees that then your Django
model definitions aren't properly reflecting your real data model.


> In Python after I do a search by keyword in the view to get the
> "results", I cannot get the template to display the institution name
> (which I call institution).  The query must first retrieve the Project
> records.  From the project records I can then grab the contactid,
> which is then used in the Contactintermed table, which then goes to
> the Institution table to retrieve the institution name (institution).
> The "results" statement, doesn't seem to drill down through the
> Contactintermed table, even though I've tried adding the
> select_related to the statement.


select_related doesn't affect what's accessible via a model, it's purely a
performance optimization that affects how many SQL queries will be issued
under the covers when following ForeignKey relationships.  It's also not
applicable here in terms of 'drilling down' to Contactintermed because
neither your Project nor your Contact model has a ForeignKey to
Contactintermed, rather Contactintermed is the one with the ForeignKeys back
to Contact and Institution.

Karen

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



Re: My app is missing!

2009-02-18 Thread Malinka Rellikwodahs

my first gues would be you are not in the akonline folder

On Wed, Feb 18, 2009 at 15:54, djandrow  wrote:
>
> Hello all,
>
> I've been trying to add a few extra fields to my model, as part of my
> blog app. So then I tried sqlall:
>
> python "C:\ProgLangs\Python25\Lib\site-packages\django\conf
> \project_template\manage.py" sqlall blog
>
> theres another thread about why i've included the path, but i don't
> see why it should make a difference.  Anyway, when i run that i get
> this error message.
>
> Error: App with label blog could not be found. Are you sure your
> INSTALLED_APPS
> setting is correct?
>
> my installed apps looks like this ;
>
> INSTALLED_APPS = (
>'django.contrib.auth',
>'django.contrib.contenttypes',
>'django.contrib.sessions',
>'django.contrib.sites',
>'django.contrib.admin',
>'akonline.blog',
> )
>
> it exists in akonline/blog and i created it in the proper way so can
> someone explain why i get an error? Or are there some things i can try
> to see whats going on?
>
> Thanks,
>
> Andrew
> >
>

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



My app is missing!

2009-02-18 Thread djandrow

Hello all,

I've been trying to add a few extra fields to my model, as part of my
blog app. So then I tried sqlall:

python "C:\ProgLangs\Python25\Lib\site-packages\django\conf
\project_template\manage.py" sqlall blog

theres another thread about why i've included the path, but i don't
see why it should make a difference.  Anyway, when i run that i get
this error message.

Error: App with label blog could not be found. Are you sure your
INSTALLED_APPS
setting is correct?

my installed apps looks like this ;

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'akonline.blog',
)

it exists in akonline/blog and i created it in the proper way so can
someone explain why i get an error? Or are there some things i can try
to see whats going on?

Thanks,

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



Re: WYSIWYG Image upload challenge

2009-02-18 Thread Colin Bean

On Wed, Feb 18, 2009 at 10:50 AM, phoebebright
 wrote:
>
> The javascript makes a call to this view on submitting the form that
> uploads the image.
>
> def uploadimage(request):
>try:
>upload_full_path = settings.CONTENT_IMAGES
>
>upload = request.FILES['image']
>dest = open(os.path.join(upload_full_path,
> upload.name), 'wb+')
>
>for chunk in upload.chunks():
>dest.write(chunk)
>
>dest.close()
>
>result='{status:"UPLOADED",image_url:"%s%s"}' %
> (settings.CONTENT_IMAGES_URL, upload.name)
>
>return_data = HttpResponse(result,mimetype='Content-
> Type: text/
> html')
>
>except Exception, e:
>return_data = HttpResponse("Error in uploading image")
>
>return_data.flush()
>
>return return_data
>
> In Firefox/Mac it uploads the file and returns
> "{status:"UPLOADED",image_url:"/site_media/content/
> dalston_cranes.JPG"}" to javascript which tells javascript all went
> well.  In IE/Safari the file is uploaded successfully but the above
> text is downloaded as a file called something like 2s6OP6WO(2).part so
> control doesn't return to the javascript.  Have applied a similar
> program in PHP and it works fine. Tried different mime types and tried
> to trace what is going on but without progress.
>
> Phoebe
>
>
> On Feb 18, 2:33 pm, Almost George 
> wrote:
>> On Feb 18, 5:36 am, phoebebright  wrote:
>>
>> > There is something different about the way django is handling to response 
>> > to php I think.
>>
>> I use the YUI Rich Editor in admin, and have no problems. I know
>> debugging isn't as easy in IE as others, but do your best to find out
>> the exact response (mostly, response headers) that's being sent to the
>> browser. Also, could you clarify the above "response to PHP"
>> statement? Perhaps explaining the technical details of what's going on
>> would be of some help?
> >
>


Tools like Tamper Data (firefox extension) or WebScarab (standalone
proxy) let you examine all the header values sent with an HTTP
request.   You could use this to compare the exact headers returned by
PHP vs. Django, and fix any differences in the Django response.

Colin

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



Re: sql query for manytomany table

2009-02-18 Thread May

Hello Angel,

Previously, when I placed code into the message, I was reprimanded by
users for taking up message space and to use dpaste.  However, I agree
with you, the code is necessary for future reference.  Since, you also
seem to agree, I will henceforth place the code into the message.

Thanks,

May

On Feb 18, 11:55 am, Angel Cruz  wrote:
> this off topic, but i am saving these postings in my gmail.  The problem
> with putting  your code in dpaste is that in 29 days, that link is invalid,
> and when I look upon this thread in the future, I will have no idea what
> your source looks like and what the possible solutions are.
>
> dpaste looks cool, but may be a bad idea to use here?
>
> On Wed, Feb 18, 2009 at 11:48 AM, May  wrote:
>
> > The complete view is here:
>
> >http://dpaste.com/17/
>
> > On Feb 18, 11:46 am, May  wrote:
> > > Hello Karen,
>
> > > Here are my views and models:
>
> > >http://dpaste.com/122204/
>
> > >http://dpaste.com/14/
>
> > > The manytomany table is actually a tertiary table.  I was just trying
> > > to use django terms, so people would understand what type of table.
>
> > > Thanks for your help!
>
> > > May
>
> > > On Feb 18, 11:33 am, Karen Tracey  wrote:
>
> > > > On Wed, Feb 18, 2009 at 1:43 PM, May  wrote:
>
> > > > > I need to get the institution name through an intermediary table (two
> > > > > foreign keys) to display in a template.
>
> > > > > The code is here:
>
> > > > >http://dpaste.com/122204/
>
> > > > > Thank you anyone,
>
> > > > (Your subject line says manytomany but I don't see any evidence of
> > > > ManyToMany relations in the page you point to, there you just mention
> > > > ForeignKeys?)
>
> > > > Your view passes in a results variable to your template where you have:
>
> > > > {% for project in results %}
> > > > {{Project.contact|safe}}
> > > > {{Contact.institutionname|safe}} # the institutionname (isn't
> > retrieving)...
> > > > {% endfor %}
>
> > > > First, I don't see how the {{Project..}} bit can be working since
> > you've got
> > > > a case mismatch on the leading 'p' between {% for project ... %} and {{
> > > > Project...}}
>
> > > > Second, {{ Contact...}} won't be resolving to anything because you
> > don't
> > > > have any variable named Contact.  Perhaps you want:
>
> > > > {{ project.contact.institution }}
>
> > > > or
>
> > > > {{ project.contact.institution.institutionname }}
>
> > > > it's a little hard to tell because you didn't actually include your
> > model
> > > > definitions.  If it's just following foreign keys to get to the field
> > you
> > > > want, though, it's quite easy to do using the dot notation if you know
> > the
> > > > right field names.
>
> > > > Karen
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: sql query for manytomany table

2009-02-18 Thread May

Hello Karen,

Yes, I seem confused here.  I've been trying everything.  The key is
that this query works correctly in the postgres database to retrieve
the institutionname (institution), using the contact id retrieved from
Project:

select DISTINCT Institution.institution
from Contactintermed, Institution, Project
where Contactintermed.contact_id=Project.contact_id
and Contactintermed.institution_id=Institution.id


In Python after I do a search by keyword in the view to get the
"results", I cannot get the template to display the institution name
(which I call institution).  The query must first retrieve the Project
records.  From the project records I can then grab the contactid,
which is then used in the Contactintermed table, which then goes to
the Institution table to retrieve the institution name (institution).
The "results" statement, doesn't seem to drill down through the
Contactintermed table, even though I've tried adding the
select_related to the statement.

def search(request):
query = request.GET.get('qr', '')
if query:
qset = (
   Q(restitlestrip__icontains=query)
)
results = Project.objects.filter(qset).distinct() # original
else:
results = []
return render_to_response("search/search.html", {
"results": results,
"query": query,
})




On Feb 18, 11:58 am, Karen Tracey  wrote:
> On Wed, Feb 18, 2009 at 2:46 PM, May  wrote:
>
> > Hello Karen,
>
> > Here are my views and models:
>
> >http://dpaste.com/122204/
>
> >http://dpaste.com/14/
>
> > The manytomany table is actually a tertiary table.  I was just trying
> > to use django terms, so people would understand what type of table.
>
> > Thanks for your help!
>
> So Contact doesn't have a foreign key to Institution but rather there's
> another many to many sort of table that pairs Contacts with Institutions.
> Which means I don't know what you are hoping to get from:
>
> {{Contact.institutionname|safe}}
>
> There are potentially many institutions associated with any given Contact
> instance -- how are you expecting to come up with just one institution name
> for a Contact?
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django and database views

2009-02-18 Thread will0



On Jan 6, 12:47 am, drakkan  wrote:
> On 6 Gen, 00:41, drakkan  wrote:

>
> Suppose I want to delete an user. This user is in table1 and so in
> databaseview too. Django default is to do adeletecascade so it tries
> to remove the user from table1, databaseview and auth_user: it fails
> when try to remove user from databaseview.
>
> A possible solution would be :
>
> - before issue user.delete(), issue something like
> table1.objects.filter(user=u).delete() (this way user reference
> disappear from databaseview too) and then u.delete()
>

I've just had this problem and fixed it simply by adding a rule in the
database:
"create rule myrule as on delete to mytable do instead nothing;"
Django still attempts to delete the record but the db (Postgres) just
ignores it.

http://www.postgresql.org/docs/8.1/static/rules-update.html

Hence the error message:
HINT:  You need an unconditional ON DELETE DO INSTEAD rule.


HTH

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



django-sphinx Passages Help

2009-02-18 Thread Worldreptiles

I asked this question on the django-sphinx group a few days ago but so
far havent recievied any replies so i thought i would ask here. I'm
trying to use the passages function "BuildExcerpts" feature of sphinx
and have been unable to get it to work. Im not new to sphinx but i am
to django. So if anyone with experience using the django-sphinx app
could give me a basic usage example for views.py and the template i
would appericate it.

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: sql query for manytomany table

2009-02-18 Thread Karen Tracey
On Wed, Feb 18, 2009 at 2:46 PM, May  wrote:

>
> Hello Karen,
>
> Here are my views and models:
>
> http://dpaste.com/122204/
>
> http://dpaste.com/14/
>
>
> The manytomany table is actually a tertiary table.  I was just trying
> to use django terms, so people would understand what type of table.
>
> Thanks for your help!
>
>
So Contact doesn't have a foreign key to Institution but rather there's
another many to many sort of table that pairs Contacts with Institutions.
Which means I don't know what you are hoping to get from:

{{Contact.institutionname|safe}}

There are potentially many institutions associated with any given Contact
instance -- how are you expecting to come up with just one institution name
for a Contact?

Karen

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



Re: sql query for manytomany table

2009-02-18 Thread Angel Cruz
this off topic, but i am saving these postings in my gmail.  The problem
with putting  your code in dpaste is that in 29 days, that link is invalid,
and when I look upon this thread in the future, I will have no idea what
your source looks like and what the possible solutions are.

dpaste looks cool, but may be a bad idea to use here?

On Wed, Feb 18, 2009 at 11:48 AM, May  wrote:

>
> The complete view is here:
>
> http://dpaste.com/17/
>
> On Feb 18, 11:46 am, May  wrote:
> > Hello Karen,
> >
> > Here are my views and models:
> >
> > http://dpaste.com/122204/
> >
> > http://dpaste.com/14/
> >
> > The manytomany table is actually a tertiary table.  I was just trying
> > to use django terms, so people would understand what type of table.
> >
> > Thanks for your help!
> >
> > May
> >
> > On Feb 18, 11:33 am, Karen Tracey  wrote:
> >
> > > On Wed, Feb 18, 2009 at 1:43 PM, May  wrote:
> >
> > > > I need to get the institution name through an intermediary table (two
> > > > foreign keys) to display in a template.
> >
> > > > The code is here:
> >
> > > >http://dpaste.com/122204/
> >
> > > > Thank you anyone,
> >
> > > (Your subject line says manytomany but I don't see any evidence of
> > > ManyToMany relations in the page you point to, there you just mention
> > > ForeignKeys?)
> >
> > > Your view passes in a results variable to your template where you have:
> >
> > > {% for project in results %}
> > > {{Project.contact|safe}}
> > > {{Contact.institutionname|safe}} # the institutionname (isn't
> retrieving)...
> > > {% endfor %}
> >
> > > First, I don't see how the {{Project..}} bit can be working since
> you've got
> > > a case mismatch on the leading 'p' between {% for project ... %} and {{
> > > Project...}}
> >
> > > Second, {{ Contact...}} won't be resolving to anything because you
> don't
> > > have any variable named Contact.  Perhaps you want:
> >
> > > {{ project.contact.institution }}
> >
> > > or
> >
> > > {{ project.contact.institution.institutionname }}
> >
> > > it's a little hard to tell because you didn't actually include your
> model
> > > definitions.  If it's just following foreign keys to get to the field
> you
> > > want, though, it's quite easy to do using the dot notation if you know
> the
> > > right field names.
> >
> > > Karen
> >
> >
> >
>

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



Re: can template var be passed into template tag?

2009-02-18 Thread Karen Tracey
On Wed, Feb 18, 2009 at 2:35 PM, Margie  wrote:

>
> Is there a way to pass a template variable into a custom template
> tag?


Certainly.  Please read:

http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#passing-template-variables-to-the-tag

Karen

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



Re: sql query for manytomany table

2009-02-18 Thread May

The complete view is here:

http://dpaste.com/17/

On Feb 18, 11:46 am, May  wrote:
> Hello Karen,
>
> Here are my views and models:
>
> http://dpaste.com/122204/
>
> http://dpaste.com/14/
>
> The manytomany table is actually a tertiary table.  I was just trying
> to use django terms, so people would understand what type of table.
>
> Thanks for your help!
>
> May
>
> On Feb 18, 11:33 am, Karen Tracey  wrote:
>
> > On Wed, Feb 18, 2009 at 1:43 PM, May  wrote:
>
> > > I need to get the institution name through an intermediary table (two
> > > foreign keys) to display in a template.
>
> > > The code is here:
>
> > >http://dpaste.com/122204/
>
> > > Thank you anyone,
>
> > (Your subject line says manytomany but I don't see any evidence of
> > ManyToMany relations in the page you point to, there you just mention
> > ForeignKeys?)
>
> > Your view passes in a results variable to your template where you have:
>
> > {% for project in results %}
> > {{Project.contact|safe}}
> > {{Contact.institutionname|safe}} # the institutionname (isn't retrieving)...
> > {% endfor %}
>
> > First, I don't see how the {{Project..}} bit can be working since you've got
> > a case mismatch on the leading 'p' between {% for project ... %} and {{
> > Project...}}
>
> > Second, {{ Contact...}} won't be resolving to anything because you don't
> > have any variable named Contact.  Perhaps you want:
>
> > {{ project.contact.institution }}
>
> > or
>
> > {{ project.contact.institution.institutionname }}
>
> > it's a little hard to tell because you didn't actually include your model
> > definitions.  If it's just following foreign keys to get to the field you
> > want, though, it's quite easy to do using the dot notation if you know the
> > right field names.
>
> > Karen
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: sql query for manytomany table

2009-02-18 Thread May

Hello Karen,

Here are my views and models:

http://dpaste.com/122204/

http://dpaste.com/14/


The manytomany table is actually a tertiary table.  I was just trying
to use django terms, so people would understand what type of table.

Thanks for your help!

May

On Feb 18, 11:33 am, Karen Tracey  wrote:
> On Wed, Feb 18, 2009 at 1:43 PM, May  wrote:
>
> > I need to get the institution name through an intermediary table (two
> > foreign keys) to display in a template.
>
> > The code is here:
>
> >http://dpaste.com/122204/
>
> > Thank you anyone,
>
> (Your subject line says manytomany but I don't see any evidence of
> ManyToMany relations in the page you point to, there you just mention
> ForeignKeys?)
>
> Your view passes in a results variable to your template where you have:
>
> {% for project in results %}
> {{Project.contact|safe}}
> {{Contact.institutionname|safe}} # the institutionname (isn't retrieving)...
> {% endfor %}
>
> First, I don't see how the {{Project..}} bit can be working since you've got
> a case mismatch on the leading 'p' between {% for project ... %} and {{
> Project...}}
>
> Second, {{ Contact...}} won't be resolving to anything because you don't
> have any variable named Contact.  Perhaps you want:
>
> {{ project.contact.institution }}
>
> or
>
> {{ project.contact.institution.institutionname }}
>
> it's a little hard to tell because you didn't actually include your model
> definitions.  If it's just following foreign keys to get to the field you
> want, though, it's quite easy to do using the dot notation if you know the
> right field names.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Weird error on Foreign key save?

2009-02-18 Thread Karen Tracey
On Wed, Feb 18, 2009 at 2:30 PM, Alfonso  wrote:

>
> I've got an invoice model that foreign key's to a customer model, when
> the invoice is saved I'm update a few fields in that related customer
> model to make other code in my setup work.  I keep getting
> "unsupported operand type(s) for ** or pow(): 'Decimal' and
> 'NoneType'"  whenever I try to save the foreignkey model:
>
> [snip]
> I'm thinking I'm looking too closely at something there where the
> problem might be in the related model:
>
> I'm missing something simple but what!?  BTW these models are created
> in separate apps if that makes any difference.
>

Your models wrap rather badly in email, someplace like dpaste.com would be
far better for viewing them.  One really significant thing you've missed is
posting the traceback (again, probably better viewed on dpaste.com).  The
traceback shows what exact line of code is trying to ** incompatible types,
which would be an incredibly useful bit of information to have when
diagnosing the problem.

Karen

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



can template var be passed into template tag?

2009-02-18 Thread Margie

Is there a way to pass a template variable into a custom template
tag?  For example, say that my template is rendered like this, so that
books is in the context:

books = books.objects.all()
return render_to_response(template.html, {
  "books":books
 } context_instance=RequestContext(request)

Now say inside my template I want to do something like this:

{% for book in books %}
  {% getBookInfo book %}
{% endfor %}

The idea being that getBookInfo is going to return some html that
describes the book.

However, I find that the book variable is not expanded.  So when I get
into my getBookInfo custom template tag, the first argument it gets is
just the literal 'book', rather than the book object created by
iterating through books.

This seems like a reasonable thing to want to do - am I approaching it
the wrong way somehow?

Margie

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



Re: sql query for manytomany table

2009-02-18 Thread Karen Tracey
On Wed, Feb 18, 2009 at 1:43 PM, May  wrote:

>
> I need to get the institution name through an intermediary table (two
> foreign keys) to display in a template.
>
> The code is here:
>
> http://dpaste.com/122204/
>
> Thank you anyone,
>

(Your subject line says manytomany but I don't see any evidence of
ManyToMany relations in the page you point to, there you just mention
ForeignKeys?)

Your view passes in a results variable to your template where you have:

{% for project in results %}
{{Project.contact|safe}}
{{Contact.institutionname|safe}} # the institutionname (isn't retrieving)...
{% endfor %}

First, I don't see how the {{Project..}} bit can be working since you've got
a case mismatch on the leading 'p' between {% for project ... %} and {{
Project...}}

Second, {{ Contact...}} won't be resolving to anything because you don't
have any variable named Contact.  Perhaps you want:

{{ project.contact.institution }}

or

{{ project.contact.institution.institutionname }}

it's a little hard to tell because you didn't actually include your model
definitions.  If it's just following foreign keys to get to the field you
want, though, it's quite easy to do using the dot notation if you know the
right field names.

Karen

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



Re: Dhango help

2009-02-18 Thread garagefan

i'm just kinda wondering how you're going to be showing a demo of
django when you don't know anything about it, nor how to set it up.

On Feb 18, 10:19 am, "s.sudharsan siva" 
wrote:
> Hii am new to Django we are planning to show a demo on Django on FOss
> conf09.. can any one help with how to start with Django and what to demo
> --
> With Regards
> S.Sudharsan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Weird error on Foreign key save?

2009-02-18 Thread Alfonso

I've got an invoice model that foreign key's to a customer model, when
the invoice is saved I'm update a few fields in that related customer
model to make other code in my setup work.  I keep getting
"unsupported operand type(s) for ** or pow(): 'Decimal' and
'NoneType'"  whenever I try to save the foreignkey model:

class Customer(models.Model):
  """ Customer Model """
  customer_id   = models.CharField(max_length=10)
  customer_name = models.CharField(max_length=100)
  slug  = models.SlugField(unique=True)
  outstanding_amount= models.DecimalField(editable=False,
default='0.00')

class CustomerInvoice(models.Model):
  customer= models.ForeignKey(Customer,
related_name="customer_invoices")
  invoice_id  = models.CharField(max_length=10,
editable=False)
  invoice_paid_date = models.DateField(blank=True, null=True)
  invoice_total = models.DecimalField(max_digits=10, decimal_places=2,
editable=False, default='0.00')

def save(self):
if not self.invoice_paid:
  self.customer.outstanding_amount = self.invoice_total
  self.customer.save()

I'm thinking I'm looking too closely at something there where the
problem might be in the related model:

I'm missing something simple but what!?  BTW these models are created
in separate apps if that makes any difference.

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



apache authentication

2009-02-18 Thread Jlcarroll

I am creating a private genealogy web page of pictures/obituaries/data
files/census records etc... all just a set of files within a directory
structure. I just want Apache to index the directory's contents and
the files within them and serve them over the web. That works fine.
Then I wanted to restrict access, which also worked fine using
standard .htaccess authentication.That works fine also,

But then I want to integrate that into my django web page, and
restrict access using the django user database instead of the external
user database.

When I set the contents of my .htaccess files as follows:

AuthType Basic
AuthName "jlcarroll.net"
Require valid-user
SetEnv DJANGO_SETTINGS_MODULE django_smug.settings
PythonAuthenHandler django.contrib.auth.handlers.modpython
pythonOption DJANGO_SETTINGS_MODULE django_smug.settings
Options +Indexes
SetHandler None

Authentication works fine, and I can index the files, but the index
doesn't show directories for some
strange reason which means either I need a flat file structure
(which would be very bad, right now I have a directory for each family
and sub-directories for each person, with a flat structure you would
never be able to find anything) or I need to just let everyone have
access, which could be bad too, since there are pictures of living
people in there (cousins etc). The only weird thing in the above is
the SetHandler None, which is there because I want Apache to index the
files, and I haven't written a view to index them. I could write a
view, but that is slower, and I am curious what is wrong, they are
static files, so I would rather let Apache handle it.

When I change the .htaccess file to the following:

Options +Indexes
SetHandler None

It indexes files and directories, but of course has no authentication.
No idea why

when I set it to:

AuthName "HohumRealm"
AuthType Basic
AuthUserFile /home/jlc/Family.passwd
require valid-user
Options +Indexes
SetHandler None

Authentication works, and directories index, but the user database is
not synced to django's user database. So, this seems to mean that I
can't use django authentication, but have to use old school .htaccess
authentication to protect directories IF I want directory indexing to
function correctly. This isn't a deal killer, but it does mean that I
can't use the same user/password list for both, which is a bother to
my users (they have to create a user twice, and some of them are
computer illiterate, and would get confused). Any ideas how to fix
this? If it could be fixed, it would be a MUCH better solution than
doing things the old-school way.

Apache version is 2.2.9,

What other information would be useful?

Thanks in advance for your help,

James

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



Re: Python Versions and manage.py

2009-02-18 Thread Karen Tracey
On Wed, Feb 18, 2009 at 10:44 AM, djandrow wrote:

>
> Hello,
>
> I have python 2.5 and 2.6 installed on my computer and when i try to
> run manage.py sqlall I get an error:
>
> raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> module: Module use of python25.dll conflicts with this version of
> Python.
>
> This is because it is using python 2.6 and the mysql backend is for
> 2.5, there isn't an exe backend for windows.
>

Actually, there is an exe for 2.6, see:

http://groups.google.com/group/django-users/msg/5b5f4dee148d0fc3

I gave that a brief try and it worked for me (ignoring some deprecation
warnings about sets).


> I'm using the command line and want to know how i can change the
> python versions. I have my system path set up for 2.5 so I don't know
> what effect that has.
>

Apparently you've put something in your system PATH setting that is pulling
in Python 2.5 stuff even when you are running Python 2.6, but I'm not sure
what.  I've found it fairly easy to switch between two Pythons on Windows by
letting the last install (2.6 in my case) set up the file association for
.py to the 2.6 Python executable and having the 2.5 Python directory (just
the location of python.exe, nothing else) in the PATH.  Then when I issue a
command like 'python script.py', script.py runs under Python 2.5, but if I
run just 'script.py', it runs under 2.6.  (I've also got 2.3 and 2.4
installed for testing purposes, when I want one of them I have to specify
the full path to the correct python.exe I want to use.)

Prior to getting that mysqldb exe for 2.6, if I tried to use MySQL with
Python2.6 I'd get an error "No module named MySQLdb", since there was no
MySQLdb installed under 2.6. The fact that in your case it's finding some
MySQLdb but then running into trouble with the Python version makes me think
you've put something on your system path that really shouldn't be there and
isn't necessary.  If you just put the base Python directory in the path,
that is the python that will be used when you prefix commands with "python",
and it will correctly search its tree (and only its tree) for extensions.

Karen

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



Re: Django CMS and Tiny_mce - ERROR 'module' object has no attribute 'JS_URL'

2009-02-18 Thread Phoebe Bright
My experience with setting up tinymce was that there were plenty of plenty
of opportunities for getting the paths wrong!  To avoid problems I put a
dynamic link (ln -s) into the django admin media folder so it could use the
defaults.  Hope that helps.

Phoebe.

2009/2/18 zegerman 

>
> Hello,
>
> Im tryin to get Tiny_mce running with Django CMS.
> I installed Django CMS and its running fine.
> After that I setup django_tinymce and followed these steps:
>
>
> http://django-tinymce.googlecode.com/svn/tags/release-1.5/docs/.build/html/installation.html#id1
>
> Thats my tiny_mce configuration in my settings.py
>
> TINYMCE_JS_URL = MEDIA_URL + 'js/tiny_mce/tiny_mce_src.js'
> TINYMCE_DEFAULT_CONFIG = {
>'theme': "simple",
> }
>
> When I am activating Tiny_mce in the settings.py via CMS_USE_TINYMCE =
> True
> I get following error:
>
> 'module' object has no attribute 'JS_URL'
> Request Method: GET
> Request URL:http://localhost:8000/admin/cms/page/3/
> Exception Type: AttributeError
> Exception Value:'module' object has no attribute 'JS_URL'
> Exception Location: D:\python\program\cms\admin.py in page_add_edit,
> line 126
>
>
> Does anyone know how what I am missing?
>
> Thx,
> zegerman
>
> >
>

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



Re: WYSIWYG Image upload challenge

2009-02-18 Thread phoebebright

That certainly looks like another option!  Thanks.

On Feb 18, 3:00 pm, Brandon Taylor  wrote:
> FWIW, I have been able to successfully integrate Django Admin 
> Uploadshttp://code.google.com/p/django-admin-uploads/with jQuery. I'm not
> certain as to how difficult this would be to port to YUI. There are a
> couple of JS issues that I've had to fix with this, but otherwise, it
> works very well.
>
> Regards,
> Brandon
>
> On Feb 18, 8:33 am, Almost George 
> wrote:
>
> > On Feb 18, 5:36 am, phoebebright  wrote:
>
> > > There is something different about the way django is handling to response 
> > > to php I think.
>
> > I use the YUI Rich Editor in admin, and have no problems. I know
> > debugging isn't as easy in IE as others, but do your best to find out
> > the exact response (mostly, response headers) that's being sent to the
> > browser. Also, could you clarify the above "response to PHP"
> > statement? Perhaps explaining the technical details of what's going on
> > would be of some help?
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: WYSIWYG Image upload challenge

2009-02-18 Thread phoebebright

The javascript makes a call to this view on submitting the form that
uploads the image.

def uploadimage(request):
try:
upload_full_path = settings.CONTENT_IMAGES

upload = request.FILES['image']
dest = open(os.path.join(upload_full_path,
upload.name), 'wb+')

for chunk in upload.chunks():
dest.write(chunk)

dest.close()

result='{status:"UPLOADED",image_url:"%s%s"}' %
(settings.CONTENT_IMAGES_URL, upload.name)

return_data = HttpResponse(result,mimetype='Content-
Type: text/
html')

except Exception, e:
return_data = HttpResponse("Error in uploading image")

return_data.flush()

return return_data

In Firefox/Mac it uploads the file and returns
"{status:"UPLOADED",image_url:"/site_media/content/
dalston_cranes.JPG"}" to javascript which tells javascript all went
well.  In IE/Safari the file is uploaded successfully but the above
text is downloaded as a file called something like 2s6OP6WO(2).part so
control doesn't return to the javascript.  Have applied a similar
program in PHP and it works fine. Tried different mime types and tried
to trace what is going on but without progress.

Phoebe


On Feb 18, 2:33 pm, Almost George 
wrote:
> On Feb 18, 5:36 am, phoebebright  wrote:
>
> > There is something different about the way django is handling to response 
> > to php I think.
>
> I use the YUI Rich Editor in admin, and have no problems. I know
> debugging isn't as easy in IE as others, but do your best to find out
> the exact response (mostly, response headers) that's being sent to the
> browser. Also, could you clarify the above "response to PHP"
> statement? Perhaps explaining the technical details of what's going on
> would be of some help?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Authentication with LDAP

2009-02-18 Thread João Olavo Baião de Vasconcelos
Hi all,

I'd like to login in Admin site and authenticate with LDAP. Is there a "most
used LDAP authentication backend"?
I found the backend ldapauth.py [1], that seems to be the one. Is this the
best solution?

I see that in [2] that are many patches. Is the file in [1] updated, or do I
have to apply the patches?

[1] http://code.djangoproject.com/attachment/ticket/2507/ldapauth.py
[2] http://code.djangoproject.com/ticket/2507

I tried to use this lib, but just after login into Admin, a blank page
appears. How can I know what went wrong? Any clue?

Also, I don't know if I filled appropriatly the required variables in
settings.py. There's an app at my company that authenticates using
Apache+LDAP. File /etc/httpd/conf.d/lic.conf has the following content:
"""

AuthType Basic
AuthName "Authentication at Active Directory"
AuthLDAPBindDN u...@company.com 
AuthLDAPBindPassword PASSWORD
AuthLDAPURL 
"ldap://LDAP_SERVER.
COMPANY 
.COM:389/OU=XXX,DC=
COMPANY 
,DC=COM?sAMAccountName?sub?(objectClass=*)
"
AuthLDAPAuthoritative On
Require ldap-group
CN=NAME,OU=Locals,OU=TI,OU=Groups,OU=XXX,DC=COMPANY
,DC=COM
Require valid-user

"""
How would I translate this configs to the ldapauth.py variables
(LDAP_SERVER_URI, LDAP_SEARCHDN, LDAP_SCOPE, LDAP_PREBINDDN, LDAP_PREBINDPW
etc)?

Thanks!!
-- 
João Olavo Baião de Vasconcelos
Bacharel em Ciência da Computação
Analista de Sistemas - Infraestrutura
joaoolavo.wordpress.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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Formsets issue

2009-02-18 Thread Thomas Hill
Brilliant, thank you! I'll take care of this later tonight.
Thanks again, Brian.

On Wed, Feb 18, 2009 at 10:40 AM, Brian Rosner  wrote:

>
>
> On Feb 18, 2009, at 11:33 AM, Thomas Hill wrote:
>
> > Ah, yes, indeed. Will definately do that, thanks. Regarding the
> > formset classes and form classes with their try/except lines,
> > however, does that look "right"?
>
> Ah ok. I must have completely overlooked that. You seem to be solving
> things in the wrong way. You check for existence in kwargs in
> ResourceRoleForm.__init__. However, a better way to approach this is
> to use the optional argument to pop which handles the "default" case
> (or when the key does not exist). Then when the values are needed test
> there for the correct value. So as a quick example:
>
> self.resource = kwargs.pop("resource", None)
>
> This enables you to remove the if in kwargs checks and the
> AttributeError catching. Also in ResourceRoleForm.__init__ you no
> longer have to check for existence similar to
> ResourceRoleForm.__init__ after this slight modification. Then you can
> simply check for None and deal with the fields attributes that way.
>
> Brian Rosner
> http://oebfare.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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



sql query for manytomany table

2009-02-18 Thread May

I need to get the institution name through an intermediary table (two
foreign keys) to display in a template.

The code is here:

http://dpaste.com/122204/

Thank you anyone,

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



Re: Formsets issue

2009-02-18 Thread Brian Rosner


On Feb 18, 2009, at 11:33 AM, Thomas Hill wrote:

> Ah, yes, indeed. Will definately do that, thanks. Regarding the  
> formset classes and form classes with their try/except lines,  
> however, does that look "right"?

Ah ok. I must have completely overlooked that. You seem to be solving  
things in the wrong way. You check for existence in kwargs in  
ResourceRoleForm.__init__. However, a better way to approach this is  
to use the optional argument to pop which handles the "default" case  
(or when the key does not exist). Then when the values are needed test  
there for the correct value. So as a quick example:

self.resource = kwargs.pop("resource", None)

This enables you to remove the if in kwargs checks and the  
AttributeError catching. Also in ResourceRoleForm.__init__ you no  
longer have to check for existence similar to  
ResourceRoleForm.__init__ after this slight modification. Then you can  
simply check for None and deal with the fields attributes that way.

Brian Rosner
http://oebfare.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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Simply adding GROUP BY to a QuerySet

2009-02-18 Thread Deniz Dogan

On 18 Feb, 19:33, Jacob Kaplan-Moss 
wrote:
> On Wed, Feb 18, 2009 at 12:24 PM, Deniz Dogan  
> wrote:
> > I'm sorry about that, I meant something like this:
>
> > { 2008-01-02 : [Bike 1, Bike 2],
> >  2008-02-09 : [Bike 7, Bike 4] }
>
> Well, you can't do this with the aggregation API because you can't do
> that is SQL. Remember: there's no such thing as a "list" in a
> relational database.

Oops, didn't really think about that!

> However, this is pretty easy to do just in Python using
> ``itertools.groupby`` 
> (seehttp://docs.python.org/library/itertools.html#itertools.groupby)::
>
>     >>> bikes = Bike.objects.all()
>     >>> for d, bl in itertools.groupby(bikes, lambda b: b.production_date):
>     ...    print d, list(bl)
>
>     2008-01-01 [, ]
>     2008-01-02 []
>     2008-01-03 []
>     2008-01-04 [, ]
>     2008-01-05 []
>
> The ORM's not a crutch; it doesn't bother with tasks you can easily do
> using the tools Python gives you. Mm, and in case you're keeping
> track, this is quite easy on the database; just a single query.
>
> Hope that's closer to what you had in mind,
>
> Jacob

Thanks a lot! I had just completed a little hack of my own for this,
but I'll make sure to check itertools out, because it seems pretty
cool.

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



Re: Extract values from form fields in templates

2009-02-18 Thread Karen Tracey
On Wed, Feb 18, 2009 at 8:52 AM, koranthala  wrote:

>
> Hi,
>I am unable to extract values from form fields inside templates.
>For example:
>  I have mutiple text fields in which one field says whether the
> second field is X or not and the second field containing the actual
> data. (These are initial values which I send from server to client)
> Now, in case it is of type X, I want to do something in the
> template.
>
> I tried to do it as follows:
> In template:
> {% ifequal forms.typename "username" %}
>   {{ form.name }} 
> {% else %}
>   {{ form.text }}
>
> Django Code:
> class frm(forms.Form):
>typename = forms.CharField(widget=forms.TextInput())
>text = forms.CharField(widget=forms.TextInput())
>name = forms.CharField(widget=forms.TextInput())
>img = forms.CharField(widget=forms.TextInput())
>
> I was unable to do it via forms, since I cannot extract the data.
> so I have to have another variable which sends the same data - which
> is against the DRY principle.
>
> Is it possible to extract the text data from the form widgets?
>

I don't have time to verify, but I believe:

{% ifequal forms.typename.data "username" %}

is what you want.

Karen

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



Re: Formsets issue

2009-02-18 Thread Thomas Hill
Ah, yes, indeed. Will definately do that, thanks. Regarding the formset
classes and form classes with their try/except lines, however, does that
look "right"?

On Wed, Feb 18, 2009 at 10:31 AM, Brian Rosner  wrote:

>
>
> On Feb 18, 2009, at 10:16 AM, Thomas Hill wrote:
>
> > #VIEW
> > @login_required
> > def manage_roles(request, resource_id):
> > resource = get_object_or_404(Lock, pk=resource_id)
> > if(request.method == "POST"):
> > formset = create_roles_formset(resource, request.POST)
> > if formset.is_valid():
> > for form in formset.forms:
> >   #Haven't actually hooked up the templates and success logic
> yet.
> > print form.cleaned_data['role']
> > print form.cleaned_data['user']
> > print '-'
> > else:
> > formset = create_roles_formset(resource)
> > dictToSend['rolesForm'] = formset
> > dictToSend['resource'] = resource
> > return render_to_response('locks/manage_roles.html', dictToSend,
> > context_instance=RequestContext(request))
>
> One thing I am noticing here is that if the formset fails to validate
> you are not putting the formset in the dictToSend to be rendered with
> the error messages. The best way to do this is just simply unindent
> the formset assignment to dictToSend in the non-POST case.
>
> Brian Rosner
> http://oebfare.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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Simply adding GROUP BY to a QuerySet

2009-02-18 Thread Jacob Kaplan-Moss

On Wed, Feb 18, 2009 at 12:24 PM, Deniz Dogan  wrote:
> I'm sorry about that, I meant something like this:
>
> { 2008-01-02 : [Bike 1, Bike 2],
>  2008-02-09 : [Bike 7, Bike 4] }

Well, you can't do this with the aggregation API because you can't do
that is SQL. Remember: there's no such thing as a "list" in a
relational database.

However, this is pretty easy to do just in Python using
``itertools.groupby`` (see
http://docs.python.org/library/itertools.html#itertools.groupby)::

>>> bikes = Bike.objects.all()
>>> for d, bl in itertools.groupby(bikes, lambda b: b.production_date):
...print d, list(bl)

2008-01-01 [, ]
2008-01-02 []
2008-01-03 []
2008-01-04 [, ]
2008-01-05 []

The ORM's not a crutch; it doesn't bother with tasks you can easily do
using the tools Python gives you. Mm, and in case you're keeping
track, this is quite easy on the database; just a single query.

Hope that's closer to what you had in mind,

Jacob

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



Re: Formsets issue

2009-02-18 Thread Brian Rosner


On Feb 18, 2009, at 10:16 AM, Thomas Hill wrote:

> #VIEW
> @login_required
> def manage_roles(request, resource_id):
> resource = get_object_or_404(Lock, pk=resource_id)
> if(request.method == "POST"):
> formset = create_roles_formset(resource, request.POST)
> if formset.is_valid():
> for form in formset.forms:
>   #Haven't actually hooked up the templates and success logic yet.
> print form.cleaned_data['role']
> print form.cleaned_data['user']
> print '-'
> else:
> formset = create_roles_formset(resource)
> dictToSend['rolesForm'] = formset
> dictToSend['resource'] = resource
> return render_to_response('locks/manage_roles.html', dictToSend,
> context_instance=RequestContext(request))

One thing I am noticing here is that if the formset fails to validate  
you are not putting the formset in the dictToSend to be rendered with  
the error messages. The best way to do this is just simply unindent  
the formset assignment to dictToSend in the non-POST case.

Brian Rosner
http://oebfare.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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Simply adding GROUP BY to a QuerySet

2009-02-18 Thread Deniz Dogan

> { 'production_date' : 2008-01-02,
>   'bikes' : [Bike 1, Bike 2],
>   'production_date' : 2008-02-09,
>   'bikes : [Bike 7, Bike 4]
>
> }

I'm sorry about that, I meant something like this:

{ 2008-01-02 : [Bike 1, Bike 2],
  2008-02-09 : [Bike 7, Bike 4] }

I guess I didn't quite think that through. :)

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



Re: OT: hide directory listing on server

2009-02-18 Thread PeteDK



On 18 Feb., 19:14, Ramiro Morales  wrote:
> On Wed, Feb 18, 2009 at 4:08 PM, PeteDK  wrote:
>
> > Hi. I know this is not really Django related, but this is one of the
> > best forums out there so i hope you can help me :-)
>
> > The thing is, i have a django website.
>
> > The media files are handled by the apache server instead of django,
> > which works great.
>
> > However when i go to .com/media/profile_pics/ i get a directory
> > listing of all the folders in this directory.
>
> > Can i disable this?? so its not possible to "browse" all the profile
> > pics, without knowing the exact path of a given file.
>
> You can disable Apache mod_autoindex
>
> http://httpd.apache.org/docs/2.2/mod/mod_autoindex.html
>
> for that directory.
>
> But the easiest way to avoid the generation of the directory content
> listing is simply creating an empty index.html file there.
>
> --
>  Ramiro Morales

Thanks. I found another solution that works :) created a .htaccess
file in the directory and put Options -Indexes in it :-)

So problem solved :)

good day to all djangoniacs out there :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Simply adding GROUP BY to a QuerySet

2009-02-18 Thread Deniz Dogan

On 18 Feb, 19:08, Jacob Kaplan-Moss 
wrote:
> On Wed, Feb 18, 2009 at 11:12 AM, Deniz Dogan  
> wrote:
> > Let's say I have a model called Bike with a DateField called
> > "production_date". Now I want to get all of the Bikes and group them
> > by their production date. How would I do this in Django? I can't seem
> > to figure it out.
>
> For this type of query, you need to ask yourself two things:
>
> The first question is easy: What kind of aggregate do I want? You want
> a count, so you'd use the ``Count()`` aggregate (i.e.
> ``django.db.models.Count``). That's simple; I'll bet you already
> figured that part out.
>
> The second part is more tricky: what is the set of fields I'm grouping
> over? By default, it's all the fields on the model, so a simple
> ``aggregate(Count(production_date))`` basically is the same as a
> ``COUNT(*)``, which you don't want::
>
>     >>> Bike.objects.aggregate(Count('production_date'))
>     {'production_date__count': 7}
>
> So you need to change the list of fields you're grouping over. You do
> this by using ``values()``; the important part of the docs to read 
> ishttp://docs.djangoproject.com/en/dev/topics/db/aggregation/#values;
> make sure to pay attention to the part about the order of
> ``annotate()`` and ``values()``.
>
> If you read that carefully, you'll see that to change the set of
> grouped fields you'll want to call ``values()`` before calling
> ``annotate()``::
>
>     >>> qs = Bike.objects.values('production_date') \
>     ...                  .annotate(count=Count('production_date')) \
>     >>> for r in qs:
>     ...    print "%(production_date)s: %(count)s bikes" % r
>     2008-01-01 2 bikes
>     2008-01-02 1 bikes
>     2008-01-03 1 bikes
>     2008-01-04 2 bikes
>     2008-01-05 1 bikes
>
> Hope that helps!
>
> Jacob

Thanks for your response, Jacob!

However, one of us has misunderstood something here, and I'm not sure
whether that's you or me. With your method I get the amount of bikes
that were made on each day, but what I want is to have is a structure
similar to this one:

{ 'production_date' : 2008-01-02,
  'bikes' : [Bike 1, Bike 2],
  'production_date' : 2008-02-09,
  'bikes : [Bike 7, Bike 4]
}

I.e. I want to be able to access the actual Bike objects, not how many
that were made on each day.

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



Re: OT: hide directory listing on server

2009-02-18 Thread Jirka Vejrazka

> However when i go to .com/media/profile_pics/ i get a directory
> listing of all the folders in this directory.
>
> Can i disable this?? so its not possible to "browse" all the profile
> pics, without knowing the exact path of a given file.


Hi Peter,

  read the Summary section of
http://httpd.apache.org/docs/2.2/mod/mod_autoindex.html

  You could also completely remove the mod_autoindex from Apache, but
make sure that it won't have any unwanted side effects on your
website.

  Cheers

   Jirka Vejrazka

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



Re: OT: hide directory listing on server

2009-02-18 Thread Ramiro Morales

On Wed, Feb 18, 2009 at 4:08 PM, PeteDK  wrote:
>
> Hi. I know this is not really Django related, but this is one of the
> best forums out there so i hope you can help me :-)
>
> The thing is, i have a django website.
>
> The media files are handled by the apache server instead of django,
> which works great.
>
> However when i go to .com/media/profile_pics/ i get a directory
> listing of all the folders in this directory.
>
> Can i disable this?? so its not possible to "browse" all the profile
> pics, without knowing the exact path of a given file.

You can disable Apache mod_autoindex

http://httpd.apache.org/docs/2.2/mod/mod_autoindex.html

for that directory.

But the easiest way to avoid the generation of the directory content
listing is simply creating an empty index.html file there.

-- 
 Ramiro Morales

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



Re: Python Versions and manage.py

2009-02-18 Thread Ramiro Morales

On Wed, Feb 18, 2009 at 3:50 PM, djandrow  wrote:
>
> I've had some success by specifying the path manually
>
> python "C:\ProgLangs\Python25\Lib\site-packages\django\conf
> \project_template\manage.py" sqlall

If you are using manage.py then the most common scenario
is the one when you already are at the directory containing it
so you don't need to specify its full path.

What you need to specify is the full path to the python
binary you want to use:

C:\python25\python manage.py help

or

C:\python26\python manage.py help

(obviously, you need to have Django installed
under both Python versions)

Yo can create your own  .BAT files containing just
that if you want to save some keystrokes.

Regards,

-- 
 Ramiro Morales

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



Re: Simply adding GROUP BY to a QuerySet

2009-02-18 Thread Jacob Kaplan-Moss

On Wed, Feb 18, 2009 at 11:12 AM, Deniz Dogan  wrote:
> Let's say I have a model called Bike with a DateField called
> "production_date". Now I want to get all of the Bikes and group them
> by their production date. How would I do this in Django? I can't seem
> to figure it out.

For this type of query, you need to ask yourself two things:

The first question is easy: What kind of aggregate do I want? You want
a count, so you'd use the ``Count()`` aggregate (i.e.
``django.db.models.Count``). That's simple; I'll bet you already
figured that part out.

The second part is more tricky: what is the set of fields I'm grouping
over? By default, it's all the fields on the model, so a simple
``aggregate(Count(production_date))`` basically is the same as a
``COUNT(*)``, which you don't want::

>>> Bike.objects.aggregate(Count('production_date'))
{'production_date__count': 7}

So you need to change the list of fields you're grouping over. You do
this by using ``values()``; the important part of the docs to read is
http://docs.djangoproject.com/en/dev/topics/db/aggregation/#values;
make sure to pay attention to the part about the order of
``annotate()`` and ``values()``.

If you read that carefully, you'll see that to change the set of
grouped fields you'll want to call ``values()`` before calling
``annotate()``::

>>> qs = Bike.objects.values('production_date') \
...  .annotate(count=Count('production_date')) \
>>> for r in qs:
...print "%(production_date)s: %(count)s bikes" % r
2008-01-01 2 bikes
2008-01-02 1 bikes
2008-01-03 1 bikes
2008-01-04 2 bikes
2008-01-05 1 bikes

Hope that helps!

Jacob

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



OT: hide directory listing on server

2009-02-18 Thread PeteDK

Hi. I know this is not really Django related, but this is one of the
best forums out there so i hope you can help me :-)

The thing is, i have a django website.

The media files are handled by the apache server instead of django,
which works great.

However when i go to .com/media/profile_pics/ i get a directory
listing of all the folders in this directory.

Can i disable this?? so its not possible to "browse" all the profile
pics, without knowing the exact path of a given file.

I hope you get my meaning.

kind regards.

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



Formsets issue

2009-02-18 Thread Thomas Hill

Hey all,

Been trying to display multiple form rows for a project lately, and I  
just wanted to confirm that I'm doing this right. I found a solution  
on http://www.pointy-stick.com/blog/2009/01/23/advanced-formset-usage-django/ 
, and I took what I needed from it (my code below), but I found that  
whenever I passed in my request.POST data it was getting overwritten  
by the users and resource data. So then I  in checks for data and try  
statements to make sure everything was going where it should.  
Everything works now, but I'm not sure if I'm leaving some sort of  
important edge case unattended too, or what. So my question is: is the  
way that I'm handling errors here the correct way of doing multiple  
form rows? And if not, why not? Surprise, I'm new to both Python and  
Django, which is why I want to make sure I'm doing this both "django"- 
ly and "pythonic"-ly.

#VIEW
@login_required
def manage_roles(request, resource_id):
 resource = get_object_or_404(Lock, pk=resource_id)
 if(request.method == "POST"):
 formset = create_roles_formset(resource, request.POST)
 if formset.is_valid():
 for form in formset.forms:
#Haven't actually hooked up the templates and success logic yet.
 print form.cleaned_data['role']
 print form.cleaned_data['user']
 print '-'
 else:
 formset = create_roles_formset(resource)
 dictToSend['rolesForm'] = formset
 dictToSend['resource'] = resource
 return render_to_response('locks/manage_roles.html', dictToSend,  
context_instance=RequestContext(request))

def create_roles_formset(resource, data=None):
 users = User.objects.filter(lockmembership__lock=resource)
 if not users:
 raise Http404('Invalid user id(s)')
 ResourceFormset = formsets.formset_factory(ResourceRoleForm,  
ResourceRolesFormset)
 if not data:
 return ResourceFormset(data, users=users, resource=resource)
 else:
 return ResourceFormset(data)

#FORMS
class ResourceRolesFormset(formsets.BaseFormSet):
 def __init__(self, *args, **kwargs):
 if 'resource' in kwargs and 'users' in kwargs:
 self.resource = kwargs.pop("resource")
 self.users = list(kwargs.pop("users"))
 self.extra = len(self.users)
 super(ResourceRolesFormset, self).__init__(*args, **kwargs)

 def _construct_form(self, i, **kwargs):
 try:
 kwargs["user"] = self.users[i]
 kwargs["resource"] = self.resource
 except AttributeError:
 pass
 return super(ResourceRolesFormset, self)._construct_form(i,  
**kwargs)

class ResourceRoleForm(forms.Form):
 role = forms.ChoiceField(widget=forms.Select,  
choices=LockMembership.LOCK_ROLES)
 user = forms.IntegerField(widget=forms.HiddenInput)

 def __init__(self, *args, **kwargs):
 print kwargs
 try:
 resource = kwargs.pop("resource")
 user = kwargs.pop("user")
 except KeyError:
 pass
 super(ResourceRoleForm, self).__init__(*args, **kwargs)
 try:
 lm = LockMembership.objects.filter(lock=resource,  
user=user)[0]
 self.fields['role'].initial = lm.role
 self.fields['role'].label = user.username
 self.fields['user'].initial = user.id
 except KeyError:
 pass
 except UnboundLocalError:
 pass


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



Re: Python Versions and manage.py

2009-02-18 Thread djandrow

I've had some success by specifying the path manually

python "C:\ProgLangs\Python25\Lib\site-packages\django\conf
\project_template\manage.py" sqlall

I'm still getting an error but i'm 90% sure its unrelated.

Thanks,

Andrew

On Feb 18, 4:00 pm, Alex Gaynor  wrote:
> On Wed, Feb 18, 2009 at 10:44 AM, djandrow wrote:
>
>
>
>
>
> > Hello,
>
> > I have python 2.5 and 2.6 installed on my computer and when i try to
> > run manage.py sqlall I get an error:
>
> > raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> > django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> > module: Module use of python25.dll conflicts with this version of
> > Python.
>
> > This is because it is using python 2.6 and the mysql backend is for
> > 2.5, there isn't an exe backend for windows.
>
> > I'm using the command line and want to know how i can change the
> > python versions. I have my system path set up for 2.5 so I don't know
> > what effect that has.
>
> > Would it be possible to just list the path in the command line when i
> > run manage.py? since other commands don't have this problem
>
> > Andrew
>
> I'm not super familiar with how windows handles it's path, but if you do
> ./manage.py on unix it will use your default python installed, however you
> can also do python manage.py or python2.5 manage.py or python2.6 manage.py
> to specify which version to use.  Hopefully that helps somewhat.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Getting Django to generate a report automatically on a assigned date?

2009-02-18 Thread Stefan Tunsch

Create a scheduled task /cron job  that does what you want.

This will get you started:

from django.core.management import setup_environ
import settings # If your script file is in the same directory as the 
settings.py file
setup_environ(settings)

After that, import your models as usual and use the django ORM as usual.

Regards, Stefan


Alfonso escribió:
> Hi,
>
> I have a client who wants to generate an invoice statment
> automatically on the first of every month.  I'm trying to work out how
> I might do that in Django.  I have a simple statement model and a
> simple invoice model and all I want to do is on 1st of calendar Month
> update the statement model with invoices that haven't been paid.
>
> I'm not sure how to make that 'fire' correctly without an admin doing
> the legwork of adding a statement?
>
> 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Struggling with annotations / aggregations

2009-02-18 Thread Stefan Tunsch

Hi there!

I'm trying to see what's the best approach in my scenario.
The problem is how to make a list display different sums and 
calculations based on it's child objects.


My scenario could be the following:
Two models: Project and Task
One Project has many Task.
Task has a boolean "open" field (open,closed) and a due_date.

I want to retrieve a list of projects that includes the total number of 
tasks (that one is easy ;), number of open tasks and number of tasks 
with due_date today.


First of all, I understand that this would not be possible with the new 
Aggregation / Annotation functionality, right? (Maybe I'm mistaken)
I cannot do something like:
projects = Project.objects.all(),annotate(total=Count('task'), 
open_tasks=Count('task__open=True'), 
due_today=Count('task__due_date=datetime.today()')

Second, if not, what would be the best way to approach this scenario?

My first idea is to create functions on my Project model that gives me 
this info. (This doesn't scale very well ;)
The next thing would be to create a Custom Manager that adds this info 
via some custom SQL. (I really don't feel comfortable with this approach 
since I seem to be completely overriding django's ORM)
The last option would be to add some extra SQL to my QuerySet through 
the extra parameter.



Any insight would be appreciated.


Regards, Stefan

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



Re: Extract values from form fields in templates

2009-02-18 Thread Kevin Audleman

Passing both the form and the object is the solution I use. It may not
be completely DRY, but I can't see how it's bad. You need access to
the data in an object so you pass the object. Much more sensible than
trying to extract those values from a more complicated data
structure.

Kevin

On Feb 18, 5:52 am, koranthala  wrote:
> Hi,
>     I am unable to extract values from form fields inside templates.
>     For example:
>       I have mutiple text fields in which one field says whether the
> second field is X or not and the second field containing the actual
> data. (These are initial values which I send from server to client)
>      Now, in case it is of type X, I want to do something in the
> template.
>
> I tried to do it as follows:
> In template:
> {% ifequal forms.typename "username" %}
>    {{ form.name }} 
> {% else %}
>    {{ form.text }}
>
> Django Code:
> class frm(forms.Form):
>     typename = forms.CharField(widget=forms.TextInput())
>     text = forms.CharField(widget=forms.TextInput())
>     name = forms.CharField(widget=forms.TextInput())
>     img = forms.CharField(widget=forms.TextInput())
>
> I was unable to do it via forms, since I cannot extract the data.
> so I have to have another variable which sends the same data - which
> is against the DRY principle.
>
> Is it possible to extract the text data from the form widgets?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Simply adding GROUP BY to a QuerySet

2009-02-18 Thread Deniz Dogan

Hi

I'm having trouble understanding the new aggregation support in Django
1.1, and here is what I want to do:

Let's say I have a model called Bike with a DateField called
"production_date". Now I want to get all of the Bikes and group them
by their production date. How would I do this in Django? I can't seem
to figure it out.

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



Re: Getting Django to generate a report automatically on a assigned date?

2009-02-18 Thread martín arrieta
Hello.. it is very easy to make one standalone script with django..

Check this post:
http://www.b-list.org/weblog/2007/sep/22/standalone-django-scripts/

Martin.


2009/2/18 GRoby 

>
> Alfonso,
>
> One way would be to create a View that performs all of the Report
> Generating Tasks.  You could then use cron (or another task scheduler)
> to run a command line browser that runs that view (using wget for
> example).
>
> So basically you would have a @monthly entry in cron that runs
> something like:  wget http://localhost/ProjectName/GenerateMonthlyReport/
>
> Then put some checks in the View to ensure it only run once a month.
>
> Greg
>
>
> On Feb 18, 10:36 am, Alfonso  wrote:
> > Hi,
> >
> > I have a client who wants to generate an invoice statment
> > automatically on the first of every month.  I'm trying to work out how
> > I might do that in Django.  I have a simple statement model and a
> > simple invoice model and all I want to do is on 1st of calendar Month
> > update the statement model with invoices that haven't been paid.
> >
> > I'm not sure how to make that 'fire' correctly without an admin doing
> > the legwork of adding a statement?
> >
> > 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django CMS and Tiny_mce - ERROR 'module' object has no attribute 'JS_URL'

2009-02-18 Thread zegerman

Hello,

Im tryin to get Tiny_mce running with Django CMS.
I installed Django CMS and its running fine.
After that I setup django_tinymce and followed these steps:

http://django-tinymce.googlecode.com/svn/tags/release-1.5/docs/.build/html/installation.html#id1

Thats my tiny_mce configuration in my settings.py

TINYMCE_JS_URL = MEDIA_URL + 'js/tiny_mce/tiny_mce_src.js'
TINYMCE_DEFAULT_CONFIG = {
'theme': "simple",
}

When I am activating Tiny_mce in the settings.py via CMS_USE_TINYMCE =
True
I get following error:

'module' object has no attribute 'JS_URL'
Request Method: GET
Request URL:http://localhost:8000/admin/cms/page/3/
Exception Type: AttributeError
Exception Value:'module' object has no attribute 'JS_URL'
Exception Location: D:\python\program\cms\admin.py in page_add_edit,
line 126


Does anyone know how what I am missing?

Thx,
zegerman

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



Re: Getting Django to generate a report automatically on a assigned date?

2009-02-18 Thread GRoby

Alfonso,

One way would be to create a View that performs all of the Report
Generating Tasks.  You could then use cron (or another task scheduler)
to run a command line browser that runs that view (using wget for
example).

So basically you would have a @monthly entry in cron that runs
something like:  wget http://localhost/ProjectName/GenerateMonthlyReport/

Then put some checks in the View to ensure it only run once a month.

Greg


On Feb 18, 10:36 am, Alfonso  wrote:
> Hi,
>
> I have a client who wants to generate an invoice statment
> automatically on the first of every month.  I'm trying to work out how
> I might do that in Django.  I have a simple statement model and a
> simple invoice model and all I want to do is on 1st of calendar Month
> update the statement model with invoices that haven't been paid.
>
> I'm not sure how to make that 'fire' correctly without an admin doing
> the legwork of adding a statement?
>
> 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Python Versions and manage.py

2009-02-18 Thread Alex Gaynor
On Wed, Feb 18, 2009 at 10:44 AM, djandrow wrote:

>
> Hello,
>
> I have python 2.5 and 2.6 installed on my computer and when i try to
> run manage.py sqlall I get an error:
>
> raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> module: Module use of python25.dll conflicts with this version of
> Python.
>
> This is because it is using python 2.6 and the mysql backend is for
> 2.5, there isn't an exe backend for windows.
>
> I'm using the command line and want to know how i can change the
> python versions. I have my system path set up for 2.5 so I don't know
> what effect that has.
>
> Would it be possible to just list the path in the command line when i
> run manage.py? since other commands don't have this problem
>
> Andrew
> >
>
I'm not super familiar with how windows handles it's path, but if you do
./manage.py on unix it will use your default python installed, however you
can also do python manage.py or python2.5 manage.py or python2.6 manage.py
to specify which version to use.  Hopefully that helps somewhat.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

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



Re: Getting Django to generate a report automatically on a assigned date?

2009-02-18 Thread Alex Gaynor
On Wed, Feb 18, 2009 at 10:36 AM, Alfonso  wrote:

>
> Hi,
>
> I have a client who wants to generate an invoice statment
> automatically on the first of every month.  I'm trying to work out how
> I might do that in Django.  I have a simple statement model and a
> simple invoice model and all I want to do is on 1st of calendar Month
> update the statement model with invoices that haven't been paid.
>
> I'm not sure how to make that 'fire' correctly without an admin doing
> the legwork of adding a statement?
>
> Thanks
> >
>
You want to use a cron job, probably coupled with a management script to
actually generate the report itself.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

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



Python Versions and manage.py

2009-02-18 Thread djandrow

Hello,

I have python 2.5 and 2.6 installed on my computer and when i try to
run manage.py sqlall I get an error:

raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
module: Module use of python25.dll conflicts with this version of
Python.

This is because it is using python 2.6 and the mysql backend is for
2.5, there isn't an exe backend for windows.

I'm using the command line and want to know how i can change the
python versions. I have my system path set up for 2.5 so I don't know
what effect that has.

Would it be possible to just list the path in the command line when i
run manage.py? since other commands don't have this problem

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



Re: Dhango help

2009-02-18 Thread djandrow

The documents have a first steps section and other sections may
inspire you as well

 http://docs.djangoproject.com/en/dev/

hope that helps

Andrew

On Feb 18, 3:19 pm, "s.sudharsan siva" 
wrote:
> Hii am new to Django we are planning to show a demo on Django on FOss
> conf09.. can any one help with how to start with Django and what to demo
> --
> With Regards
> S.Sudharsan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Getting Django to generate a report automatically on a assigned date?

2009-02-18 Thread Alfonso

Hi,

I have a client who wants to generate an invoice statment
automatically on the first of every month.  I'm trying to work out how
I might do that in Django.  I have a simple statement model and a
simple invoice model and all I want to do is on 1st of calendar Month
update the statement model with invoices that haven't been paid.

I'm not sure how to make that 'fire' correctly without an admin doing
the legwork of adding a statement?

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Dhango help

2009-02-18 Thread s.sudharsan siva
Hii am new to Django we are planning to show a demo on Django on FOss
conf09.. can any one help with how to start with Django and what to demo
-- 
With Regards
S.Sudharsan

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



Add value to request header?

2009-02-18 Thread Brandon Taylor

Hi everyone,

I know how to modify a response header value, but not a request header
value. I need to integrate with an external system that is injecting a
value in the request header that I need to check for.

Is it possible to mock this behavior in Django? I'm not very familiar
with how these values get added to the request/response from Apache in
the first place.

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



Re: WYSIWYG Image upload challenge

2009-02-18 Thread Brandon Taylor

FWIW, I have been able to successfully integrate Django Admin Uploads
http://code.google.com/p/django-admin-uploads/ with jQuery. I'm not
certain as to how difficult this would be to port to YUI. There are a
couple of JS issues that I've had to fix with this, but otherwise, it
works very well.

Regards,
Brandon

On Feb 18, 8:33 am, Almost George 
wrote:
> On Feb 18, 5:36 am, phoebebright  wrote:
>
> > There is something different about the way django is handling to response 
> > to php I think.
>
> I use the YUI Rich Editor in admin, and have no problems. I know
> debugging isn't as easy in IE as others, but do your best to find out
> the exact response (mostly, response headers) that's being sent to the
> browser. Also, could you clarify the above "response to PHP"
> statement? Perhaps explaining the technical details of what's going on
> would be of some help?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django 0.97 and image thumbnails

2009-02-18 Thread Alex Gaynor
On Wed, Feb 18, 2009 at 9:20 AM, Bobby Roberts  wrote:

>
> hi all.
>
> I've got a model with the following line:
>
>Pic1 = models.ImageField(upload_to='/auctionimages',blank=True)
>
>
> is it possible to easily create a thumbnail in django 0.97 on
> python2.5.  If not, can someone show me how?
> >
> First of all there is no such thing as Django .97, that probably means some
version of Django between .96 and 1.0 with which various reusable apps may
or may not work.  That being said take a look at
http://code.google.com/p/sorl-thumbnail/ and if that doesn't work you may
need to roll something yourself using PIL.

Alex


-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

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



Re: WYSIWYG Image upload challenge

2009-02-18 Thread Almost George



On Feb 18, 5:36 am, phoebebright  wrote:
> There is something different about the way django is handling to response to 
> php I think.


I use the YUI Rich Editor in admin, and have no problems. I know
debugging isn't as easy in IE as others, but do your best to find out
the exact response (mostly, response headers) that's being sent to the
browser. Also, could you clarify the above "response to PHP"
statement? Perhaps explaining the technical details of what's going on
would be of some help?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Was there a recent change in the intial_data-loading code?

2009-02-18 Thread Jim

I apologize; someone straightened me out in a private email that there
was an error in my setup.

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



Re: Was there a recent change in the intial_data-loading code?

2009-02-18 Thread Karen Tracey
On Wed, Feb 18, 2009 at 9:13 AM, Jim  wrote:
[snip]

>
> 
> Snip of output:
>
>  :
> Running post-sync handlers for application pkgs
> Running post-sync handlers for application tinymce
> Running post-sync handlers for application mptt
> Loading 'initial_data' fixtures...
> Checking '/usr/local/lib/python2.6/site-packages/django/contrib/auth/
> fixtures' for fixtures...
> Trying '/usr/local/lib/python2.6/site-packages/django/contrib/auth/
> fixtures' for initial_data.xml fixture 'initial_data'...
> No xml fixture 'initial_data' in '/usr/local/lib/python2.6/site-
> packages/django/contrib/auth/fixtures'.
> Trying '/usr/local/lib/python2.6/site-packages/django/contrib/auth/
> fixtures' for initial_data.xml.gz fixture 'initial_data'...
> No xml fixture 'initial_data' in '/usr/local/lib/python2.6/site-
> packages/django/contrib/auth/fixtures'.
> Trying '/usr/local/lib/python2.6/site-packages/django/contrib/auth/
> fixtures' for initial_data.xml.zip fixture 'initial_data'...
>  :


This is normal output for verbosity=2 (I think it is more verbose since
support for compressed fixtures was added but I haven't checked in detail).
It's printing out all the places it is looking for initial_data, but there
is no error if it doesn't exist, it just moves on. (There was a time when
the first failure to find an initial data file caused the search to end, but
r9646 fixed that a couple of months ago).

Are you actually encountering an error with having your own initial data
loaded?

Karen

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



  1   2   >