Re: physical path of an uploaded image

2006-03-17 Thread Sasha

Thank you! That work great.


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



Re: physical path of an uploaded image

2006-03-17 Thread Kenneth Gonsalves

On Saturday 18 Mar 2006 12:06 pm, Sasha wrote:
> i have a django app that allows images to be uploaded. when i try
> to reference an image in a template by calling
> object.get_image_url or object.get_image_filename i get the full
> physical path including the filename in response. can anyone
> recommend an approach to troubleshoot this?

whatever path you put in 'upload_to' will appear. If your media is 
in /home/you/media and this is defined in apache, and you want to 
upload to /home/you/media/images/gallery/, then you have to put 
upload_to='images/gallery/'

-- 
regards
kg

http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!

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



Re: How to get vote total in poll tutorial

2006-03-17 Thread [EMAIL PROTECTED]

No, one underscore doesn't work:

choices.get_values(fields=['poll', 'votes'], poll_id=1)

returns

TypeError: got unexpected keyword argument 'poll_id'

I'm using two underscores because that's my (limited) understanding of
the field__lookuptype syntax of the API documentation
(http://www.djangoproject.com/documentation/db_api/#field-lookups) .
Specifically, I'm trying to get all the votes of the poll with the id
of 1.

Thanks though,
John


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



physical path of an uploaded image

2006-03-17 Thread Sasha

i have a django app that allows images to be uploaded. when i try to
reference an image in a template by calling object.get_image_url or
object.get_image_filename i get the full physical path including the
filename in response. can anyone recommend an approach to troubleshoot
this?

i'm running mod_python under apache. i'm serving media files from the
same apache instance, but i have a separate location for the media.

thanks,

sasha


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



physical path appear in uploaded image

2006-03-17 Thread Sasha

i have an that allows images to be uploaded. when i try to reference an
image in a template by calling object.get_image_url or
object.get_image_filename i get the full physical path including the
filename in response. can anyone recommend an approach to troubleshoot
this?

thanks,

sasha


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



Re: problem with login_required decorator in python2.3

2006-03-17 Thread Kenneth Gonsalves

On Friday 17 Mar 2006 6:20 pm, Les Smithson wrote:
> Write you own login_required and use that as a decorator:
>
> from django.views.decorators.auth import user_passes_test,
> login_required
> mylogin_required = user_passes_test(lambda u: not
> u.is_anonymous(), login_url="/my/login/")

simpler to just use user_passes_test

-- 
regards
kg

http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!

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



Many to one screwed up in admin

2006-03-17 Thread Todd O'Bryan

I have a Question class. I also have a QuestionDatum class that has  
Question as a ForeignKey field (possible multiple choice answers,  
correct answer, the question text, etc., are stored in QuestionDatum  
objects). I'm trying to edit these using the admin interface.

I've set up edit_inline, and have two fields to enter Datum  
instances, but whenever I edit a question, old information gets lost.  
For example, I get two places to edit Datums. I enter two. When I  
press "Save and continue editing", one datum remains, one disappears,  
and I have another blank space. If I enter anything in the blank  
space and click "Save" or "Save and continue editing", the new datum  
appears as the first item on the edit page, and the others just  
disappear.

Any idea what might be up?

Todd

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



Re: problem with login_required decorator in python2.3

2006-03-17 Thread Kenneth Gonsalves

On Friday 17 Mar 2006 6:20 pm, Les Smithson wrote:
> Write you own login_required and use that as a decorator:
>
> from django.views.decorators.auth import user_passes_test,
> login_required
> mylogin_required = user_passes_test(lambda u: not
> u.is_anonymous(), login_url="/my/login/")
>
> @mylogin_required
> def blagh(request):

neat

-- 
regards
kg

http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!

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



Re: problem with login_required decorator in python2.3

2006-03-17 Thread Kenneth Gonsalves

On Friday 17 Mar 2006 5:43 pm, Amit Upadhyay wrote:
> Monkey patching:
>
> If you find
> login_requiredication/#the-login-required-decorator>decorator enough for your
> needs, but do not like the /accounts/login/ url, you can edit
> django/views/auth/login.py and set them what you want. They
> should make it configurable through setting.py

dont want to monkey patch - i have 9 sites running on the same 
django and am using svn

-- 
regards
kg

http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!

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



Re: Getting an object' content_type_id

2006-03-17 Thread Adrian Holovaty

On 3/9/06, Rob Slotboom <[EMAIL PROTECTED]> wrote:
> Is there a way to get an object's content_type_id?
>
> I need it to store an object's id and content_type_id in another table.
>
> Currently I solved this by using an sql-statement but maybe there is
> some 'hidden' property or function like:
> self.content_type or self.get_content_type

The cleanest way to do this would be:

from django.models.core import contenttypes
ct = contenttypes.get_object(package__package__exact='news', \
python_module_name__exact='reporters')

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

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



Re: Eclipse based Django IDE???

2006-03-17 Thread [EMAIL PROTECTED]

I also use Eclipse and PyDev for my IDE, Eclipse has some very nice
plugins for HTML / JS / CSS called the WTP or web tools platform.


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



Re: information about django on dreamhost

2006-03-17 Thread James Bennett

On 3/17/06, Jeremy Jones <[EMAIL PROTECTED]> wrote:
> Kevin Dangoor, author of TurboGears, just posted on the TG list about a
> conversation he just had with the folks over at Dreamhost.  Sounds like
> they're recommending people to not run TurboGears on their servers, and
> this would presumably apply to Django as well.  Here's a link to his
> post:

Fromreading what Kevin posted there, I wonder how much of this has to
do with anything they know about TG or Django, and how much has to do
with them getting scared at what Rails did to their servers when
people deployed half-baked apps running the "development" environment,
and deciding to err on the side of caution when people want to use
frameworks from now on.

Or, even worse, maybe it's based on people deploying Typo, which is an
absolute pig.

--
"May the forces of evil become confused on the way to your house."
  -- George Carlin

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



Re: information about django on dreamhost

2006-03-17 Thread [EMAIL PROTECTED]

I also use Dreamhost for several Django projects of mine.

http://www.socialistsoftware.com/
http://impactsport.org/
http://coloradoridge.com/

I wont say that the experience has been perfect, but I have things
working and I will continue to be a subscriber.

I do recommend every Dreamhost user send the Dreamhost people email
stating that you would like better Django and other Python web
framework support.

Dreamhost subscribers can even cast your vote for better Django support
at https://panel.dreamhost.com/index.cgi?tree=home.sugg;


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



Re: Suggested Method of Coordinating DB Schema and Python Model

2006-03-17 Thread Adrian Holovaty

On 3/17/06, Mike <[EMAIL PROTECTED]> wrote:
> Here's what I think Django needs:
>
> A utility which analyzes both the DB Schema *and* the python model.
> The output will be a 'suggested' revision to the model  which will
> retain everything which has not changed, comment out items which have
> been deleted, and best guesses at what needs to be added.  Further, it
> should be practical to guarantee that the 'suggested' code works.
> [There is already a start on this with 'django-admin.py inspectdb'.]

Hey Mike,

Welcome to the Django community, and thanks for the note!

There have been *several* discussions about adding such a feature, and
even a few attempts at implementing it. Database schema changes are a
hard problem to automate, so we haven't come up with anything perfect
enough yet. Specific ideas and implemenations are definitely welcome.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

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



Suggested Method of Coordinating DB Schema and Python Model

2006-03-17 Thread Mike

First, I just found out about Django and really like what I have seen
so far.

Even so, I don't think it will be really successful unless Django
provides tools for automatically coordinating DB Schema changes and the
Python Code.  Please don't hang up yet - I have  a suggestion.

I just spent about a month looking at Rails.  I think the reason Rails
is so hot is that it is built on the ActiveRecord class in Ruby.
ActiveRecord creates Ruby objects from the DB Schema [on the fly] so
the driver for the model is the database.  I think it is unusual in
that regard: generally we drive the model from the implementation
language - at least I have in the past.

I don't think that solution is really long-term viable because
ActiveRecord is blind to the implementation, so it's probably not
possible to get the nice features Django has for modeling the semantics
of the data [databases are pretty limited and drab].  Also, Rails
relies on a lot of convetions to keep everything glued together.

Here's what I think Django needs:

A utility which analyzes both the DB Schema *and* the python model.
The output will be a 'suggested' revision to the model  which will
retain everything which has not changed, comment out items which have
been deleted, and best guesses at what needs to be added.  Further, it
should be practical to guarantee that the 'suggested' code works.
[There is already a start on this with 'django-admin.py inspectdb'.]

The idea is to do as much as possible of the routine and error prone
work in coordinating the python code with the database schema without
losing the fine grained control Django already offers.

That way we should be able to didle with the schema without having to
flush and reload the database and make coordinated changes to the
python code.


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



Re: Sorting and Linking in Admin mode

2006-03-17 Thread dave.l

Hi Adrian,

Thank you for your swift reply.

1) Perfect! sorted menus

