Re: getting set up on osx for first app!

2008-02-08 Thread js

Hi again,

OS X has pre-installed apache and Python, but you still have to
install Django yourself.
Get the latest version from http://www.djangoproject.com/download/
and try installing.

Thanks

On Feb 9, 2008 3:21 PM, newbiedoobiedoo <[EMAIL PROTECTED]> wrote:
>
> howdy,
>
> i have osx 10.4.10, and see that i do have python.  but "import
> django" failed!
>
> i'm slightly unsure how i proceed from here, although I have spent
> some
> hours reading various things about installation.  Should I install
> apache?
> I'm planning to build a simple web-db app.
>
> Many thanks...
>
>
> >
>

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



Re: setting up apache on OSX

2008-02-08 Thread js

Hi,

If you're not planning on setting up productioin environment,
but just for testing/developing, you don't have to use apache.
Django development server is good enough your porpose.

If you want to learn how to set up secure apache,
you might want to check http://httpd.apache.org/userslist.html

On Feb 9, 2008 3:43 PM, newbiedoobiedoo <[EMAIL PROTECTED]> wrote:
>
> I started working to install apache on OSX, so I can use django, and I
> realized I'm in over my head.  I don't want to make stupid errors in
> file sharing
> and firewall settings, leaving my computer open to attack.
>
> Is it safe to do this?
> Is there anyone out there who would be willing to help me go through
> the mundane
> but treacherous part of setting up the system preferences and etc.  I
> am a programmer, but a sys admin, I'm not.
>
> I'm not sure what I can offer in return...   If you live in Berkeley,
> I can offer
> to trade coffee/dinner/housework?   I could offer some of the DVDs I
> made on
> do-it-yourself healthcare...
>
> Thanks!
>
> >
>

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



setting up apache on OSX

2008-02-08 Thread newbiedoobiedoo

I started working to install apache on OSX, so I can use django, and I
realized I'm in over my head.  I don't want to make stupid errors in
file sharing
and firewall settings, leaving my computer open to attack.

Is it safe to do this?
Is there anyone out there who would be willing to help me go through
the mundane
but treacherous part of setting up the system preferences and etc.  I
am a programmer, but a sys admin, I'm not.

I'm not sure what I can offer in return...   If you live in Berkeley,
I can offer
to trade coffee/dinner/housework?   I could offer some of the DVDs I
made on
do-it-yourself healthcare...

Thanks!

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



Re: Transient ViewDoesNotExist errors

2008-02-08 Thread Richard Jones

On Feb 8, 10:07 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Feb 8, 8:43 am, Richard Jones <[EMAIL PROTECTED]> wrote:
> > I have noticed that apache's error log has tons of these entries at
> > random (avg. 5 minutes) intervals:
>
> > [Thu Feb 07 14:08:11 2008] [notice]mod_python: (Re)importing module
> > 'django.cor
> > e.handlers.modpython'
>
> > The dates of these log entries don't exactly match the dates of the
> > error emails though.
>
> You can ignore these messages from mod_python. You will see them every
> time Apache starts up a new child process for handling requests. It is
> just telling you that it is importing handler for mod_python for first
> time for that process. If you were using mod_python 3.3.1, instead of
> an old obsolete version of mod_python, you likely wouldn't even see
> them

A nicer way to phrase that would be "you should consider upgrading..."

I compiled 3.3.1 and installed it over the top of the CentOS installed
one and that error did go away, thanks.

I'm still getting the transient errors mentioned in my OP though.


  Richard

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



GeoDjango developers

2008-02-08 Thread [EMAIL PROTECTED]

Are there many/any coders available for hire with extensive GeoDjango
experience? I have a rather large project in mind that for which it
looks to be a rather perfect.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



needs some template logic or model logic

2008-02-08 Thread Milan Andric

Hi I'm working on extending a forum app to allow for email
subscriptions.
http://code.google.com/p/django-forum/issues/list

I'm running into one fairly simple issue and thought someone might be
able to enlighten me.

Here's part of my model: http://dpaste.com/34401/

And here's the template logic: http://dpaste.com/34400/

{% for t in threads %}

{{ t.forum.title }}
{% if t.sticky %}Sticky {% endif %}{{ t.title }}{% if t.closed %}
(Closed){% endif %}


{% endfor %}

user.subscription_set.all isn't specific enough because I actually
need to query on user AND thread.  So does is there no easy way around
a template tag?

Thanks for you suggestions,

Milan

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



Re: Getting development environment configured

2008-02-08 Thread Brandon Taylor

Hi,

That doesn't seem to want to work for me. Since I've been able to get
mod_python to run my pages, I'm halfway there. Now I just can't get
images to show up in my pages.

My website directory structure is:

/website1
/public
/images

/__init__.py, urls.py, views.py, etc

If I'm specifying multiple  in Apache, how can I tell
mod_python not to serve images, etc, for that particular location?

Specifically, let's say I have




...



...




What's the correct way to turn mod_python off for static content if
I'm specifying more than 1 location? But, more importantly, it seems,
is telling Apache what to consider the Website root, which in the case
of my folder structure, is "public".

Does that make sense? I don't want to have to hard code the path to
each image in a site, that's just not going to work at all.

Thanks,
Brandon

On Feb 8, 2:31 pm, Narso <[EMAIL PROTECTED]> wrote:
> Hi. I just (for development server) use the command lines option:
>
> python manage.py runserver --adminmedia=/home/user ... /mysite/public
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Free21.info - Free Anonymous Proxy to unblock filtered websites

2008-02-08 Thread CHC

http://www.free21.info
A new Proxy site - Using it you can easily bypass internet block at
school, office and unblock Myspace site everyday.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django Connections

2008-02-08 Thread Dave Fowler

I believe I'm having issues with django connections.  I'm using EC2
with a remote mysql database and make about 6 queries per page.  There
is some latency due to the distance of the remote server.  Each query
takes about .038s to complete.

Pages take about 2 seconds to load however.  The person running my
database says that django could be dropping my connection, which means
each query actually takes longer than it reports?  Has anyone run into
this?  How could I verify that this is true or false?

Additionally, I wrote a custom query manager for one of my queries.
It opens its own django.db.connection.cursor() each time it is
called.  Is this bad practice?  Would this be using up my connection
queue?

Thanks

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



Problems validating data

2008-02-08 Thread Maykel Moya

I'm using Django trunk r7047. This is my code

prj/validators.py
===
from django.core.validators import ValidationError

class StringLengthIs(object):
def __init__(self, length, error_message=''):
self.length = length
if not error_message:
self.error_message = _("This string length must be %s.") %
length
else:
self.error_message = error_message

def __call__(self, field_data, all_data):
val = len(field_data)

if val != self.length:
raise ValidationError(self.error_message)

prj/app/models.py
=
from prj.validators import StringLengthIs

class Foo(models.Model):
name = models.CharField(validator_list=[StringLengthIs(6)])

prj/app/forms.py

from prj.app.models import Foo

class FooForm(forms.ModelForm):
def clean_name(self):
# This isn't run
pass
def clean(self):
# This is run
pass
class Meta:
model = Foo

--
when I save() a Foo instance StringLengthIs(6) is not run. Besides,
when I call is_valid() to a FooForm instance clean() is called but
clean_name() isn't called.

What I'm doing wrong?

Regards,
maykel

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



Can't seem to get Q objects to work as I'd like...

2008-02-08 Thread Oliver Beattie

Hi People,

I'm trying to write a query using Q objects but I'm getting incredibly
frustrated with them. I'm afraid I don't know SQL so I wouldn't know
how to write the queries by hand! The query (using Q objects) I am
trying to construct is:-

media = media.filter(
Q(owner=requester) |
Q(user_permission__granted_to=requester,
user_permission__privilege__icontains=privilege) |
Q(group_permission__granted_to__members=requester,
group_permission__privilege__icontains=privilege) |
Q(tags__user_permission__granted_to=requester,
tags__user_permission__privilege__icontains=privilege) |
Q(tags__group_permission__granted_to__members=requester,
tags__group_permission__privilege__icontains=privilege)
)