2) I get a 1054, "Unknown column 'coils_buildings.principal_name' in
'order clause'" doing this
class Building(meta.Model):
class META:
ordering = ('principal_name',)
admin = meta.Admin()

class Window(meta.Model):
#ordering = ('building',)
class META:
admin = meta.Admin(
ordering = ('building',)
)
same error making this a META ordering.

(I don't need this to work for my admin interface though)

3) inline - yes, the second level of inline is not appearing: If I view
a Building I see it's own data, then the inline table of Windows, but
not the further inline tables of Lights. I don't need this to work as
the final page would be unmanageably large. What I was hoping for was a
[url] link per Window listed in the inline table which would open the
appropriate Window table. i.e to /admin/coils/windows/1232/

would it be possible for the list_display to contain a ref to a method
which returned a  link, something a bit like...

def link(self):
return "/admin/coils/windows/%d" % self.id  ## <- obviously
not quite so 'static'!
class META:
admin = meta.Admin(
list_display = ( 'link', 'building', 'reference', 'location',
'configuration')
)

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



Re: information about django on dreamhost

2006-03-17 Thread PythonistL

I use Dreamhost with Django for some time already and I am happy with
that.Works great!


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



Re: Sorting and Linking in Admin mode

2006-03-17 Thread Adrian Holovaty

On 3/17/06, dave.l <[EMAIL PROTECTED]> wrote:
> 1) Menu item ordering
>
> class Iconography(meta.Model):
> description = meta.CharField(maxlength=255)
> def __repr__(self):
> return self.description
> class META:
> admin = meta.Admin(
> ordering = ('description',),
> )
>
> class Light(meta.Model):
> window  = meta.ForeignKey(Window, edit_inline=meta.TABULAR)
> sub_location= meta.CharField(maxlength=255, core=True)
> iconography = meta.ForeignKey(Iconography)
> class META:
> admin = meta.Admin()
>
>
> The 'ordering' works as expected when looking at the Iconography table,
> but when viewing a Light, the 'select' widget shows the Iconography's
> in (I guess) ID order. Is it possible to sort this menu?

Yes, that's possible. Do this by setting "ordering" on your
Iconography model in "class META", like so:

class META:
ordering = ('description',)
admin = meta.Admin()

Putting "ordering" in the meta.Admin() designates the ordering to use
on the admin change-list page. Putting "ordering" in "class META"
designates the default ordering to use *everywhere* (even in
get_list() and other database API code, etc.). If meta.Admin() doesn't
define ordering, the changelist will use the "class META" ordering.
Note that I've removed "ordering" from the admin options in the above
example because it'd be redundant.

> 2) Ordering on foreign key field
>
> class Window(meta.Model):
> building= meta.ForeignKey(Building, edit_inline=meta.TABULAR)
> reference   = meta.CharField(maxlength=255, core=True)
> location= meta.ForeignKey(Location)
> def __repr__(self):
> return "%s / W%s / %s" % (self.get_building().principal_name,
> self.reference, self.get_location())
> class META:
> admin = meta.Admin(
> ordering = ('reference',), # FIXME sort on building name too
> )
>
> Is it possible to sort this Window table on the principal_name of the
> building referred to and then the Window's own reference (effectively
> sorted on the __repr__ I have written).

It's not possible to sort by a __repr__() or any other Python
function, because the sorting happens at the database level. What you
could do, though, is add a "class META" ordering to your Building
model that's set to ('principal_name',) and set the admin ordering for
Window to ('building',).

Note that you can set "list_display" to give each field its own column
on the change list. For example:

list_display = ('building', 'reference', 'location')

The advantage here is that each one of those columns will be sortable.