I think most people would be able to figure out what I wanted there!
The SQL this generates can be seen at http://dpaste.com/34377/ if this
helps anyone. I'm running out of ideas of what to try next.

Can anyone help me? Is there another way I could go about this?

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



Re: using mod_python to host several django apps on the same vhost?

2008-02-08 Thread Aaron Fay





Hey Charles, 

I believe you will find that answer specifically here:
http://www.djangobook.com/en/1.0/chapter20/
"If you need to put two Django installations within the
same VirtualHost,
you’ll need to take a special precaution to ensure mod_python’s code
cache
doesn’t mess things up. Use the PythonInterpreter directive to give
different 
directives separate interpreters..."


Cheers,
Aaron

[EMAIL PROTECTED] wrote:

  
  
  using mod_python to host several django apps on the same vhost?

  Hi,
  
  I'd like to host several django
applications at http://foo.bar.com/x,
  http://foo.bar.com/y,
etc. Currently I'm managing them all in the same vhost, using Apache
locations to direct each URL to a different Django project. However,
this technique requires me to rewrite my urls.py to accept ^x/admin
instead of ^admin (which is bad and breaks portability). Is there a way
that I can use mod_python to proxy http://foo.bar.com/x/admin/ to
Django as /admin/ while still remembering which Django project it's
running?
  Thanks,
  
  charles
  
  
  


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






Re: Getting development environment configured

2008-02-08 Thread Narso

Hi. I just (for development server) use the command lines option:

python manage.py runserver --adminmedia=/home/user ... /mysite/public

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



Re: Getting development environment configured

2008-02-08 Thread Brandon Taylor

I'll just be glad to actually see my friggin' pages render, much less
actually getting it to a production environment. There's certainly not
the "instant gratification" with Django that comes with Rails, but I'm
all about using the right technology to fit the client's needs.

The main reasons I'm interested in Django are the built-in admin (dear
lord, if I never have to build another admin, it'll be too soon) and
hopefully a small code base. So much of my freelance work could be
made child's play thanks to the Django admin. Rails makes it very easy
to do RESTful controllers and shortens the dev cycle quite a bit, but,
I end up writing the same code, again and again.

Cheers,
b