> 3) Linking to another table
>
> class Building(meta.Model):
> """Building table."""
> .
>
> class Window(meta.Model):
> building= meta.ForeignKey(Building, edit_inline=meta.TABULAR)
> ..
>
> class Light(meta.Model):
> window  = meta.ForeignKey(Window, edit_inline=meta.TABULAR)
> ..
>
> Opening an entry in the Window table correcly shows all Lights. Opening
> an entry in the Building table correctly shows all Windows, but it does
> not show all the subsequent Lights. In practice I don't want to as
> there are too many, but is it possible to add links in the inline
> Windows to open the relevant Window table?

The edit_inline functionality only works one level deep, so, if I
understand your question correctly, the admin interface can't do that.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

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



information about django on dreamhost

2006-03-17 Thread Jeremy Jones

Kevin Dangoor, author of TurboGears, just posted on the TG list about a
conversation he just had with the folks over at Dreamhost.  Sounds like
they're recommending people to not run TurboGears on their servers, and
this would presumably apply to Django as well.  Here's a link to his
post:

http://groups.google.com/group/turbogears/browse_frm/thread/c1c81ae56f37e444/3422a35cfa5bf985?lnk=st=turbogears+dreamhost=1=en#3422a35cfa5bf985

- jmj

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



Re: Advice on developing with django for a team of 10+

2006-03-17 Thread Julio Nobrega

On 3/17/06, Jeremy Jones <[EMAIL PROTECTED]> wrote:
> Actually, if you do ``svn export
> http://path.to.svn.server/path/to/repository/``
> it'll strip out all the .svn cruft for you.

  I didn't know that Jeremy, tnx!

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

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



Re: How to populate a form with multiple values

2006-03-17 Thread limodou

On 3/17/06, PythonistL <[EMAIL PROTECTED]> wrote:
>
> Limodou,
> I have the custom manipulator, see the beginning of this thread.
> But I do not know how to populate data from that manipulator to the form
>

the data passed to FormWrapper should match the name of FormField's
field_name. I checked your code and found that you create many input
fields for every item, for example:

items = ['A', 'B', 'C']

so the field_names of FormFields will be:

'A', 'A_Name', 'A_Description'...
'B', 'B_Name', 'B_Desctiption'...
'C', 'C_Name', 'C_Description'...

And if you want to pass data to FormWrapper, the data should be a
dict, and the field you want to set value should exists in it. So the
data maybe looks like:

data = ['A':'A', 'A_Name':'A_Name', ..., 'A_Price':a_price,
'B':...
'C'...
]

And if you want to create such dict, you should loop the items just
like you create manipulator's fields.

I don't know whether I describe clearly and I havenot tried how to
deal with some fields with the same field_name in a manipulator. Just
try it.

--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit

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



Re: Advice on developing with django for a team of 10+

2006-03-17 Thread Jeremy Jones

On Thu, 16 Mar 2006 23:53:56 -0300
"Julio Nobrega" <[EMAIL PROTECTED]> wrote:

> 
>   Hey tone,
> 
>   Eric provided a good explanation of what's like working with svn. I
> would like to comment a little on point number 3.
> 
>   Having everything on svn helps us on deployment too. Most software
> management tips will tell you to compile your code daily. Because it
> gives the development team a clear goal and discourages them to commit
> bugged code.
> 
>   Here's what happens where I work: QA approves the 'build' (a svn
> revision), and a Python script that I made checkout this code, removes
> the .svn directories,

Actually, if you do ``svn export
http://path.to.svn.server/path/to/repository/``
it'll strip out all the .svn cruft for you.  When I get ready to do a
release (not at work, we have different procedures here), I stop
working on the branch I'm no, ``svn copy`` to a new branch, and ``svn
export`` the finished branch.  I'm thinking of changing my release
procedures and branching to a "release" branch and exporting from
there

- jmj


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



Re: Once more: sqlall and sqlindexes

2006-03-17 Thread Ned Batchelder




Submitted as http://code.djangoproject.com/ticket/1508

--Ned.

Adrian Holovaty wrote:

  On 3/16/06, Ned Batchelder <[EMAIL PROTECTED]> wrote:
  
  
Why doesn't the sqlall command include sqlindexes?  It should.  Why
would I want to create and initialize a database without the indexes?

  
  
No real reason, other than it's faster to bulk-load data without
indexes. A patch would certainly be welcome.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com





  


-- 
Ned Batchelder, http://nedbatchelder.com


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





problem with login_required decorator in python2.3

2006-03-17 Thread Kenneth Gonsalves

hi,
my site is on "/web/', so for example, my home page is:
http://mysite.com/web/home/ and admin is in:
http://mysite.com/web/admin/

but using login_required decorator, the thing is directed to:
http://mysite.com/accounts/login/ when i want it to go to 
http://mysite.com/web/login/

How to solve this?
-- 
regards
kg

http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!

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



Re: How to populate a form with multiple values

2006-03-17 Thread PythonistL

Kenneth,Thank you for your idea.It can be really better to use
sessions.
But now the biggest problem for me is that I can not display multiple
values from the shopping cart in input fields of my form.
Any idea?
Thanks


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



Re: How to populate a form with multiple values

2006-03-17 Thread [EMAIL PROTECTED]

limodou wrote:
> On 3/17/06, PythonistL <[EMAIL PROTECTED]> wrote:
> >
> > Kenneth,

> >
>
> I think ChangeManipulator is concerned to a single object, but what
> you will deal with are many objects, so you should create a custom
> manipulator yourself.

My concern with a custom manipulator would be the dynamic nature of the
shopping basket.  Since there's no way to know how many items there are
then the fields would have to be made dynamically when the manipulator
is created.  This is easy enough but when the FormWrapper is created
then there's no easy way to loop over the fields in the template and
create the form.

This is why I think creating a list of manipulators and then passing a
list of their FormWrappers to the template would be the 'neater' way to
do it but it feels a bit heavy handed; 20 items would require the
creation of 20 manipulators.  I'm not sure what affect this would have
on performance.

Surely somone's had to edit multiple objects onscreen at once?  Isn't
this what edit_inline does?  I suppose I could always check how the
admin app does it...

F.


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



Sorting and Linking in Admin mode

2006-03-17 Thread dave.l

I have been playing with Django for only a day or so but have had great
success coercing a legacy database into the Django world.  I have
quickly found that the Admin interface *nearly* provides all the
editing features I currently need for updating my DB and I think it
would be a great shame to leave my current 'no code' model to add the
few extra features I need in views/templates.  I am hoping that the
community might be able to help me out with my three questions:

1) Menu item ordering

class Iconography(meta.Model):
description = meta.CharField(maxlength=255)
def __repr__(self):
return self.description
class META:
admin = meta.Admin(
ordering = ('description',),
)

class Light(meta.Model):
window  = meta.ForeignKey(Window, edit_inline=meta.TABULAR)
sub_location= meta.CharField(maxlength=255, core=True)
iconography = meta.ForeignKey(Iconography)
class META:
admin = meta.Admin()


The 'ordering' works as expected when looking at the Iconography table,
but when viewing a Light, the 'select' widget shows the Iconography's
in (I guess) ID order. Is it possible to sort this menu?

2) Ordering on foreign key field

class Window(meta.Model):
building= meta.ForeignKey(Building, edit_inline=meta.TABULAR)
reference   = meta.CharField(maxlength=255, core=True)
location= meta.ForeignKey(Location)
def __repr__(self):
return "%s / W%s / %s" % (self.get_building().principal_name,
self.reference, self.get_location())
class META:
admin = meta.Admin(
ordering = ('reference',), # FIXME sort on building name too
)

Is it possible to sort this Window table on the principal_name of the
building referred to and then the Window's own reference (effectively
sorted on the __repr__ I have written).

3) Linking to another table

class Building(meta.Model):
"""Building table."""
.

class Window(meta.Model):
building= meta.ForeignKey(Building, edit_inline=meta.TABULAR)
..

class Light(meta.Model):
window  = meta.ForeignKey(Window, edit_inline=meta.TABULAR)
..

Opening an entry in the Window table correcly shows all Lights. Opening
an entry in the Building table correctly shows all Windows, but it does
not show all the subsequent Lights. In practice I don't want to as
there are too many, but is it possible to add links in the inline
Windows to open the relevant Window table?

I could obviously do all of these things by writing a custom view, but
I don't want to embark on coding if I've just missed some simple
tricks. Any Help / guidance greatfully received.


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



Re: How to populate a form with multiple values

2006-03-17 Thread PythonistL