On Feb 8, 1:56 pm, Adam Stein <[EMAIL PROTECTED]> wrote:
> Glad to hear my information was useful.  Now all I have to do is finish
> figuring out how to use WAF to deploy my Django project and I'm all
> set :-{}
>
>
>
> On Fri, 2008-02-08 at 11:51 -0800, Brandon Taylor wrote:
> > FINALLY, it works.
>
> > I guess the entire problem was that I had specified the website
> > directory itself instead of the PARENT of the website directory in the
> > PythonPath. Now I just need to tell Apache to not process anything
> > else with mod_python and I should be good to go.
>
> > Thanks Adam,
> > b
>
> > On Feb 8, 1:08 pm, Adam Stein <[EMAIL PROTECTED]> wrote:
> > > Just started with Django myself.  Went thru 3 different tutorials.
> > > Hopefully, what I'm mentioning below hasn't already been covered.
>
> > > On Fri, 2008-02-08 at 10:34 -0800, Brandon Taylor wrote:
> > > > So, chin up, moving on. Here is my website's directory structure:
>
> > > > /mysite
> > > >   /public
> > > > /images
> > > > /css
> > > > /javascripts
>
> > > >   /templates
> > > > public.html
> > > > home_page.html
>
> > > > views.py
> > > > settings.py
> > > > urls.py
> > > > __init__.py
> > > >From your directory structure, it looks like views.py, settings.py,
>
> > > urls.py, and __init__.py are NOT in 'mysite' but at the same level.  If
> > > that's true, that's one reason why mod_python can't find
> > > "mysite.settings".
>
> > > I run Apache using virtual servers, so my ... stuff
> > > is associated with a specific virtual server (in httpd-vhosts.conf).  If
> > > you don't, you can put it into the top-level httpd.conf file.  Mine
> > > looks like this:
>
> > > 
> > > SetHandler python-program
> > > PythonHandler django.core.handlers.modpython
> > > PythonInterpreter wise
> > > PythonPath "['/home/adam/Src/WISE-2.0'] + sys.path"
> > > SetEnv DJANGO_SETTINGS_MODULE WebSite.settings
> > > SetEnv PYTHON_EGG_CACHE /tmp/.python-eggs
> > > PythonDebug On
> > > 
>
> > > I have everything athttp://my-server/wise2/andunder handled by
> > > mod_python.  The two main things here are PythonPath and
> > > DJANGO_SETTINGS_MODULE.
>
> > > Given your structure above, settings.py (along with views.py, urls.py,
> > > and __init__.py) should be in the 'mysite' directory.  Then PythonPath
> > > would be set to point to the directory 'mysite' is in:
>
> > > PythonPath "['/my/dir'] + sys.path"
>
> > > In this case, your 'mysite' directory can be found at "/my/dir/mysite".
> > > Then DJANGO_SETTINGS_MODULE would point to the settings file via the
> > > Python import syntax:
>
> > > SetEnv DJANGO_SETTINGS_MODULE mysite.settings
>
> > > mod_python would find the settings.py file because it would be in the
> > > 'mysite' directory.
>
> > > > When I start up the dev server using manage.py runserver, my
> > > > home_page.html template will render, but no images, no css, etc.
>
> > > > How can I:
>
> > > > 1. Tell the development server what the root of the website is.
> > > > 2. Where my images, css and javascript files are.
>
> > > > I have put: (r'^public/../(?P.*)$', 'django.views.static.serve',
> > > > {'document_root': '/public/../images'}),
>
> > > > in my URLconf, but, it's still not happy.
>
> > > I set up to handle static content if running in DEBUG mode (i.e. theff
> > > # Set up to server static files if running within the development
> > > # environment
> > > if settings.DEBUG == True:
> > > urlpatterns += patterns('django.views.static',
> > > (r'^(?P.*)$', "serve", {"document_root":
> > > "/project/www/htdocs/WISE
> > > ",}),
> > > )
>
> > > This goes last in urls.py and will pick up anything not matched by a
> > > real Django pattern match (i.e. everything that's NOT a Django page).
> > > So if I have a URL like ", the
> > > dev server will actually serve (given my example)
> > > "/project/www/htdocs/WISE/img/icons/UnknownPerson.jpg" from the local
> > > filesystem.
> > > --
> > > Adam Stein @ Xerox Corporation   Email: [EMAIL PROTECTED]
>
> > > Disclaimer: All views expressed
> > > here have been proved to be my own.  [http://www.csh.rit.edu/~adam/]
>
> --
> Adam Stein @ Xerox Corporation   Email: [EMAIL PROTECTED]
>
> Disclaimer: All views expressed
> 

Re: Deploying Django with Apache

2008-02-08 Thread Jeff Anderson

darien08 wrote:

My problem is that I'm running my app like this: http://localhost:8000/mysite
and I'm getting an error that the 8000 port is not available.
Your question isn't clear. Are you using apache on port 8000? are you 
using the development server? what is it that gives you the error 
message? What is running that is already listening on port 8000?


Jeff Anderson



signature.asc
Description: OpenPGP digital signature


auth/add/user error

2008-02-08 Thread Narso

Hi. Forgive my poor English

I think there is an error in the "admin/auth/user/add_form.html"
template, because it uses a form_url variable that does not exist. The
user_add_stage doesn't pass it.

Normally this error is not fire, the form's action attribute get
blank. But, when I set the TEMPLATE_STRING_IF_INVALID variable in the
settings file to:
   TEMPLATE_STRING_IF_INVALID = 'Variable "%s" out of context'
then the add_form's action fire a non matching URL.

How can I fix this problem

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



Re: Getting development environment configured

2008-02-08 Thread Adam Stein

Glad to hear my information was useful.  Now all I have to do is finish
figuring out how to use WAF to deploy my Django project and I'm all
set :-{}

On Fri, 2008-02-08 at 11:51 -0800, Brandon Taylor wrote:
> FINALLY, it works.
> 
> I guess the entire problem was that I had specified the website
> directory itself instead of the PARENT of the website directory in the
> PythonPath. Now I just need to tell Apache to not process anything
> else with mod_python and I should be good to go.
> 
> Thanks Adam,
> b
> 
> On Feb 8, 1:08 pm, Adam Stein <[EMAIL PROTECTED]> wrote:
> > Just started with Django myself.  Went thru 3 different tutorials.
> > Hopefully, what I'm mentioning below hasn't already been covered.
> >
> >
> >
> > On Fri, 2008-02-08 at 10:34 -0800, Brandon Taylor wrote:
> > > So, chin up, moving on. Here is my website's directory structure:
> >
> > > /mysite
> > >   /public
> > > /images
> > > /css
> > > /javascripts
> >
> > >   /templates
> > > public.html
> > > home_page.html
> >
> > > views.py
> > > settings.py
> > > urls.py
> > > __init__.py
> > >From your directory structure, it looks like views.py, settings.py,
> >
> > urls.py, and __init__.py are NOT in 'mysite' but at the same level.  If
> > that's true, that's one reason why mod_python can't find
> > "mysite.settings".
> >
> > I run Apache using virtual servers, so my ... stuff
> > is associated with a specific virtual server (in httpd-vhosts.conf).  If
> > you don't, you can put it into the top-level httpd.conf file.  Mine
> > looks like this:
> >
> > 
> > SetHandler python-program
> > PythonHandler django.core.handlers.modpython
> > PythonInterpreter wise
> > PythonPath "['/home/adam/Src/WISE-2.0'] + sys.path"
> > SetEnv DJANGO_SETTINGS_MODULE WebSite.settings
> > SetEnv PYTHON_EGG_CACHE /tmp/.python-eggs
> > PythonDebug On
> > 
> >
> > I have everything athttp://my-server/wise2/and under handled by
> > mod_python.  The two main things here are PythonPath and
> > DJANGO_SETTINGS_MODULE.
> >
> > Given your structure above, settings.py (along with views.py, urls.py,
> > and __init__.py) should be in the 'mysite' directory.  Then PythonPath
> > would be set to point to the directory 'mysite' is in:
> >
> > PythonPath "['/my/dir'] + sys.path"
> >
> > In this case, your 'mysite' directory can be found at "/my/dir/mysite".
> > Then DJANGO_SETTINGS_MODULE would point to the settings file via the
> > Python import syntax:
> >
> > SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> >
> > mod_python would find the settings.py file because it would be in the
> > 'mysite' directory.
> >
> >
> >
> > > When I start up the dev server using manage.py runserver, my
> > > home_page.html template will render, but no images, no css, etc.
> >
> > > How can I:
> >
> > > 1. Tell the development server what the root of the website is.
> > > 2. Where my images, css and javascript files are.
> >
> > > I have put: (r'^public/../(?P.*)$', 'django.views.static.serve',
> > > {'document_root': '/public/../images'}),
> >
> > > in my URLconf, but, it's still not happy.
> >
> > I set up to handle static content if running in DEBUG mode (i.e. theff
> > # Set up to server static files if running within the development
> > # environment
> > if settings.DEBUG == True:
> > urlpatterns += patterns('django.views.static',
> > (r'^(?P.*)$', "serve", {"document_root":
> > "/project/www/htdocs/WISE
> > ",}),
> > )
> >
> > This goes last in urls.py and will pick up anything not matched by a
> > real Django pattern match (i.e. everything that's NOT a Django page).
> > So if I have a URL like ", the
> > dev server will actually serve (given my example)
> > "/project/www/htdocs/WISE/img/icons/UnknownPerson.jpg" from the local
> > filesystem.
> > --
> > Adam Stein @ Xerox Corporation   Email: [EMAIL PROTECTED]
> >
> > Disclaimer: All views expressed
> > here have been proved to be my own.  [http://www.csh.rit.edu/~adam/]
> > 
-- 
Adam Stein @ Xerox Corporation   Email: [EMAIL PROTECTED]

Disclaimer: All views expressed 
here have been proved to be my own.  [http://www.csh.rit.edu/~adam/]


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



using mod_python to host several django apps on the same vhost?

2008-02-08 Thread charles.wesley
Hi,

I'd like to host several django applications at http://foo.bar.com/x, 
http://foo.bar.com/y, etc. Currently I'm managing them all in the same vhost, 
using Apache locations to direct each URL to a different Django project. 
However, this technique requires me to rewrite my urls.py to accept ^x/admin 
instead of ^admin (which is bad and breaks portability). Is there a way that I 
can use mod_python to proxy http://foo.bar.com/x/admin/ to Django as /admin/ 
while still remembering which Django project it's running?

Thanks,
charles

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



Re: auth/add/user error

2008-02-08 Thread James Bennett

On Feb 8, 2008 1:50 PM, Narso <[EMAIL PROTECTED]> wrote:
> Normally this error is not fire, the form's action attribute get
> blank. But, when I set the TEMPLATE_STRING_IF_INVALID variable in the
> settings file to:
>TEMPLATE_STRING_IF_INVALID = 'Variable "%s" out of context'
> then the add_form's action fire a non matching URL.

The admin application relies on, and thus requires, that
TEMPLATE_STRING_IF_INVALID be an empty string. As noted in the
documentation for this setting, changing it will cause things to
break.



-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



Deploying Django with Apache

2008-02-08 Thread darien08

My problem is that I'm running my app like this: http://localhost:8000/mysite
and I'm getting an error that the 8000 port is not available.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Getting development environment configured

2008-02-08 Thread Brandon Taylor

FINALLY, it works.

I guess the entire problem was that I had specified the website
directory itself instead of the PARENT of the website directory in the
PythonPath. Now I just need to tell Apache to not process anything
else with mod_python and I should be good to go.

Thanks Adam,
b

On Feb 8, 1:08 pm, Adam Stein <[EMAIL PROTECTED]> wrote:
> Just started with Django myself.  Went thru 3 different tutorials.
> Hopefully, what I'm mentioning below hasn't already been covered.
>
>
>
> On Fri, 2008-02-08 at 10:34 -0800, Brandon Taylor wrote:
> > So, chin up, moving on. Here is my website's directory structure:
>
> > /mysite
> >   /public
> > /images
> > /css
> > /javascripts
>
> >   /templates
> > public.html
> > home_page.html
>
> > views.py
> > settings.py
> > urls.py
> > __init__.py
> >From your directory structure, it looks like views.py, settings.py,
>
> urls.py, and __init__.py are NOT in 'mysite' but at the same level.  If
> that's true, that's one reason why mod_python can't find
> "mysite.settings".
>
> I run Apache using virtual servers, so my ... stuff
> is associated with a specific virtual server (in httpd-vhosts.conf).  If
> you don't, you can put it into the top-level httpd.conf file.  Mine
> looks like this:
>
> 
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> PythonInterpreter wise
> PythonPath "['/home/adam/Src/WISE-2.0'] + sys.path"
> SetEnv DJANGO_SETTINGS_MODULE WebSite.settings
> SetEnv PYTHON_EGG_CACHE /tmp/.python-eggs
> PythonDebug On
> 
>
> I have everything athttp://my-server/wise2/and under handled by
> mod_python.  The two main things here are PythonPath and
> DJANGO_SETTINGS_MODULE.
>
> Given your structure above, settings.py (along with views.py, urls.py,
> and __init__.py) should be in the 'mysite' directory.  Then PythonPath
> would be set to point to the directory 'mysite' is in:
>
> PythonPath "['/my/dir'] + sys.path"
>
> In this case, your 'mysite' directory can be found at "/my/dir/mysite".
> Then DJANGO_SETTINGS_MODULE would point to the settings file via the
> Python import syntax:
>
> SetEnv DJANGO_SETTINGS_MODULE mysite.settings
>
> mod_python would find the settings.py file because it would be in the
> 'mysite' directory.
>
>
>
> > When I start up the dev server using manage.py runserver, my
> > home_page.html template will render, but no images, no css, etc.
>
> > How can I:
>
> > 1. Tell the development server what the root of the website is.
> > 2. Where my images, css and javascript files are.
>
> > I have put: (r'^public/../(?P.*)$', 'django.views.static.serve',
> > {'document_root': '/public/../images'}),
>
> > in my URLconf, but, it's still not happy.
>
> I set up to handle static content if running in DEBUG mode (i.e. theff
> # Set up to server static files if running within the development
> # environment
> if settings.DEBUG == True:
> urlpatterns += patterns('django.views.static',
> (r'^(?P.*)$', "serve", {"document_root":
> "/project/www/htdocs/WISE
> ",}),
> )
>
> This goes last in urls.py and will pick up anything not matched by a
> real Django pattern match (i.e. everything that's NOT a Django page).
> So if I have a URL like ", the
> dev server will actually serve (given my example)
> "/project/www/htdocs/WISE/img/icons/UnknownPerson.jpg" from the local
> filesystem.
> --
> Adam Stein @ Xerox Corporation   Email: [EMAIL PROTECTED]
>
> Disclaimer: All views expressed
> here have been proved to be my own.  [http://www.csh.rit.edu/~adam/]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to get a queryset by a ManyToMany field

2008-02-08 Thread coldpizza

This definitely makes sense, I have made a view called
`books_by_author` - this made it easy for me to fit the logic into my
feeble mind, and moreover it looks good in the URLconfs. Thanks a lot
for suggestions!

On Feb 8, 7:57 pm, "Jacob Kaplan-Moss" <[EMAIL PROTECTED]>
wrote:
> On 2/8/08, coldpizza <[EMAIL PROTECTED]> wrote:
>
> > And other related question: where it would be more logically correct
> > to put this code? In URLConf as an parameter for the view, in a view
> > of its own, or in a method bound to the Book model?
>
> I wouldn't put it in a URLconf. URLconfs are supposed to be
> "configuration", so putting logic there seems dirty (to me). From
> there, though, it's a bit of a matter of taste: do you consider "books
> by an author" to be model logic, or view logic?
>
> For me, I'm usually guided by how I'll be using the query in question:
> if it's designed to be accessed from non-view areas (template tags,
> CLI scripts, etc.) I'll put it on the model, but if that particular
> query is only used in some specific view, I'll leave it in the view.
> Again, though, it's a matter of taste.
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Help filter with Admin

2008-02-08 Thread sanrioyt

Hi whiteinge,

OK. I was using firefox and that did not work. But with IE
it works well.

Thanks,
sanrio

On Feb 7, 9:08 pm, Nathaniel Whiteinge <[EMAIL PROTECTED]> wrote:
> On Feb 7, 3:06 pm, [EMAIL PROTECTED] wrote:
>
> > Can you please give an example of what the list_filter be
> > in the model, to get the filterting to work?
>
> Is it just not showing up after the existing list_filter options?
>
> Assuming your current list_filter looks like:
> list_filter = ('affiliation', 'publication', 'research',)
>
> Then at the bottom of that JavaScript file, where the usage examples
> are (before the very last closing brackets), add something like the
> following:
> customFilter('By affiliation', 'school__in=A,B', 'School A or B');
>
> The first argument needs to be the exact text of the list_filter
> heading (the H3 element) that you're trying to hook on to.
>
> Email me off-list if that didn't get it working. I'm happy to help.
> - whiteinge
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Deploying django framework with site

2008-02-08 Thread Corey Oordt

Tim,

The django module just needs to be on the python path, which you can  
set in the mod_python configuration.

So you could do something like:

/My Site
   /myproject
  
   /site-packages
  /django
 
  

Shouldn't be to difficult as long as you put both /My Site/myproject  
and /site-packages on the python path.


Corey


On Feb 8, 2008, at 7:43 AM, Tim Sawyer wrote:

>
> Folks,
>
> Has anyone got any documentation on deploying the django framework  
> as part of
> the site?  I'm considering using django for an app at work (on  
> Oracle - so
> need SVN version?) and our release team will want a self contained  
> site to
> deploy.  They're used to WAR files and like them.  It'll be a  
> struggle to get
> them to install mod_python never mind getting a framework out of SVN!
>
> Ta,
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Getting development environment configured

2008-02-08 Thread Brandon Taylor

Hello everyone. I'm sure this question has been asked a million times,
but I'm going to ask it again, because I'm starting to get *really*
frustrated with trying to get Django up and running.

I would like to use the built-in development server, as getting
mod_python and Apache configured is simply impossible from my best
estimation. I've followed every tutorial I can find on the Internet,
and after 3 days of restarting Apache, I still get the "Could not
import settings mysite.settings" error. Ugh.

So, chin up, moving on. Here is my website's directory structure:

/mysite
  /public
/images
/css
/javascripts

  /templates
public.html
home_page.html

views.py
settings.py
urls.py
__init__.py


When I start up the dev server using manage.py runserver, my
home_page.html template will render, but no images, no css, etc.

How can I:

1. Tell the development server what the root of the website is.
2. Where my images, css and javascript files are.

I have put: (r'^public/../(?P.*)$', 'django.views.static.serve',
{'document_root': '/public/../images'}),

in my URLconf, but, it's still not happy.

Can someone please, Please, PLEASE show me what I'm doing wrong? I've
been doing web development for 10 years using asp, asp.net, php, cold
fusion, rails and java, but for the life of me, I can't seem to get
Django to do what it's supposed to do.

I would very much like to learn and use this great framework, but so
far, getting out of the gate has been really tough and I'd really
appreciate some help. I'm in Austin, Texas, and if there's anyone
local that would be so gracious as to help me get started with some
face-to-face tutoring, I'd be more than happy to compensate you for
your time.

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



Regroup issue (in template)

2008-02-08 Thread Kristian Øllegaard

Hi there!

I've tried to use regroup, without any result. I've read the entire
documentation, and searched google for hours, but i can't find a
solution - to me it looks correct.

I've pasted the code here:
http://paste.ubuntu-nl.org/55244/

Included is models.py and the template file

the view is here:
navn = Klasse.objects.get(afdeling__iexact=afdeling,
aargang__iexact=aargang, klasse__iexact=klasse)
klasse = Klasse.objects.get(afdeling__iexact=afdeling,
aargang__iexact=aargang, klasse__iexact=klasse).id
lektier =
Lektie.objects.filter(klasse__exact=klasse).order_by('dato')

return render_to_response("homework/lektie_list.html",
  { 'object_list' : lektier,
'navn' : navn},
  context_instance=RequestContext(request)
  )

Thanks in advantage!

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



Re: Dumping objects in templates

2008-02-08 Thread Tim

This might help:
http://www.djangosnippets.org/snippets/306/


On Feb 8, 9:59 am, Gollum <[EMAIL PROTECTED]> wrote:
> Thanks a lot!
> I know how to add tags, so I guess I'll start working on my own debug
> tools lib, but its still feels rather strange that I ought to do it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to get a queryset by a ManyToMany field

2008-02-08 Thread Jacob Kaplan-Moss

On 2/8/08, coldpizza <[EMAIL PROTECTED]> wrote:
> And other related question: where it would be more logically correct
> to put this code? In URLConf as an parameter for the view, in a view
> of its own, or in a method bound to the Book model?

I wouldn't put it in a URLconf. URLconfs are supposed to be
"configuration", so putting logic there seems dirty (to me). From
there, though, it's a bit of a matter of taste: do you consider "books
by an author" to be model logic, or view logic?

For me, I'm usually guided by how I'll be using the query in question:
if it's designed to be accessed from non-view areas (template tags,
CLI scripts, etc.) I'll put it on the model, but if that particular
query is only used in some specific view, I'll leave it in the view.
Again, though, it's a matter of taste.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Displaying ManyToMany fields inside templates

2008-02-08 Thread Rajesh Dhawan

Hi Martin,

> Then i'm trying to display only the first video in base.html (the main
> html template) and all videos in article_detail.html. I can't figure
> out how to display only the first video.. in detail, for loop works
> ok.
>
> This is the code i'm using in base.html (i use templatetag for
> article, to display only ones that have video):
> {% get_article_list as article_list %}
> {% for video in article_list.video.all %}

That won't work from what I understand of your model. If article_list
is a QuerySet, it won't have a .video attribute (that attribute
belongs to a single article.

Furthermore, this for loop wants to loop over all videos, but you said
you only wanted to show the first one.

>   
>   
>   {{ video.0.name }}, {{ video.0.url }}
>   

Here's a solution:

{% get_article_list as article_list %}
{% for article in article_list %}
{% displayfirstvideo article %}
{% endfor %}

The above assumes that you are trying to display the first video of
*each* article from article_list inside your main template.

Then, create a new template tag called displayfirstvideo:

@register.inclusion_tag('youtube-video.html')
def displayfirstvideo(article):
   video = article.video.all()[0]
   return {'video':video}

Note that this templatetag assumes you've got at least one video in
the article being passed as a parameter. I am sure you can refine that
if necessary.

Create a new template called youtube-video.html in your template path
with something like:


  
  {{ video.name }}, {{ video.url }}


-Rajesh D

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



Re: selection field in ForeignKey relation

2008-02-08 Thread Daniel Roseman

Sorry, brain explosion.
It should be:
contactID = models.ForeignKey(Contactinfo, db_column="contactID",
blank=True, null=True)
--
DR

On Feb 8, 2:33 pm, Nader <[EMAIL PROTECTED]> wrote:
> Thank for your reaction! Do you mean that I have to do the next
> statement:
>
> contactID = models.ForeignKey(Contactinfo, db_column="contactID",
> required=True)
>
> I have done  it but I get an error:
>
> __init__() got an unexpected keyword argument 'required'
>   
> cheers,
> Nader
> On Feb 8, 3:21 pm, Daniel Roseman <[EMAIL PROTECTED]>
> wrote:
>
> > On Feb 8, 11:08 am, Nader <[EMAIL PROTECTED]> wrote:
>
> > > Hallo,
>
> > > I have a model in which have use of ForeignKey to relate them.
>
> > > class Dataset(models.Model):
> > >   
> > >   contactID = models.ForeignKey(Contactinfo, db_column="contactID")
> > >   
> > >   class Admin:
> > > list_display = ('datasetName', 'datasetVersion',
>
> > > I use the  "Admin" class to administrate them also. We get some
> > > selection fields to choose one of the related elements. One of the
> > > choice elements is only this : " - - - - ".  It is produced
> > > atomatically and I don't want to have this element in selection
> > > fileds. Which option in "ForeignKey" do I have to use to skip " - - -
> > > -"?
>
> > > Regards,
> > > Nader
>
> > Add "required=True" to the definition of contactID.
> > --
> > DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Customizing the Admin Interface's Look and Feel - ch 6

2008-02-08 Thread mangamonk

thanks ..no change though

I'm running:
ubuntu 7.10
python 2.5.1
django version 0, 97



On Feb 8, 10:17 am, Marcin Mierzejewski
<[EMAIL PROTECTED]> wrote:
> Hi
>
> You have to add ADMIN_MEDIA_PREFIX to your settings.py file, e.g.:
> ADMIN_MEDIA_PREFIX = '/media/admin'
>
> Regrads,
> Marcin
>
> On Feb 7, 6:35 pm, mangamonk <[EMAIL PROTECTED]> wrote:
>
> > I'm trying to make a change to my templates here..
>
> > /django_trunk/mysite/templates/admin/base_site.html
>
> > But the templates being used are sitting here..
>
> > /django_trunk/django/contrib/admin/templates/admin/base_site.html
>
> > How do I get my site sitting athttp://127.0.0.1:8000/admin/touse my
> > applications code and not the base django code.
>
> > Do I need to adjust the PATH?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to get a queryset by a ManyToMany field

2008-02-08 Thread coldpizza

Thanks a lot! Before posting I have spent over an hour reading and
rereading that particular page in the doc section and in the
Djangobook but still somehow the concept eluded me. I do admit though
that I do not have previous experience solving this sort of issues in
other languages. Maybe adding a real use case to the doc could make it
easier to grasp.

And other related question: where it would be more logically correct
to put this code? In URLConf as an parameter for the view, in a view
of its own, or in a method bound to the Book model?

On Feb 8, 6:24 pm, "Jacob Kaplan-Moss" <[EMAIL PROTECTED]>
wrote:
> On 2/8/08, coldpizza <[EMAIL PROTECTED]> wrote:
>
> > Given that I have a Book model with a ManyToManyField called authors
> > how do I get all the books for a particular author? Each book may have
> > more than one author, so I cannot filter the books using the standard
> > methods.
>
> You'll want to more closely read the documentation on related object
> lookups:http://www.djangoproject.com/documentation/db-api/#related-objects.
>
> The short version, though, is this:
>
> Given a author ID, to find all the books by that author you'd use::
>
> Book.objects.filter(authors__pk=author_id)
>
> Or, given a particular author object::
>
> author.book_set.all()
>
> (Where did "book_set" come from? It's automatically created on the
> "other side" of the many-to-many relation you created from Book to
> Author. You can change the name of that relation attribute using the
> "related_name" option to ManyToManyField).
>
> Jacob
>
> PS: Also see Chapter 5 of the Django Book
> (http://djangobook.com/en/1.0/chapter05/);it's got examples pretty
> similar to what you're doing.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Dumping objects in templates

2008-02-08 Thread Gollum

Thanks a lot!
I know how to add tags, so I guess I'll start working on my own debug
tools lib, but its still feels rather strange that I ought to do it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms validator_list

2008-02-08 Thread lowshoe

after digging around in the code, i found "SubfieldBase" at
django.db.models.fields.subclassing

the docs there say this:

"Add SubfieldBase as the __metaclass__ for your Field subclass,
implement
to_python() and the other necessary methods and everything will work
seamlessly."

so i created my own field-class, added the __metaclass__ attribute as
told above and overwrote the validate() method:

from django.db.models.fields import SlugField
from django.db.models.fields.subclassing import SubfieldBase

class UniqueSlugField(SlugField):
__metaclass__ = SubfieldBase

def validate(self, field_data, all_data):
# do validation here...


but this validate-method never seems to be called. if we could
owerwrite the validation method this way, everything would be fine,
because whe had finally access to both "field_data" and "all_data" for
validation again.

any ideas?

cheers, lowshoe

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



Re: how to get a queryset by a ManyToMany field

2008-02-08 Thread Jacob Kaplan-Moss

On 2/8/08, coldpizza <[EMAIL PROTECTED]> wrote:
> Given that I have a Book model with a ManyToManyField called authors
> how do I get all the books for a particular author? Each book may have
> more than one author, so I cannot filter the books using the standard
> methods.

You'll want to more closely read the documentation on related object
lookups: http://www.djangoproject.com/documentation/db-api/#related-objects.

The short version, though, is this:

Given a author ID, to find all the books by that author you'd use::

Book.objects.filter(authors__pk=author_id)

Or, given a particular author object::

author.book_set.all()

(Where did "book_set" come from? It's automatically created on the
"other side" of the many-to-many relation you created from Book to
Author. You can change the name of that relation attribute using the
"related_name" option to ManyToManyField).

Jacob

PS: Also see Chapter 5 of the Django Book
(http://djangobook.com/en/1.0/chapter05/); it's got examples pretty
similar to what you're doing.

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



Displaying ManyToMany fields inside templates

2008-02-08 Thread Martin

This is probably very trivial question, though i can't figure it out.
I haven't found anything usefull in documentation, so i'll try my luck
here.

My model Article has a ManyToMany field called Video, which points to
a model Video. To make it simple, Article has many Videos.

class Article(models.Model):
   video = models.ManyToManyField(Video, blank=True, null=True,
filter_interface=models.VERTICAL)
   etc.

Then i'm trying to display only the first video in base.html (the main
html template) and all videos in article_detail.html. I can't figure
out how to display only the first video.. in detail, for loop works
ok.

This is the code i'm using in base.html (i use templatetag for
article, to display only ones that have video):
{% get_article_list as article_list %}
{% for video in article_list.video.all %}
  
  
  {{ video.0.name }}, {{ video.0.url }}
  

Is this the right syntax? If it's not, how would i display the first
video?
I really appreciate any help,

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



Re: How to use multiple selection with POST method

2008-02-08 Thread James Bennett

On Feb 8, 2008 9:15 AM, MADDY <[EMAIL PROTECTED]> wrote:
> User can select, for example, 3 options (not need to be consecutive)
> from 10 possible options using CTRL+mouse.
>
> When form is submited in database I found only one of those 3 options,
> the one at the bottom of 3 selected.

You want to have a look at the request/response documentation, which
explains exactly why this is and exactly what you need to do.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



javascript shortcuts on django templates

2008-02-08 Thread Mihai Damian

I'm following the official Django tutorial for ver 0.96. I got to the
part where the admin pages are generated and noticed that none of the
javascript helpers mentioned in the tutorial get displayed on my pages
(the date - time control, or the show link for collapsible fields,
etc.).

I use 0.96.1 on Windows and I had to manualy copy the media and
templates folders from the archive into site-packages\django\contrib
\admin to get the tamplates working in the first place (I'm not shure
if this is somehow related to my problem).

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



how to get a queryset by a ManyToMany field

2008-02-08 Thread coldpizza

Sorry if this is too trivial but I have looked through the docs and
could not find a clear answer.

Given that I have a Book model with a ManyToManyField called authors
how do I get all the books for a particular author? Each book may have
more than one author, so I cannot filter the books using the standard
methods.

My models are:
class Author(models.Model):
name = models.CharField(max_length=124)

class Book(models.Model):
title = models.CharField(max_length=124)
authors = models.ManyToManyField(Author)

If I got it right, according to the documentation to get to a 'child'
queryset I have to iterate with 'for each b in Book.objects.all()',
and then call the b.authors.all() on each instance in order to check
if a particular author.id is found in the authors queryset. But how do
I get the results as a queryset? I could not get this to work.

To get all the books for a given author.id, I have tried:

def books_by_author(request, object_id):
'''does not work'''
filtered_by_author = []
for b in Book.objects.all():
if object_id in [a.id for a in b.authors.all()]:
filtered_by_author.append(b)
return render_to_response('polls/book_list.html', {'object_list':
filtered_by_author,} )

But this, of course, does not work, because it returns a list and not
a query set. What would be a proper, nice solution?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to use multiple selection with POST method

2008-02-08 Thread MADDY

I am building web application using Django+postgresql

Have an INSERT page with text fields, text boxes, dropdown menus and
LIST/MENU form elements.



Let's say, have 10 options in "select", and need to select some of
them, as user wants.

User can select, for example, 3 options (not need to be consecutive)
from 10 possible options using CTRL+mouse.

When form is submited in database I found only one of those 3 options,
the one at the bottom of 3 selected.

Always one that is at the bottom of selected 3 or whatever is
selected.

Why? There should be all 3 options in table of database, and in one
field of table.

I cannot find a way to resolve this issue.

ANY IDEA WHY IT SHOULD BE LIKE THIS?

ANY HELP WOULD BE APPRICIATED.

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



Re: resizing an image

2008-02-08 Thread NickJ

This code - 
http://www.aspandjavascript.co.uk/javascript/javascript_api/get_element_width_height.asp
- offers better cross-browser support.

However it may be better to get the image size server-side. Django
offers builtin methods on image fields to obtain the image width and
height; alternatively, you can store the data in the database. See the
model-api on ImageField for details.

On Feb 8, 12:03 pm, NickJ <[EMAIL PROTECTED]> wrote:
> Does offsetWidth return what you want? this should represent the total
> "space" the element takes up (width, borders, padding etc)
>
> document.getElementById("myimage").offsetWidth
>
> (http://developer.mozilla.org/en/docs/DOM:element.offsetWidth)
>
> On Feb 8, 11:57 am, "Lic. José M. Rodriguez Bacallao"
>
> <[EMAIL PROTECTED]> wrote:
> > Hi folks, I know this question isn't from this group but I'll ask
> > anyway. I need to resize an image (thumbnail) based in the browser
> > width and height. I want to make my site browser resolution
> > independent. The only thing I can't get working is this. For example,
> > a page showing a news entry, the news entry had an image (thumbnail) I
> > want to display. With a browser resolution of 1000x740, this page
> > display ok but with a resolution of 780x560, it don't. What can I do?
> > Right now, I think resize the image based on its size with javascript
> > but I don't know how to get the image (an element in general) size. I
> > tried the "element.style.width" but it return an string which I can't
> > convert to an integer (500px for example, I just want 500). Any
> > sugestions?
>
> > --
> > Lic. José M. Rodriguez Bacallao
> > Cupet
> > -
> > Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo 
> > mismo.
>
> > Recuerda: El arca de Noe fue construida por aficionados, el titanic
> > por profesionales
> > -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: resizing an image

2008-02-08 Thread NickJ

Does offsetWidth return what you want? this should represent the total
"space" the element takes up (width, borders, padding etc)

document.getElementById("myimage").offsetWidth

(http://developer.mozilla.org/en/docs/DOM:element.offsetWidth)


On Feb 8, 11:57 am, "Lic. José M. Rodriguez Bacallao"
<[EMAIL PROTECTED]> wrote:
> Hi folks, I know this question isn't from this group but I'll ask
> anyway. I need to resize an image (thumbnail) based in the browser
> width and height. I want to make my site browser resolution
> independent. The only thing I can't get working is this. For example,
> a page showing a news entry, the news entry had an image (thumbnail) I
> want to display. With a browser resolution of 1000x740, this page
> display ok but with a resolution of 780x560, it don't. What can I do?
> Right now, I think resize the image based on its size with javascript
> but I don't know how to get the image (an element in general) size. I
> tried the "element.style.width" but it return an string which I can't
> convert to an integer (500px for example, I just want 500). Any
> sugestions?
>
> --
> Lic. José M. Rodriguez Bacallao
> Cupet
> -
> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.
>
> Recuerda: El arca de Noe fue construida por aficionados, el titanic
> por profesionales
> -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: New Django Site - tsacomplaints.com

2008-02-08 Thread Kenneth Loafman

Hitting 'Next' on the first page of All Complaints too me to All
Airports instead of page two.

...Ken

slartiblartfast wrote:
> hey guys - im about to formally launch a new site done with django
> called TSA Complaints (http://www.tsacomplaints.com)
> 
> the site is a response to the hundreds of comments taking the TSA to
> task for their well-deserved reputation of being ineffective, lax, and
> generally obnoxious. i hope for it to become a forum for complaints,
> housing the opinion of travelers inconvenienced by the company thats
> supposed to be keeping them safe. eventually, once enough input has
> been given, ill be excitedly mining the results on a regular basis
> (probably weekly-monthly) and publishing the results to watch trends
> in both the short and long (historical) term.
> 
> before the grand opening, i'd really appreciate any feedback,
> comments, wisdom or content (especially content!) that the django
> users community has to offer. this is the first kinda-big scale
> project i've launched, too.
> 
> 
> thanks!
> matt dennewitz
> > 

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



Re: Dumping objects in templates

2008-02-08 Thread NickJ

I don't know of anything out-of-the-box in python or in django, but it
should be pretty easy to write your own debug function. Python
supports excellent introspection. A very basic start would be
something like:

def debug(obj):
 ret = ""
 for attr in dir(obj):
  ret += "%s - %s" % (attr, getattr(obj, attr))
 ret += ""
 return ret

Which will return representation of every attribute and method in an
instance, and the string representation of the attribute. You can use
the isinstance method, or use the inspect built-in class, to only get
the atributes you require and customize it how you like. You can then
easily turn this in to a django tag so you can use it in templates or
whatever (see djangobook.com for writing custom tags and filters).

(caveat: i am new to python and django too)


On Feb 8, 9:46 am, Gollum <[EMAIL PROTECTED]> wrote:
> Hi, all!
> Is there any way to dump the whole object to html, for usual debugging
> purposes. All I want is to see some objects whole structure, all field
> values, child sets, etc. that are available for template.
> I'm kind of new to python and django, but I have some cakePHP
> experience and debug() function just that and I miss this kind of
> functionality in django.
> Thanks in advance!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



resizing an image

2008-02-08 Thread Lic. José M. Rodriguez Bacallao
Hi folks, I know this question isn't from this group but I'll ask
anyway. I need to resize an image (thumbnail) based in the browser
width and height. I want to make my site browser resolution
independent. The only thing I can't get working is this. For example,
a page showing a news entry, the news entry had an image (thumbnail) I
want to display. With a browser resolution of 1000x740, this page
display ok but with a resolution of 780x560, it don't. What can I do?
Right now, I think resize the image based on its size with javascript
but I don't know how to get the image (an element in general) size. I
tried the "element.style.width" but it return an string which I can't
convert to an integer (500px for example, I just want 500). Any
sugestions?

-- 
Lic. José M. Rodriguez Bacallao
Cupet
-
Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.

Recuerda: El arca de Noe fue construida por aficionados, el titanic
por profesionales
-

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



Re: New Django Site - tsacomplaints.com

2008-02-08 Thread [EMAIL PROTECTED]

Great idea! I'm a big fan of the darker color scheme. All you need now
is sweet logo and you're set!

I second the poster asking for hosting details. I'm also looking at
slicehost for a Django app I have in the works and any first-hand
wisdom you could impart would be more than appreciated.

Nice work.

Nolan Caudill
http://nolancaudill.com

On Feb 6, 10:19 pm, slartiblartfast <[EMAIL PROTECTED]> wrote:
> hey guys - im about to formally launch a new site done with django
> called TSA Complaints (http://www.tsacomplaints.com)
>
> the site is a response to the hundreds of comments taking the TSA to
> task for their well-deserved reputation of being ineffective, lax, and
> generally obnoxious. i hope for it to become a forum for complaints,
> housing the opinion of travelers inconvenienced by the company thats
> supposed to be keeping them safe. eventually, once enough input has
> been given, ill be excitedly mining the results on a regular basis
> (probably weekly-monthly) and publishing the results to watch trends
> in both the short and long (historical) term.
>
> before the grand opening, i'd really appreciate any feedback,
> comments, wisdom or content (especially content!) that the django
> users community has to offer. this is the first kinda-big scale
> project i've launched, too.
>
> thanks!
> matt dennewitz
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: selection field in ForeignKey relation

2008-02-08 Thread Nader

Thank for your reaction! Do you mean that I have to do the next
statement:

contactID = models.ForeignKey(Contactinfo, db_column="contactID",
required=True)

I have done  it but I get an error:

__init__() got an unexpected keyword argument 'required'
  
cheers,
Nader
On Feb 8, 3:21 pm, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> On Feb 8, 11:08 am, Nader <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hallo,
>
> > I have a model in which have use of ForeignKey to relate them.
>
> > class Dataset(models.Model):
> >   
> >   contactID = models.ForeignKey(Contactinfo, db_column="contactID")
> >   
> >   class Admin:
> > list_display = ('datasetName', 'datasetVersion',
>
> > I use the  "Admin" class to administrate them also. We get some
> > selection fields to choose one of the related elements. One of the
> > choice elements is only this : " - - - - ".  It is produced
> > atomatically and I don't want to have this element in selection
> > fileds. Which option in "ForeignKey" do I have to use to skip " - - -
> > -"?
>
> > Regards,
> > Nader
>
> Add "required=True" to the definition of contactID.
> --
> DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: selection field in ForeignKey relation

2008-02-08 Thread Daniel Roseman

On Feb 8, 11:08 am, Nader <[EMAIL PROTECTED]> wrote:
> Hallo,
>
> I have a model in which have use of ForeignKey to relate them.
>
> class Dataset(models.Model):
>   
>   contactID = models.ForeignKey(Contactinfo, db_column="contactID")
>   
>   class Admin:
> list_display = ('datasetName', 'datasetVersion',
>
> I use the  "Admin" class to administrate them also. We get some
> selection fields to choose one of the related elements. One of the
> choice elements is only this : " - - - - ".  It is produced
> atomatically and I don't want to have this element in selection
> fileds. Which option in "ForeignKey" do I have to use to skip " - - -
> -"?
>
> Regards,
> Nader

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



Dumping objects in templates

2008-02-08 Thread Gollum

Hi, all!
Is there any way to dump the whole object to html, for usual debugging
purposes. All I want is to see some objects whole structure, all field
values, child sets, etc. that are available for template.
I'm kind of new to python and django, but I have some cakePHP
experience and debug() function just that and I miss this kind of
functionality in django.
Thanks in advance!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Deploying django framework with site

2008-02-08 Thread Tim Sawyer

Folks,

Has anyone got any documentation on deploying the django framework as part of 
the site?  I'm considering using django for an app at work (on Oracle - so 
need SVN version?) and our release team will want a self contained site to 
deploy.  They're used to WAR files and like them.  It'll be a struggle to get 
them to install mod_python never mind getting a framework out of SVN!

Ta,

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: custom model field validation

2008-02-08 Thread Jonas Pfeil

> So If I create a newforms field then how do I tell the admin to use
> that when building the form in the admin?

You will need to use the newforms-admin branch to get the admin to use
a newforms field ;)

Btw: If you just want the regex functionality you can use the
RegexField of newforms like so:

def formfield(self, **kwargs):
defaults = {'regex':r"^[A-Za-z][1-9][1-7][0-9]$"}
defaults.update(kwargs)
return super(models.CharField,
self).formfield(form_class=forms.RegexField, **defaults)

Cheers,

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



How to handle timezones correctly?

2008-02-08 Thread David Larlet

Hello,

I'm trying to make an application which deals with timezones thanks to  
pytz[1] and I can't figure out how to use hourly timezones instead of  
minutes based ones. For instance:

 >>> paris = pytz.timezone('Europe/Paris')
 >>> mydate = datetime(*time.strptime('2008-02-12', '%Y-%m-%d')[: 
6],**{'tzinfo':paris})
 >>> print mydate
2008-02-12 00:00:00+00:09

And if I try to use the normalize function, the date is changed :

 >>> print paris.normalize(mydate)
2008-02-12 00:51:00+01:00

I'm really surprised that some kind of "rounded" function for  
timezones exist. Or maybe I just didn't find it?
Any tips will be really appreciated.

Thanks,
David

[1] http://pytz.sourceforge.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



selection field in ForeignKey relation

2008-02-08 Thread Nader

Hallo,

I have a model in which have use of ForeignKey to relate them.

class Dataset(models.Model):
  
  contactID = models.ForeignKey(Contactinfo, db_column="contactID")
  
  class Admin:
list_display = ('datasetName', 'datasetVersion',

I use the  "Admin" class to administrate them also. We get some
selection fields to choose one of the related elements. One of the
choice elements is only this : " - - - - ".  It is produced
atomatically and I don't want to have this element in selection
fileds. Which option in "ForeignKey" do I have to use to skip " - - -
-"?

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



Re: Transient ViewDoesNotExist errors

2008-02-08 Thread Graham Dumpleton

On Feb 8, 8:43 am, Richard Jones <[EMAIL PROTECTED]> wrote:
> I have noticed that apache's error log has tons of these entries at
> random (avg. 5 minutes) intervals:
>
> [Thu Feb 07 14:08:11 2008] [notice]mod_python: (Re)importing module
> 'django.cor
> e.handlers.modpython'
>
> The dates of these log entries don't exactly match the dates of the
> error emails though.

You can ignore these messages from mod_python. You will see them every
time Apache starts up a new child process for handling requests. It is
just telling you that it is importing handler for mod_python for first
time for that process. If you were using mod_python 3.3.1, instead of
an old obsolete version of mod_python, you likely wouldn't even see
them, as mod_python shouldn't have really ever been making sys.path
modules reloading candidates as it causes too many problems. The
newest version of mod_python addresses the problems around that by
separating sys.path imports from its own.

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



Re: TemplateDoesNotExist error

2008-02-08 Thread Marcin Mierzejewski

Hi,

You have to add path to directory where you have template files.
settings.py file TEMPLATE_DIR parameter.

Regards,
Marcin


On Feb 7, 4:16 pm, Schmoopie <[EMAIL PROTECTED]> wrote:
> I'm slaying the configuration bugs, slowly but surely, with your help.
>
> The latest one is a TemplateDoesNotExist error. This is what the stack
> shows:
>
> ...
>   File "C:\progra~1\Python25\lib\site-packages\django\template
> \loader.py", line 79, in get_template
> source, origin = find_template_source(template_name)
>   File "C:\progra~1\Python25\lib\site-packages\django\template
> \loader.py", line 72, in find_template_source
> raise TemplateDoesNotExist, name
> django.template.TemplateDoesNotExist: experts/step_editor.html
>
> What causes such an error? How can it be corrected?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Customizing the Admin Interface's Look and Feel - ch 6

2008-02-08 Thread Marcin Mierzejewski

Hi

You have to add ADMIN_MEDIA_PREFIX to your settings.py file, e.g.:
ADMIN_MEDIA_PREFIX = '/media/admin'

Regrads,
Marcin


On Feb 7, 6:35 pm, mangamonk <[EMAIL PROTECTED]> wrote:
> I'm trying to make a change to my templates here..
>
> /django_trunk/mysite/templates/admin/base_site.html
>
> But the templates being used are sitting here..
>
> /django_trunk/django/contrib/admin/templates/admin/base_site.html
>
> How do I get my site sitting athttp://127.0.0.1:8000/admin/to use my
> applications code and not the base django code.
>
> Do I need to adjust the PATH?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: template & forloop help

2008-02-08 Thread Marcin Mierzejewski

Hi,

What is 'divs' in your example?
And what do you want to do it?

If you want to display a list "name1", "name2", "name3" you can do it
in this way:

view.py

divs = ('name1', 'name2', 'name3')

template.html
{% for div in divs %}
  {{ div }}
{% endfor %}

Regards,
Marcin


On Feb 6, 5:23 pm, [EMAIL PROTECTED] wrote:
> Hi guys,
>
> Trying to figure out how to use the forloop.counter in a template but
> to add it to a field to increment the name of the field each time. for
> example.. in my template i will have this
>
> {% for div in divs %}
> {{ form.name }}
> {% endfor %}
>
> so this will result in ...
>
> name
> name
> name etc..
>
> I need it to be name1, name2 , name3
>
> I was thinking of something like this although this does not work. is
> there a way of using the %s %i in a template?
>
> {% for div in divs %}
> {{ form.name|forloop.counter }}
> {% endfor %}
>
> If i just did it manualy like below it works fine
>
> {% for div in divs %}
> 
> {% endfor %}
>
> Any help would be greatly appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: template & forloop help

2008-02-08 Thread David Reynolds


On 6 Feb 2008, at 4:23 pm, [EMAIL PROTECTED] wrote:

>
> Hi guys,
>
> Trying to figure out how to use the forloop.counter in a template but
> to add it to a field to increment the name of the field each time. for
> example.. in my template i will have this
>
> {% for div in divs %}
> {{ form.name }}
> {% endfor %}
>
> so this will result in ...
>
> name
> name
> name etc..
>
> I need it to be name1, name2 , name3
>
> I was thinking of something like this although this does not work. is
> there a way of using the %s %i in a template?
>
> {% for div in divs %}
> {{ form.name|forloop.counter }}
> {% endfor %}
>
> If i just did it manualy like below it works fine
>
> {% for div in divs %}
> 
> {% endfor %}
>
> Any help would be greatly appreciated.

Does doing this do what you want?

{% for div in divs %}

{% endfor %}

or have I completely misunderstood what you meant?

-- 
David Reynolds
[EMAIL PROTECTED]



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



Re: Specifying custom upload to with FileField

2008-02-08 Thread Pigletto

> With this the uploaded files will go to <>/files/,
> howeverI want to upload all files to a subdirectory with the name of
> the project, how can I do that?
Same question was asked yesterday:
http://groups.google.com/group/django-users/browse_thread/thread/7e193c1532920a6f#

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



Re: Using a drop down list as widget for filter in admin

2008-02-08 Thread Julien

Thanks James,

I did not find the documentation you're referring to, and by posting
here (twice) I was hoping to find a built-in option. But since there
doesn't exist one, I tried your suggestion and it was indeed pretty
easy to implement.

For those who are interested, here's my solution. Create a template
admin/filter.html and paste the following into it:

{% load i18n %}
{% blocktrans with title|escape as filter_title %} By
{{ filter_title }} {% endblocktrans %}


{% for choice in choices %}
{{ choice.display|
escape }}
{% endfor %}




The flaw for that solution is that it overrides the way *all* filters
are rendered in the admin. Don't know if there's a way to indicate
what filter or app this should only apply to.

Also, I'm never completely satisfied when overriding the admin
templates, because that makes you tightly dependent on the admin
behaviour, which may possibly change one day or another and make your
customized templates crash without warning.


On Feb 8, 6:30 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Feb 8, 2008 1:06 AM, Julien <[EMAIL PROTECTED]> wrote:
>
> > Doesn't anybody really have an idea how to do this?  :)
>
> Yes: sit down and take a look at how the admin templates display the
> list, then think about how you'd change it to produce a 
> element with individual  elements for each value. In all
> likelihood, it'll take about ten minutes of fiddling around to produce
> something that works, as compared to a week spent waiting for an
> answer that's already available from the Django documentation (namely,
> that there is no built-in option to do this).
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Specifying custom upload to with FileField

2008-02-08 Thread patrickk

you could use the filebrowser:
http://code.google.com/p/django-filebrowser/

patrick

On Feb 8, 8:24 am, josh <[EMAIL PROTECTED]> wrote:
> I have this question as well but from what I've seen the only
> customizing available is to use strftime formatting.
> josh
>
> On Feb 6, 2008, at 11:16 AM, shabda wrote:
>
>
>
> > I have a model like
>
> > class ProjectFile(models.Model):
> >project = models.ForeignKey(Project)
> >file = models.FileField(upload_to = '/files/')
>
> > class Project(models.Model):
> >  name = models.CharField(max_length  = 100)
>
> > With this the uploaded files will go to <>/files/,
> > howeverI want to upload all files to a subdirectory with the name of
> > the project, how can I do that?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: custom model field validation

2008-02-08 Thread Pigletto

> So If I create a newforms field then how do I tell the admin to use
> that when building the form in the admin?
If you need this in admin then possibly you have to define your own
newforms field
with validation. It may be called: myfields.MyField
Then you define descednant of CharField from django.db.models like:

class MyDBField(models.CharField):
def get_internal_type(self):
return "CharField

   def formfield(self, **kwargs):
defaults = {'form_class': myfields.MyField}
defaults.update(kwargs)
return super(MyDBField, self).formfield(**defaults)

and you use MyDBField instead of CharField in your models.py file.

I've never tried this with Admin, so I'm not sure if this will do what
you want, but
it is simple enough to check it.

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