Limodou,
Thanks for your reply and your comments.
But still I do not know how to transfer data from the shopping cart
into a form
Can you advise?
Thanks
L.


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



Re: How to populate a form with multiple values

2006-03-17 Thread Kenneth Gonsalves

On Friday 17 Mar 2006 3:32 pm, PythonistL wrote:
> I have a table that stores a shopping cart. But do you think that
> storing the shopping cart in a dictionary in the session would be
> a better solution?

yes - then, when all is done, you can save it into one or more 
tables. At least that is the conventional way - maybe the django 
way is different. One problem with table is that if he puts two 
things in the cart and then goes away and doesnt come back, you 
need to clean all those stale tables
-- 
regards
kg

http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!

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



Re: How to populate a form with multiple values

2006-03-17 Thread limodou

On 3/17/06, PythonistL <[EMAIL PROTECTED]> wrote:
>
> Kenneth,
> Thank you for your reply.
> I have a table that stores a shopping cart. But do you think that
> storing the shopping cart in a dictionary in the session would be a
> better solution?
>
> Thank you for the reply
>

I think ChangeManipulator is concerned to a single object, but what
you will deal with are many objects, so you should create a custom
manipulator yourself.

--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit

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



Re: How to populate a form with multiple values

2006-03-17 Thread PythonistL

Kenneth,
Thank you for your reply.
I have a table that stores a shopping cart. But do you think that
storing the shopping cart in a dictionary in the session would be a
better solution?

Thank you for the reply


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



Re: How to populate a form with multiple values

2006-03-17 Thread limodou

On 3/17/06, PythonistL <[EMAIL PROTECTED]> wrote:
>
> Limodou,
> Thank you for your reply.
> And do you have any idea how FormWrapper should be used?
> In my shop project I need to provide a feature to a user , when he
> does/finish shopping to be able to check all items in his basket.In
> other words, he will see all items he has put into the basket so far.
> The form should be something like this:
>
> #
>
> Item1   Quantity1(input field so that the user can change
> that)
> Item2   Quantity2(input field so that the user can change
> that)
> Item3   Quantity3(input field so that the user can change
> that)
> ...
> ...
> ...
> .
I think what you want to deal with is a batch process, but not a
single object. So you should custom your own manipulator, and process
batch data in server end.

--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit

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



Re: How to populate a form with multiple values

2006-03-17 Thread Kenneth Gonsalves

On Friday 17 Mar 2006 2:49 pm, PythonistL wrote:
> Item1               Quantity1(input field so that the user can
> change that)
> Item2               Quantity2(input field so that the user can
> change that)
> Item3               Quantity3(input field so that the user can
> change that)
> ...
> ...
> ...
> .
> Submit button

are you storing the shopping cart in a dictionary in the session?

-- 
regards
kg

http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!

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



Re: How to populate a form with multiple values

2006-03-17 Thread PythonistL

Limodou,
Thank you for your reply.
And do you have any idea how FormWrapper should be used?
In my shop project I need to provide a feature to a user , when he
does/finish shopping to be able to check all items in his basket.In
other words, he will see all items he has put into the basket so far.
The form should be something like this:

#

Item1   Quantity1(input field so that the user can change
that)
Item2   Quantity2(input field so that the user can change
that)
Item3   Quantity3(input field so that the user can change
that)
...
...
...
.
Submit button
#
Thank you for your reply
L.


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



Re: Django, Eclipse, Pydev, Ant (was: Ant and Eclipse (build.xml by Steven Armstrong))

2006-03-17 Thread Todd O'Bryan

As you suspected, running helloworld.py from build.xml didn't work,  
either. No useful errors, just the following:
--
Buildfile: /Users/tobryan1/Documents/eclipse/workspace/pytest/build.xml
hello-world:

BUILD FAILED
/Users/tobryan1/Documents/eclipse/workspace/pytest/build.xml:10:  
Error executing task

Total time: 486 milliseconds
--
Running the script by right-clicking and choosing "Run As... Python  
Run" does work, however.

I suspect I'm in the midst of configuration headaches.


Todd


On Mar 16, 2006, at 3:05 PM, Steven Armstrong wrote:

> Hi Todd
>
> Looks like it'ld be good to verify that you have everything setup  
> correctly.
> You can use the attached files (helloworld.py, build.xml) to test your
> dev env.


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