Re: Something like a mini Crystal Reports with Django

2007-08-02 Thread Mir Nazim

I understand that views need to be created. I am doing that these
days.

What specifically I wanted to know is whether anyone else has worked
on a similar stuff. So he might want to share his experience.

BRIT is Java. I would prefer something more python based solution.
even better is there is a django based one. If there is none, its
obvious I will have to create one.


On Aug 2, 8:20 pm, Lucky B <[EMAIL PROTECTED]> wrote:
> You could try Eclipse BIRT for a WYSIWYG interface. But otherwise you
> can create a view however you want to report your data doing whatever
> manipulation you wanted. I don't see what else you would need other
> than to create a view.
>
> On Aug 2, 5:17 am, Mir Nazim <[EMAIL PROTECTED]> wrote:
>
> > Anybody has any views on this.
>
> > --
> > PS: posting just to keep this topic fresh
>
> > On Jul 31, 4:28 pm, Mir Nazim <[EMAIL PROTECTED]> wrote:
>
> > > Hello
>
> > > I was wondering has anybody done application that was something like a
> > > mini crystal reports. Generating a report based of model items
> > > selected in a WYSIWYG(ok this is not important) fashion.  And
> > > generating a HTML tables based report with defined calculations etc.
>
> > > I understand that Django Admin has some kind of similar facilities. I
> > > am looking into them. In the mean time thought that may be some one
> > > else might be doing similar stuff somewhere.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Queryset of instances bound to particular ForeignKey

2007-08-02 Thread Collin Grady

Neither of those is correct.

He wants every B that has an A fkeyed to it.

In other words, every instance of B where b.a_set.count() > 0


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 handle forms with more than submit button

2007-08-02 Thread Kenneth Gonsalves


On 03-Aug-07, at 10:12 AM, Kenneth Gonsalves wrote:

>
>
> On 03-Aug-07, at 8:06 AM, james_027 wrote:
>
>>> create different URLs (and thus different views) for the different
>>> buttons and then redirect to wherever you want to go.
>>>
>>
>> How do I create a different URL for different buttons but under one
>> form?
>
> each submit button has a name - say 'add', 'edit', 'delete', so write
> code like:
> if 'add' in request.POST.keys():
>   do something
> if 'add' in request.POST.keys():
>   do something

oops s/add/delete/

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



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



Re: how to handle forms with more than submit button

2007-08-02 Thread Kenneth Gonsalves


On 03-Aug-07, at 8:06 AM, james_027 wrote:

>> create different URLs (and thus different views) for the different
>> buttons and then redirect to wherever you want to go.
>>
>
> How do I create a different URL for different buttons but under one
> form?

each submit button has a name - say 'add', 'edit', 'delete', so write  
code like:
if 'add' in request.POST.keys():
  do something
if 'add' in request.POST.keys():
  do something


-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



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



Re: Firebird support

2007-08-02 Thread Jacob Kaplan-Moss

On 8/2/07, james_027 <[EMAIL PROTECTED]> wrote:
> anybody here heard of firebird database? how can I get support from
> django?

This has been discussed before on django-dev; please search the archives.

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



Django and mod_proxy

2007-08-02 Thread Przemek Gawronski

Hi, I'm having some problems running Django behind an Apache with a
mod_proxy.

So my router transmits all it's communication on port 80 to 192.168.0.2,
on which I've setup mod_proxy (with django server on 192.168.1.2, the
networks see each other)


ProxyRequests On
ProxyPass /django/ http://192.168.1.2:8000/
ProxyPassReverse /django/ http://192.168.1.2:8000/


I do hit the login screen to my django app, but then all the files
(static, js,...) and sub pages aren't served properly :(

Here is a part of my urlpatterns:

urlpatterns = patterns('',
   (r'^/js/(?P.*)$', 'django.views.static.serve',{'document_root': 
'/home/django/work/fw/media/'}),
   (r'^/css/(?P.*)$', 'django.views.static.serve',{'document_root': 
'/home/django/work/fw/media/'}),
   (r'^/accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 
'/login.html'}),
   (r'^/accounts/profile/$', 'django.views.generic.simple.redirect_to', {'url': 
'/zlecenia/strona1'}),
   (r'^/$', 'django.contrib.auth.views.login', {'template_name': 
'/login.html'}),
   (r'^/wyloguj/$', 'django.contrib.auth.views.logout_then_login' ),
   (r'^/zlecenia/strona(?P[0-9]+)/$', limited_workorder_list, 
workorder_info_dict ),
...

Any one uses django behind apache with mod_proxy?

Przemek
-- 
AIKIDO TANREN DOJO  -   Poland - Warsaw - Mokotow - Ursynow - Natolin
info: http://www.tanren.pl/ phone: +4850151 email: [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: how to handle forms with more than submit button

2007-08-02 Thread Doug B

context_dict.update(button1_helper())

Opps, forgot to actually call button1_helper.  Sorry, need sleep :)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 handle forms with more than submit button

2007-08-02 Thread Doug B

> thanks doug, this is what I did, but I am not comfortable with it.
> those two button do different things, and if they're under one method
> on the views it could be ugly, what if I have 4 or 5 submit buttons?

Keep in mind there is nothing keeping one view from calling another.

def button1view(request):
   stuff

def view1(request):
   if request.POST and request.POST.has_key('button1'):
   return button1view(request)

More often I find myself doing helper functions to keep the logic
straight.

def button1_helper():
return {'button1': True}

def view1(request):
   context_dict={}
   if request.POST:
   if request.POST.has_key('button1'):
   context_dict.update(button1_helper)
   ...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 handle forms with more than submit button

2007-08-02 Thread [EMAIL PROTECTED]

Well... that's how I've been doing it anyway :)

On Aug 2, 11:15 pm, james_027 <[EMAIL PROTECTED]> wrote:
> hi,
>
> On Aug 3, 11:12 am, "[EMAIL PROTECTED]"
>
> <[EMAIL PROTECTED]> wrote:
> > Oh... forgot the semicolons after .submit(); but you get the picture
>
> thanks carole, yes I the picture. so its about javascript not
> django ...
>
> cheers,
> james


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



Re: how to handle forms with more than submit button

2007-08-02 Thread james_027

Hi,

On Aug 3, 11:21 am, Doug B <[EMAIL PROTECTED]> wrote:
> As far as I know a form submits to a single url via the action=?
> specifier.  That's just the way an html form works.  Each submit
> button that is part of the form is going to post to the action url in
> the form.  You can override with javascript, but that doesn't make
> much sense unless you're doing ajax or something.
>
> You CAN check to see which submit button was used in the view, and
> make logic decisions accordingly.  Just make sure you name your submit
> buttons and check which is in request.POST and make logic decisions
> from there.
>
> in template
> 
> 
>
> then in view
> if request.POST:
> if request.POST.has_key('button1'):
> do button 1 stuff
> elif request.POST.has_key('button2'):
> do button 2 stuff

thanks doug, this is what I did, but I am not comfortable with it.
those two button do different things, and if they're under one method
on the views it could be ugly, what if I have 4 or 5 submit buttons?

any other sugguestions?

thanks
james


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



Re: Recipe / Ingredient Model

2007-08-02 Thread Shane Graber
LOL, you don't know how often this happens to me.  :P

Shane


On 8/2/07, Lucky B <[EMAIL PROTECTED]> wrote:
>
> God, 0/2, just do what John proposed, I am not thinking straight right
> now, what I would give for an edit capability on my emails, I'll spend
> all of tonight removing my foot from my mouth.
>
> On Aug 2, 10:49 pm, Lucky B <[EMAIL PROTECTED]> wrote:
> > Ok, I've thought about it some more, and came up with 
> > this:http://dpaste.com/hold/15915/
> > It's not quite what you asked for, for your idea of the interface
> > you're gonna have to either code a QuantityField type field to merge
> > both the quantity and unit, or just write views that accommodate the
> > middle-man model. I am pretty sure that's the only way to do it, but I
> > could be wrong.
> >
> > On Aug 2, 10:29 pm, Lucky B <[EMAIL PROTECTED]> wrote:
> >
> > > ack, I missed a few things, the ingredient-quantity measure. not sure
> > > how to do that. ignore my previous message.
> >
> > > On Aug 2, 10:27 pm, Lucky B <[EMAIL PROTECTED]> wrote:
> >
> > > > You're missing just:
> > > > ingredients = models.ManyToManyField(Ingredient)
> >
> > > > In your recipe model.
> >
> > > > If you want a pretty interface in admin (if you're not using newforms-
> > > > admin) then:
> > > > ingredients = models.ManyToManyField('Ingredient',
> > > > filter_interface=models.HORIZONTAL)
> >
> > > > On Aug 2, 10:13 pm, "Shane Graber" <[EMAIL PROTECTED]> wrote:
> >
> > > > > I'm trying to make a recipe/ingredient application as my road to
> > > > > learning more about Django.  Making a model of an ingredient and most
> > > > > of the recipe are relatively straight forward based on the excellent
> > > > > tutorials on the Django.  However, I'm struggling with understanding
> > > > > how to hook in multiple ingredients into a recipe.  Here's how I have
> > > > > my model setup:
> >
> > > > >http://dpaste.com/hold/15911/
> >
> > > > > I want to be able to add in new Ingredients from the /admin section of
> > > > > Django instead of supplying it as a tuple hardcoded into my model.
> >
> > > > > When I create a Recipe, I need to have a series of rows below the
> > > > > title, description, first, last name, and pub_date section where I can
> > > > > select an Ingredient from a dropdown list and then to the right of the
> > > > > ingredient needs to be an CharField where I input how much of each
> > > > > component I need to add for that particular recipe.  It would look
> > > > > like:
> >
> > > > > Ingredient 1 2 tsp
> > > > > Ingredient 21/2 cup
> > > > > ...
> >
> > > > > Each row starting with that Ingredient dropdown list followed by a 
> > > > > CharField.
> >
> > > > > Any help on hooking this functionality into the model would be
> > > > > *greatly* appreciated.  Thanks!
> >
> > > > > Shane
>
>
> >
>


-- 
Shane  ∞  http://liquid.homelinux.org
-
Bender: "Amy, you like cute things so I baked you a pony."
-

http://www.reefs.org - Where reefkeeping begins on the internet.
http://www.advancedaquarist.com - High quality, free monthly publication for
the reef keeping hobbyist.
http://www.aquaristcourses.org - Distance learning courses for the
marine aquarist.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Recipe / Ingredient Model

2007-08-02 Thread Shane Graber

Excellent!  This is exactly what I was looking for.  Thanks for the help!

Shane


On 8/2/07, John Danks <[EMAIL PROTECTED]> wrote:
>
> On 8/2/07, Shane Graber <[EMAIL PROTECTED]> wrote:
> >
> > I'm trying to make a recipe/ingredient application as my road to
> > learning more about Django.  Making a model of an ingredient and most
> > of the recipe are relatively straight forward based on the excellent
> > tutorials on the Django.  However, I'm struggling with understanding
> > how to hook in multiple ingredients into a recipe.  Here's how I have
> > my model setup:
> >
> > http://dpaste.com/hold/15911/
> >
> > I want to be able to add in new Ingredients from the /admin section of
> > Django instead of supplying it as a tuple hardcoded into my model.
>
> Not sure if this is the best way, but it works for me: 
> http://dpaste.com/15913/
>
> Basically ingredients like chicken, onions, etc are going to be in
> lots of recipes but the quantity will be different in each. So make
> one model for each type of ingredient, and another model to combine an
> ingredient and a quantity. Then use edit_inline to make it convenient
> to edit in the admin.
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 handle forms with more than submit button

2007-08-02 Thread Doug B

As far as I know a form submits to a single url via the action=?
specifier.  That's just the way an html form works.  Each submit
button that is part of the form is going to post to the action url in
the form.  You can override with javascript, but that doesn't make
much sense unless you're doing ajax or something.

You CAN check to see which submit button was used in the view, and
make logic decisions accordingly.  Just make sure you name your submit
buttons and check which is in request.POST and make logic decisions
from there.

in template




then in view
if request.POST:
if request.POST.has_key('button1'):
do button 1 stuff
elif request.POST.has_key('button2'):
do button 2 stuff




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 handle forms with more than submit button

2007-08-02 Thread james_027

hi,

On Aug 3, 11:12 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Oh... forgot the semicolons after .submit(); but you get the picture
>

thanks carole, yes I the picture. so its about javascript not
django ...

cheers,
james


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



Re: how to handle forms with more than submit button

2007-08-02 Thread [EMAIL PROTECTED]

Oh... forgot the semicolons after .submit(); but you get the picture

On Aug 2, 11:11 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Something like this...
>
> 
> function submitFunctionA()
> {
>document.getElementById('myform').action = "someurl";
>document.getElementById('myform').submit()
>
> }
>
> function submitFunctionB()
> {
>document.getElementById('myform').action = "someotherurl";
>document.getElementById('myform').submit()}
>
> 
> 
> .
> .
> some form fields
> .
> .
> First Save Button
> .
> .
> some other stuff...
> Second Save Button
> 
>
> On Aug 2, 10:36 pm, james_027 <[EMAIL PROTECTED]> wrote:
>
> > hi
>
> > > create different URLs (and thus different views) for the different
> > > buttons and then redirect to wherever you want to go.
>
> > How do I create a different URL for different buttons but under one
> > form?
>
> > Thanks
> > james


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



Re: how to handle forms with more than submit button

2007-08-02 Thread [EMAIL PROTECTED]

Something like this...


function submitFunctionA()
{
   document.getElementById('myform').action = "someurl";
   document.getElementById('myform').submit()
}

function submitFunctionB()
{
   document.getElementById('myform').action = "someotherurl";
   document.getElementById('myform').submit()
}


.
.
some form fields
.
.
First Save Button
.
.
some other stuff...
Second Save Button


On Aug 2, 10:36 pm, james_027 <[EMAIL PROTECTED]> wrote:
> hi
>
> > create different URLs (and thus different views) for the different
> > buttons and then redirect to wherever you want to go.
>
> How do I create a different URL for different buttons but under one
> form?
>
> Thanks
> james


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



Re: Queryset of instances bound to particular ForeignKey

2007-08-02 Thread [EMAIL PROTECTED]

In model B.. if you say
modela = models.ForeignKey(ModelA)

You could also say b.modela_set.all()

On Aug 2, 8:18 pm, Lucky B <[EMAIL PROTECTED]> wrote:
> If I gather correctly you want to see every ModelA that's bound to a
> particular ModelB b?
>
> ModelA.objects.filter(modelBs=b)
>
> That gives you what you want.
>
> On Aug 2, 7:20 pm, Benjamin Goldenberg <[EMAIL PROTECTED]> wrote:
>
> > Hi everyone,
> > I asked about this earlier today on IRC and no one knew of a way to do
> > it. Basically I have a model, let's call it ModelA with a ForeignKey
> > to an instance of ModelB. I would like QuerySet of all instances of
> > ModelB that are bound to that particular ForeignKey. Does anyone have
> > any idea of how to construct such a query?
>
> > Thanks,
> > Benjamin


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



ANN: SonomaSunshine for Django v0.01

2007-08-02 Thread SamFeltus

Presented for your amusement, with source code for the first time!!!
LOL

The Redneck Riviera's Best Python Powered Folk Art Server...

SonomaSunshine v0.01 for Django

Django application for creating/editing Shiny/Happy Flash movies.

http://samfeltus.com/django/hey_yall.html


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



Re: Recipe / Ingredient Model

2007-08-02 Thread Lucky B

God, 0/2, just do what John proposed, I am not thinking straight right
now, what I would give for an edit capability on my emails, I'll spend
all of tonight removing my foot from my mouth.

On Aug 2, 10:49 pm, Lucky B <[EMAIL PROTECTED]> wrote:
> Ok, I've thought about it some more, and came up with 
> this:http://dpaste.com/hold/15915/
> It's not quite what you asked for, for your idea of the interface
> you're gonna have to either code a QuantityField type field to merge
> both the quantity and unit, or just write views that accommodate the
> middle-man model. I am pretty sure that's the only way to do it, but I
> could be wrong.
>
> On Aug 2, 10:29 pm, Lucky B <[EMAIL PROTECTED]> wrote:
>
> > ack, I missed a few things, the ingredient-quantity measure. not sure
> > how to do that. ignore my previous message.
>
> > On Aug 2, 10:27 pm, Lucky B <[EMAIL PROTECTED]> wrote:
>
> > > You're missing just:
> > > ingredients = models.ManyToManyField(Ingredient)
>
> > > In your recipe model.
>
> > > If you want a pretty interface in admin (if you're not using newforms-
> > > admin) then:
> > > ingredients = models.ManyToManyField('Ingredient',
> > > filter_interface=models.HORIZONTAL)
>
> > > On Aug 2, 10:13 pm, "Shane Graber" <[EMAIL PROTECTED]> wrote:
>
> > > > I'm trying to make a recipe/ingredient application as my road to
> > > > learning more about Django.  Making a model of an ingredient and most
> > > > of the recipe are relatively straight forward based on the excellent
> > > > tutorials on the Django.  However, I'm struggling with understanding
> > > > how to hook in multiple ingredients into a recipe.  Here's how I have
> > > > my model setup:
>
> > > >http://dpaste.com/hold/15911/
>
> > > > I want to be able to add in new Ingredients from the /admin section of
> > > > Django instead of supplying it as a tuple hardcoded into my model.
>
> > > > When I create a Recipe, I need to have a series of rows below the
> > > > title, description, first, last name, and pub_date section where I can
> > > > select an Ingredient from a dropdown list and then to the right of the
> > > > ingredient needs to be an CharField where I input how much of each
> > > > component I need to add for that particular recipe.  It would look
> > > > like:
>
> > > > Ingredient 1 2 tsp
> > > > Ingredient 21/2 cup
> > > > ...
>
> > > > Each row starting with that Ingredient dropdown list followed by a 
> > > > CharField.
>
> > > > Any help on hooking this functionality into the model would be
> > > > *greatly* appreciated.  Thanks!
>
> > > > Shane


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Recipe / Ingredient Model

2007-08-02 Thread Lucky B

Ok, I've thought about it some more, and came up with this:
http://dpaste.com/hold/15915/
It's not quite what you asked for, for your idea of the interface
you're gonna have to either code a QuantityField type field to merge
both the quantity and unit, or just write views that accommodate the
middle-man model. I am pretty sure that's the only way to do it, but I
could be wrong.

On Aug 2, 10:29 pm, Lucky B <[EMAIL PROTECTED]> wrote:
> ack, I missed a few things, the ingredient-quantity measure. not sure
> how to do that. ignore my previous message.
>
> On Aug 2, 10:27 pm, Lucky B <[EMAIL PROTECTED]> wrote:
>
> > You're missing just:
> > ingredients = models.ManyToManyField(Ingredient)
>
> > In your recipe model.
>
> > If you want a pretty interface in admin (if you're not using newforms-
> > admin) then:
> > ingredients = models.ManyToManyField('Ingredient',
> > filter_interface=models.HORIZONTAL)
>
> > On Aug 2, 10:13 pm, "Shane Graber" <[EMAIL PROTECTED]> wrote:
>
> > > I'm trying to make a recipe/ingredient application as my road to
> > > learning more about Django.  Making a model of an ingredient and most
> > > of the recipe are relatively straight forward based on the excellent
> > > tutorials on the Django.  However, I'm struggling with understanding
> > > how to hook in multiple ingredients into a recipe.  Here's how I have
> > > my model setup:
>
> > >http://dpaste.com/hold/15911/
>
> > > I want to be able to add in new Ingredients from the /admin section of
> > > Django instead of supplying it as a tuple hardcoded into my model.
>
> > > When I create a Recipe, I need to have a series of rows below the
> > > title, description, first, last name, and pub_date section where I can
> > > select an Ingredient from a dropdown list and then to the right of the
> > > ingredient needs to be an CharField where I input how much of each
> > > component I need to add for that particular recipe.  It would look
> > > like:
>
> > > Ingredient 1 2 tsp
> > > Ingredient 21/2 cup
> > > ...
>
> > > Each row starting with that Ingredient dropdown list followed by a 
> > > CharField.
>
> > > Any help on hooking this functionality into the model would be
> > > *greatly* appreciated.  Thanks!
>
> > > Shane


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Firebird support

2007-08-02 Thread james_027

Hi,

anybody here heard of firebird database? how can I get support from
django?

Thanks
james


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



Re: how to handle forms with more than submit button

2007-08-02 Thread james_027

hi


> create different URLs (and thus different views) for the different
> buttons and then redirect to wherever you want to go.
>

How do I create a different URL for different buttons but under one
form?

Thanks
james


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



Re: Recipe / Ingredient Model

2007-08-02 Thread John Danks

On 8/2/07, Shane Graber <[EMAIL PROTECTED]> wrote:
>
> I'm trying to make a recipe/ingredient application as my road to
> learning more about Django.  Making a model of an ingredient and most
> of the recipe are relatively straight forward based on the excellent
> tutorials on the Django.  However, I'm struggling with understanding
> how to hook in multiple ingredients into a recipe.  Here's how I have
> my model setup:
>
> http://dpaste.com/hold/15911/
>
> I want to be able to add in new Ingredients from the /admin section of
> Django instead of supplying it as a tuple hardcoded into my model.

Not sure if this is the best way, but it works for me: http://dpaste.com/15913/

Basically ingredients like chicken, onions, etc are going to be in
lots of recipes but the quantity will be different in each. So make
one model for each type of ingredient, and another model to combine an
ingredient and a quantity. Then use edit_inline to make it convenient
to edit in the admin.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Recipe / Ingredient Model

2007-08-02 Thread Lucky B

ack, I missed a few things, the ingredient-quantity measure. not sure
how to do that. ignore my previous message.

On Aug 2, 10:27 pm, Lucky B <[EMAIL PROTECTED]> wrote:
> You're missing just:
> ingredients = models.ManyToManyField(Ingredient)
>
> In your recipe model.
>
> If you want a pretty interface in admin (if you're not using newforms-
> admin) then:
> ingredients = models.ManyToManyField('Ingredient',
> filter_interface=models.HORIZONTAL)
>
> On Aug 2, 10:13 pm, "Shane Graber" <[EMAIL PROTECTED]> wrote:
>
> > I'm trying to make a recipe/ingredient application as my road to
> > learning more about Django.  Making a model of an ingredient and most
> > of the recipe are relatively straight forward based on the excellent
> > tutorials on the Django.  However, I'm struggling with understanding
> > how to hook in multiple ingredients into a recipe.  Here's how I have
> > my model setup:
>
> >http://dpaste.com/hold/15911/
>
> > I want to be able to add in new Ingredients from the /admin section of
> > Django instead of supplying it as a tuple hardcoded into my model.
>
> > When I create a Recipe, I need to have a series of rows below the
> > title, description, first, last name, and pub_date section where I can
> > select an Ingredient from a dropdown list and then to the right of the
> > ingredient needs to be an CharField where I input how much of each
> > component I need to add for that particular recipe.  It would look
> > like:
>
> > Ingredient 1 2 tsp
> > Ingredient 21/2 cup
> > ...
>
> > Each row starting with that Ingredient dropdown list followed by a 
> > CharField.
>
> > Any help on hooking this functionality into the model would be
> > *greatly* appreciated.  Thanks!
>
> > Shane


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Recipe / Ingredient Model

2007-08-02 Thread Lucky B

You're missing just:
ingredients = models.ManyToManyField(Ingredient)

In your recipe model.

If you want a pretty interface in admin (if you're not using newforms-
admin) then:
ingredients = models.ManyToManyField('Ingredient',
filter_interface=models.HORIZONTAL)

On Aug 2, 10:13 pm, "Shane Graber" <[EMAIL PROTECTED]> wrote:
> I'm trying to make a recipe/ingredient application as my road to
> learning more about Django.  Making a model of an ingredient and most
> of the recipe are relatively straight forward based on the excellent
> tutorials on the Django.  However, I'm struggling with understanding
> how to hook in multiple ingredients into a recipe.  Here's how I have
> my model setup:
>
> http://dpaste.com/hold/15911/
>
> I want to be able to add in new Ingredients from the /admin section of
> Django instead of supplying it as a tuple hardcoded into my model.
>
> When I create a Recipe, I need to have a series of rows below the
> title, description, first, last name, and pub_date section where I can
> select an Ingredient from a dropdown list and then to the right of the
> ingredient needs to be an CharField where I input how much of each
> component I need to add for that particular recipe.  It would look
> like:
>
> Ingredient 1 2 tsp
> Ingredient 21/2 cup
> ...
>
> Each row starting with that Ingredient dropdown list followed by a CharField.
>
> Any help on hooking this functionality into the model would be
> *greatly* appreciated.  Thanks!
>
> Shane


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 handle forms with more than submit button

2007-08-02 Thread Lucky B

create different URLs (and thus different views) for the different
buttons and then redirect to wherever you want to go.

On Aug 2, 10:13 pm, james_027 <[EMAIL PROTECTED]> wrote:
> Hi,
>
> How do I handle this situation wherein I want different submit button
> to call different method on the views. I feel that calling the same
> method on views for all the submit button on a form is not good, as
> you'll make the distinction of what to do inside the method...
>
> Thanks
> james


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



Enjoy it !

2007-08-02 Thread goldcompany

Enjoy it !
1) http://www.mmopawn.com
2) http://www.mmopawn.com
3) http://www.mmopawn.com
4) http://www.mmopawn.com
5) http://www.mmopawn.com
6) http://www.mmopawn.com
7) http://www.mmopawn.com

 a good site about world of warcraft -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Recipe / Ingredient Model

2007-08-02 Thread Shane Graber

I'm trying to make a recipe/ingredient application as my road to
learning more about Django.  Making a model of an ingredient and most
of the recipe are relatively straight forward based on the excellent
tutorials on the Django.  However, I'm struggling with understanding
how to hook in multiple ingredients into a recipe.  Here's how I have
my model setup:

http://dpaste.com/hold/15911/

I want to be able to add in new Ingredients from the /admin section of
Django instead of supplying it as a tuple hardcoded into my model.

When I create a Recipe, I need to have a series of rows below the
title, description, first, last name, and pub_date section where I can
select an Ingredient from a dropdown list and then to the right of the
ingredient needs to be an CharField where I input how much of each
component I need to add for that particular recipe.  It would look
like:

Ingredient 1 2 tsp
Ingredient 21/2 cup
...

Each row starting with that Ingredient dropdown list followed by a CharField.

Any help on hooking this functionality into the model would be
*greatly* appreciated.  Thanks!

Shane

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 forms with more than submit button

2007-08-02 Thread james_027

Hi,

How do I handle this situation wherein I want different submit button
to call different method on the views. I feel that calling the same
method on views for all the submit button on a form is not good, as
you'll make the distinction of what to do inside the method...

Thanks
james


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



Job Fair F/OSS project

2007-08-02 Thread [EMAIL PROTECTED]

I'm looking for some volunteers for a new open source project. At the
Institute of Design (http://www.id.iit.edu ), our next project is a
system for the management of our job fair (http://www.id.iit.edu/
recruitID/ )

The systems goal is to allow students and employers to enter their
availability for interviews and have the system designate times and
rooms for each to meet for interviews. The system includes much more
than just this of course, but that is the main goal. We decided that
this application is generic enough that it should be made into an F/
OSS project.

So far the system will be built on Django and uses (hopefully)
Prototype.js

I've only really been using Django for a month now so anyone with real
experience would be appreciated.

The project is on the ground floor and some basic wire frames and a
few other preliminary designs.

I'm personally located in Chicago and West Virginia (about half of my
time spent in each place), though you are welcome to help out from
anywhere around the world!

If you're interested, reply to this message, or contact me at cezar AT
id.iit.edu


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: value for choices arguments for newforms.MultipleSelectField

2007-08-02 Thread Kai Kuehne

Hi,

On 8/3/07, james_027 <[EMAIL PROTECTED]> wrote:
> I don't see ModelMultipleChoiceField on the documentaion or the latest
> source code

You can look at
http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py

till the documenation is updated.

> Thanks
> james

Kai

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: value for choices arguments for newforms.MultipleSelectField

2007-08-02 Thread james_027

H

On Aug 2, 11:35 pm, Nathan Ostgard <[EMAIL PROTECTED]> wrote:
> You can use ModelMultipleChoiceField for this:
>
> items =
> newforms.ModelMultipleChoiceField(queryset=Items.objects.all())
>

I don't see ModelMultipleChoiceField on the documentaion or the latest
source code

Thanks
james


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



Re: website template compatible with django

2007-08-02 Thread Kenneth Gonsalves


On 01-Aug-07, at 12:32 PM, Ben wrote:

> I am a total Django newbie.  Hence the probably silly questions:
> There are professional-looking website templates for sale in several
> places (templatemonster, etc).
> Can those be used easily with Django ?

yes

> Do they need to be designed specifically for Django ?

no

> Do you know of
> any vendor that does it ?
> If not, what to look for in a template order to make sure it will be
> relatively easy to use with Django ?

the template part is completely independant of the rest of django -  
any template that follows the principles of good HTML design using  
css, javascript, ajax or whatever will work with Django - even bad  
design will work. The more modular the design of the template, the  
better - but again that is not django specific.

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



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



Re: Using limit_choices_to on a ManyToMany Field

2007-08-02 Thread Russell Keith-Magee

On 8/3/07, Greg <[EMAIL PROTECTED]> wrote:
>
> Come onI know that somebody can figure this out

Greg - seriously, it's been 6 hours since your original message. Give
people a chance to _read_ your message before you complain about the
fact that nobody has answered.

Yours,
Russ Magee %-)

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



Re: Queryset of instances bound to particular ForeignKey

2007-08-02 Thread Lucky B

If I gather correctly you want to see every ModelA that's bound to a
particular ModelB b?

ModelA.objects.filter(modelBs=b)

That gives you what you want.

On Aug 2, 7:20 pm, Benjamin Goldenberg <[EMAIL PROTECTED]> wrote:
> Hi everyone,
> I asked about this earlier today on IRC and no one knew of a way to do
> it. Basically I have a model, let's call it ModelA with a ForeignKey
> to an instance of ModelB. I would like QuerySet of all instances of
> ModelB that are bound to that particular ForeignKey. Does anyone have
> any idea of how to construct such a query?
>
> Thanks,
> Benjamin


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Queryset of instances bound to particular ForeignKey

2007-08-02 Thread Benjamin Goldenberg

Hi everyone,
I asked about this earlier today on IRC and no one knew of a way to do
it. Basically I have a model, let's call it ModelA with a ForeignKey
to an instance of ModelB. I would like QuerySet of all instances of
ModelB that are bound to that particular ForeignKey. Does anyone have
any idea of how to construct such a query?

Thanks,
Benjamin


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 limit_choices_to on a ManyToMany Field

2007-08-02 Thread Greg

Come onI know that somebody can figure this out

sandp = models.ManyToManyField(Choice, limit_choices_to =
{'choice__id': self.collection.id})

What do I need to get the collection id?  Will 'self.collection.id'
work?

I forgot to add my collection class.  Here it is:

class Collection(models.Model):
name = models.CharField(maxlength=200)
collectionslug = models.SlugField(prepopulate_from=["name"])
description = models.TextField(maxlength=1000)
manufacturer = models.ForeignKey(Manufacturer)


Thanks for your help



On Aug 2, 1:23 pm, Greg <[EMAIL PROTECTED]> wrote:
> I've looked everywhere for information on how to use the
> 'limit_choices_to' attribute...but can't seem to find the answer.
>
> I have the following models:
>
> class Choice(models.Model):
> choice = models.ForeignKey(Collection, edit_inline=models.TABULAR,
> num_in_admin=5)
> size = models.ForeignKey(Size, core=True)
> price = models.ForeignKey(Price, core=True)
>
> def __str__(self,):
> return str((self.size, self.price))
>
> class Style(models.Model):
> name = models.CharField(maxlength=200, core=True)
> color = models.CharField(maxlength=100)
> image = models.ImageField(upload_to='site_media/')
> theslug = models.SlugField(prepopulate_from=('name',))
> manufacturer = models.ForeignKey(Manufacturer)
> sandp = models.ManyToManyField(Choice, limit_choices_to =
> {'choice__id': self.collection.id})
> collection = models.ForeignKey(Collection,
> edit_inline=models.TABULAR, num_in_admin=6)
>
> def __str__(self,):
> return self.name
>
> //
>
> Notice my sandp field in my Style class.  We'll it contains the
> limit_choices_to attribute.  Everything works fine When I have:
>
> sandp = models.ManyToManyField(Choice, limit_choices_to =
> {'choice__id': 2})
>
> It returns only the rows that contain 2 in the choice_id field
>
> /
>
> However, I need that '2' to do be dynamic.  I'm not sure how to do
> this.  I tried 'self.collection.id' but that does not work.  I need to
> be able to get what ever the id is for the collection that the style
> is tied to.
>
> //
>
> I've looked at all the documentation and I can't seem to find the
> answer.  Any help would GREATLY be appreciated.
>
> 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: OR a Q object - Problem with ManyToMany relationships?

2007-08-02 Thread Nowell

I believe that this is due to the fact that the last Q is performing
an INNER JOIN on the Authors table, and therefore is excluding all
records that do not have an entry in your (what I assume is a)
ManyToManyField/ForeignKey.

On Aug 2, 5:37 pm, LaundroMat <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Suppose I have defined the models from the django documentation
> (http://www.djangoproject.com/documentation/db-api/).
>
> I'm performing a search the entries model, and I want to look through
> all of its fields:
>
> from django.db.models import Q
> query =
> 'querystring' #
> User supplied querystring, eg "Lawrence"
> lookup = Q(headline__icontains = querystring) | \
> Q(body_text__icontains = querystring) | \
> Q(authors__name__icontains = querystring)
>
> p = Prediction.objects.filter(lookup).distinct()
>
> The models I have built are more complex than the above, but the gist
> is the same. For one reason or another, I get more results when I
> leave out the last Q object (the one looking through the authors'
> names) than when I leave it in. This shouldn't be happening, as all Q
> objects are being OR'ed.
>
> I hope I've given enough information for you to try and simulate my
> problem, and perchance find a solution for it. Many thanks in advance
> already.
>
> Mathieu


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Newforms w/ *dynamic* ChoiceField choices?

2007-08-02 Thread rskm1

Newforms has a spiffy way to dynamically set the "initial" values of
fields, in the view code when the Form is constructed.
  choosecolorform = ChooseColorForm(initial={'color': 'black'})

I was hoping it would be just as easy to dynamically define the
choices available in a ChoiceField, too... but no such luck.

The choices in my ChoiceField will ultimately come from a database,
and will vary based on user permissions and/or the state of the page
that the form is being displayed on, etc.  For a contrived example,
consider paint-color choices that will depend on whether the form is
on a page displaying a metal object that takes enamel, or a wooden
object that takes latex paint.

I'd rather not make my Form be "aware" of my database, or the page
it's on, because that seems like poor encapsulation and probably a
violation of the DRY principle (I'm just going on intuition here,
though).

So here's what I'm doing, to allow my view to dynamically tweak the
choices:

myforms.py:
from django import newforms as forms

class ChooseColorForm(forms.Form):
  color = forms.ChoiceField(initial="unpainted", choices =
[("unpainted", "Don't paint it"),], label="Choose a color")

  def setchoices(self, choices):
field = None
for item in self.fields.items():
  if item[0]=="color":
field = item[1]
if field:
  field.choices = choices
  field.initial = choices[0][0]
else:
  print "INTERNAL ERROR! No color field found on ChooseColorForm
object"
# /class ChooseColorForm


views.py:
from myforms import ChooseColorForm
def remodelthingypage(httpreq):
  # ...
  choosecolorform = ChooseColorForm()
  if thingy.ismetal:
choosecolorform.setchoices(_getenamelpaintcolors(sa))
  else:
choosecolorform.setchoices(_getlatexpaintcolors(sa))
  return _respond(httpreq, 'remodeling.html', { 'thingy': thingy,
'choosecolorform': choosecolorform, })
# /remodelthingypage()


* NOTE: For my contrived example, I could obviously just make two Form
subclasses, one for latex paints and another for enamels, but the
actual scenario is more complicated and there are other factors
involved in determining the available choices, such as whether there's
enough of that color in stock to cover the whole thingy or not.


So anyway, this technique WORKS -- but I'm a bit tentative about it
because:
a) I'm still a Django *AND* a Python novice, and
b) I had to dig around in the newforms code to figure out how to ram
my own choices into the form object, which is dangerous because
there's no private/protected to warn me not to screw around with that,
AND my code is now tied to the internal implementation of newforms.

Afterwards, I found a blog entry that does something similar,
http://www.zoia.org/blog/2007/04/23/using-dynamic-choices-with-django-newforms-and-custom-widgets/
but it uses:
  Form.base_fields['tags'].choices
rather than my:
  Form.fields.items()[x][1].choices
That makes my goofy for-loop unnecessary, but I'm not sure what the
implications of each are (too lazy to analyze all the newforms code,
plus I wanted to ask anyway, because I don't know what the plans/
vision for newforms is)

So, are there better techniques for dynamically setting the choices in
a newforms ChoiceField?  (Or, is my whole approach dumb.?)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: ModelMultipleChoiceField doesn't do initial selection

2007-08-02 Thread Kai Kuehne

Forgot something:
I could print the form manually and not use form.as_table(). So I
can left out the fields I don't want. I think this is ok in this case.

Thanks!
Kai

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



schema evolution [testers wanted]

2007-08-02 Thread Derek Anderson

hey all,

i have finished writing unit tests covering the mysql, postgresql and 
sqlite3 backends, as well as notably expanding what 
introspections/migrations the sqlite3 backend can handle.  also, full 
documentation (including installation and usage instructions) is 
available both in the branch and here:

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

additionally, the latest changes from the trunk (r5787) have been merged 
into the schema-evolution branch, so you won't lose any recent updates 
by giving it a shot.

obviously, this is an area with a lot of corner cases.  if you can, 
please give it a shot ("./manage sqlevolve app_name" after you've made a 
model change) and send me whatever bugs you find [EMAIL PROTECTED] 
please include if you can:

  * which database you're using
  * your models.py file
  * your previous models.py and/or your existing database schema

thanks!
derek anderson



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: ModelMultipleChoiceField doesn't do initial selection

2007-08-02 Thread Kai Kuehne

Hi Lucky,

On 8/2/07, Lucky B <[EMAIL PROTECTED]> wrote:
>
> I think you should be using form_for_instance on the dvd instance
> instead of the generic form contructor.
> http://www.djangoproject.com/documentation/newforms/#form-for-instance

This works, and this is the way I had it first. But I don't
want to display all fields of the model. That's why I created a form
containing just a few fields of the model.

Unfortunately I cannot delete fields out of a form created with
form_for_instance:
: 'DVDInstanceForm' object does not
support item deletion

Thanks,
Kai

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: remember me feature

2007-08-02 Thread SH

> is implementing remember me feature for login is as simple as changing
> the cookies settings in the settings.py? is manipulating of setting.py
> allowed in views?
>

I just incorporated the DualSessionMiddleware into my project. It does
what it says, and didn't break any of my other 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?hl=en
-~--~~~~--~~--~--~---



Re: create_or_update() shortcut

2007-08-02 Thread Nathaniel Whiteinge

On Aug 2, 3:01 am, Jens Diemer <[EMAIL PROTECTED]> wrote:
> We have the shortcut get_or_create() [1], but whats about a 
> create_or_update() ?

One exists as a patch_. I've been using it with the current svn for a
while without problems. I find that an update_or_create() shortcut is
particularly helpful working with newforms and use it in quite a few
places. The patch gets pinged every so often [1]_; it will likely make
it into trunk eventually.

.. patch: http://code.djangoproject.com/ticket/3182
.. [1] 
http://groups.google.com/group/django-developers/search?group=django-developers=3182

- 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: Trigger a django user password change...

2007-08-02 Thread RajeshD



>
> Any better ideas?

You could also use the pre_save signal in your first solution (instead
of post_save). That will give you the new password before it's saved
to the DB. So, you can pull up that user's DB User object and compare
the two passwords. Of course, and send a message to the user. Of
course, your message may be misleading if the subsequent save of the
current instance actually fails for any reason.


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



Re: Django equivalent of ROR flash

2007-08-02 Thread SH

I haven't tried it myself, but check out:

http://www.djangosnippets.org/snippets/331/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Trigger a django user password change...

2007-08-02 Thread RajeshD


>
> One idea is this:
>
> ===-
>
> old_passwords = {}
> def save_old_pass(sender, instance, signal, *args, **kwargs):
>  user_obj = instance
>  old_pass = user_obj.password
>  old_passwords[user_obj] = old_pass
>

>
> dispatcher.connect(save_old_pass, signal=signals.post_init, sender=User)
> dispatcher.connect(update, signal=signals.post_save, sender=User)
>
>
> This works, but save_old_pass() would be often called, if the user is logged 
> in.
> So it's not a really good idea.

It's also not a good idea to end up caching all your users' passwords
in the old_passwords dictionary like that.

>
> Any better ideas?

Create a custom view to allow your users to change just their
password. In that view, you will be able to tell in a straightforward
fashion if the user has changed her password and take action
accordingly.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 - passing form data in sessions - Trouble with ForeignKey

2007-08-02 Thread RajeshD


> But I run into trouble when saving in sessions via clean_data and then
> trying to initiate a newform with the saved clean_data. This occurs
> only when ForeignKeys are in the Game.
>
> This is probably due to the nature foreignkeys are stored as an object
> in clean_data (see below).

Correct. ModelChoiceField's clean_data results in the corresponding
related object instance and not its id.

That makes your form.clean_data a dictionary that can not be used to
instantiate a new form.

What is the flow of your 3 screens? Are you populating a single form
partially through each of three form submits? Do you need the
clean_data at each step (for example, are you validating on each
screen or only on the final screen)?

You could store a copy of request.POST into your session instead of
form.clean_data. Then at each stage you get the current
request.POST.copy() and update it with the session's stored
request.POST.copy() and use that merged dictionary to instantiate that
stage's form. I am sure that there are other ways to skin this one
once you tell us a bit more about the flow you are looking to design.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Admin & Models

2007-08-02 Thread Rohit

Thanks Nathan. I think this solves one part of my problem. Also just
for reference, the method should be modified as so:

def company(self):
  return self.sub_dept.dept.company

and so on. The exclusion of self, leads Django to look for a global
named "sub_dept".

Any idea how I can add company to 'list_filter'?



On Aug 2, 10:27 am, Nathan Ostgard <[EMAIL PROTECTED]> wrote:
> list_display can use functions as their value... so, you can have:
>
> class Employee(models.Model):
>   sub_dept = ForeignKey(SubDept)
>
>   def company(self):
> return sub_dept.dept.company
>
>   def dept(self):
> return sub_dept.dept
>
>   class Admin:
> list_display = ('first_name, 'last_name', 'company', 'dept',
> 'sub_dept')
>
> On Aug 1, 3:16 pm, Rohit <[EMAIL PROTECTED]> wrote:
>
> > Actually my question is two fold, most likely due to brain farts on my
> > end. I'm relatively a newbie to Django, so please bear with me.
>
> > Here's my scenario. I have this for my relationships:
> > Company->Dept->Sub-Dept->Employees->Roles
> > "->" represents a one-to-many relationship.
>
> > Problem #1:
>
> > If I do something like this:
> > Class Company(models.Model):
> >  name...
>
> > Class Dept(models.Model):
> > company = ForeignKey(Company)
> > name...
>
> > Class Sub-Dept(models.Model):
> > dept = ForeignKey(Dept)
> > name...
>
> > Class Employee(models.Model):
> > sub-dept = ForeignKey(Sub-Dept)
> > first_name...
>
> > Class Admin:
> > list_display = ( 'first_name', 'last_name', 'sub-dept', )
>
> > The problem is when I go into the admin screen and view employees,
> > there is no way of displaying the company and dept. info next to the
> > name of the employee. How can I accomplish that?
>
> > Problem #2:
> > This kinda arises from my efforts trying to fix Problem #1.
>
> > I changed my code like so:
>
> > .
> > .
> > Class Employee(models.Model):
> > company = ForeignKey(Company)
> > dept= ForeignKey(Dept)
> > sub-dept  = ForeignKey(Sub-Dept)
> > first_name...
>
> > Class Admin:
> > list_display = ( 'first_name', 'last_name', 'company', 'dept',
> > 'sub-dept', )
>
> > Now the problem is when I add an employee, I have to add some kind of
> > validation to the admin interface that checks whether the sub-dept,
> > dept and company match. My main issue is where can I add this
> > validation so that it is reflected in the admin interface?
>
> > Thanks in advance for the pointers.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Internationalization and accents

2007-08-02 Thread Ramiro Morales

On 8/2/07, Jonas <[EMAIL PROTECTED]> wrote:
>
> There seems to have a bug with the internationalization.
> When the (result) translated string has accents, that is the "msgstr"
> in the .po file, there is no problem.
>
> But when the string TO BE translated has accents, that is the "msgid"
> in the .po file, no substitution occurs in the translated page.
>
> Has anybody else experienced this? I think that's a real nuisance: why
> should the original language be English?
>
> I have already mentionned, with more details,  the problem in the
> subject "Accents in translation strings", but there was no answer, so
> I repeat it.
>

Have you also tried searching the archives or Trac?.

Are you encoding your .po file in UTF-8? That's a condition to
be able to use non ASCII msgid's.

Also, you should be using a recent SVN checkout for this to work.

See:

http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#POfilesmustbeUTF-8encoded

changesets: 5708,
tickets: 4734, 4899

Regards,

-- 
 Ramiro Morales

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



Newforms - passing form data in sessions - Trouble with ForeignKey

2007-08-02 Thread MichaelMartinides

Dear all,

I have a very simple 3 page ordering process for a small online shop.

I would like to pass data from the pages via sessions.

But I run into trouble when saving in sessions via clean_data and then
trying to initiate a newform with the saved clean_data. This occurs
only when ForeignKeys are in the Game.

This is probably due to the nature foreignkeys are stored as an object
in clean_data (see below).

Is there a way around this? (eg Store id as an integer only)

Thanks for any help in advance!
  >>Michael

Session:
>>> from shop.models import OrderForm
>>> import datetime
>>> d = {'date':datetime.datetime(2007,8,2,19,30,47), 'customer': 1,'coffee':1}
>>> b = OrderForm(d)
>>> b.is_valid()
True
>>> b.clean_data
{'date': datetime.datetime(2007, 8, 2, 19, 30, 47), 'customer':
, 'coffee': }
>>> o = b.save()
>>> o

>>> o.id
4
>>> sessionvariable = b.clean_data
>>> c = OrderForm(sessionvariable)
>>> c

>>> c.save()
Traceback (most recent call last):
  File "", line 1, in ?
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\newforms\models.py", line 21, in model_save
if self.errors:
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\newforms\forms.py", line 90, in _errors
self.full_clean()
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\newforms\forms.py", line 177, in full_clean
value = field.clean(value)
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\newforms\models.py", line 162, in clean
value = self.queryset.model._default_manager.get(pk=value)
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\db\models\manager.py", line 73, in get
return self.get_query_set().get(*args, **kwargs)
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\db\models\query.py", line 250, in get
obj_list = list(clone)
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\db\models\query.py", line 108, in __iter__
return iter(self._get_data())
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\db\models\query.py", line 470, in _get_data
self._result_cache = list(self.iterator())
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\db\models\query.py", line 183, in iterator
cursor.execute("SELECT " + (self._distinct and "DISTINCT " or "")
+ ",".join
(select) + sql, params)
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\db\backends\util.py", line 12, in execute
return self.cursor.execute(sql, params)
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\db\backends\sqlite3\base.py", line 93, in execute
return Database.Cursor.execute(self, query, params)
InterfaceError: Error binding parameter 0 - probably unsupported type.
>>> c

>>> c.is_valid()
Traceback (most recent call last):
  File "", line 1, in ?
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\newforms\forms.py", line 99, in is_valid
return self.is_bound and not bool(self.errors)
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\newforms\forms.py", line 90, in _errors
self.full_clean()
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\newforms\forms.py", line 177, in full_clean
value = field.clean(value)
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\newforms\models.py", line 162, in clean
value = self.queryset.model._default_manager.get(pk=value)
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\db\models\manager.py", line 73, in get
return self.get_query_set().get(*args, **kwargs)
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\db\models\query.py", line 250, in get
obj_list = list(clone)
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\db\models\query.py", line 108, in __iter__
return iter(self._get_data())
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\db\models\query.py", line 470, in _get_data
self._result_cache = list(self.iterator())
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\db\models\query.py", line 183, in iterator
cursor.execute("SELECT " + (self._distinct and "DISTINCT " or "")
+ ",".join
(select) + sql, params)
  File "C:\Dokumente und Einstellungen\de1763\Program Files
\Python24\Lib\site-pa
ckages\django\db\backends\util.py", line 12, in execute
return 

Re: Internationalization and accents

2007-08-02 Thread Chris Hoeppner

That's not a bug ;)

You should avoid using non-ascii chars in msgid strings. This has
nothing to do with Django, but with gettext (the "translation" engine
behind the scene) itself. There's no point in using non-ascii chars
anyways, since msgid strings are thought to be message identifiers,
not actual human-understandable strings. Just placeholders. Though
using the actual words to be translated eases the job a lot.

Also, keep an eye out for entries marked as "fuzzy" as they won't be
used by gettext.

2007/8/2, Jonas <[EMAIL PROTECTED]>:
>
> There seems to have a bug with the internationalization.
> When the (result) translated string has accents, that is the "msgstr"
> in the .po file, there is no problem.
>
> But when the string TO BE translated has accents, that is the "msgid"
> in the .po file, no substitution occurs in the translated page.
>
> Has anybody else experienced this? I think that's a real nuisance: why
> should the original language be English?
>
> I have already mentionned, with more details,  the problem in the
> subject "Accents in translation strings", but there was no answer, so
> I repeat it.
>
> Jonas
>
>
> >
>


-- 
Best Regards,
Chris Hoeppner - www.pixware.org // My weblog

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 limit_choices_to on a ManyToMany Field

2007-08-02 Thread Greg

I've looked everywhere for information on how to use the
'limit_choices_to' attribute...but can't seem to find the answer.

I have the following models:

class Choice(models.Model):
choice = models.ForeignKey(Collection, edit_inline=models.TABULAR,
num_in_admin=5)
size = models.ForeignKey(Size, core=True)
price = models.ForeignKey(Price, core=True)

def __str__(self,):
return str((self.size, self.price))

class Style(models.Model):
name = models.CharField(maxlength=200, core=True)
color = models.CharField(maxlength=100)
image = models.ImageField(upload_to='site_media/')
theslug = models.SlugField(prepopulate_from=('name',))
manufacturer = models.ForeignKey(Manufacturer)
sandp = models.ManyToManyField(Choice, limit_choices_to =
{'choice__id': self.collection.id})
collection = models.ForeignKey(Collection,
edit_inline=models.TABULAR, num_in_admin=6)

def __str__(self,):
return self.name

//

Notice my sandp field in my Style class.  We'll it contains the
limit_choices_to attribute.  Everything works fine When I have:

sandp = models.ManyToManyField(Choice, limit_choices_to =
{'choice__id': 2})

It returns only the rows that contain 2 in the choice_id field

/

However, I need that '2' to do be dynamic.  I'm not sure how to do
this.  I tried 'self.collection.id' but that does not work.  I need to
be able to get what ever the id is for the collection that the style
is tied to.

//

I've looked at all the documentation and I can't seem to find the
answer.  Any help would GREATLY be appreciated.

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



Internationalization and accents

2007-08-02 Thread Jonas

There seems to have a bug with the internationalization.
When the (result) translated string has accents, that is the "msgstr"
in the .po file, there is no problem.

But when the string TO BE translated has accents, that is the "msgid"
in the .po file, no substitution occurs in the translated page.

Has anybody else experienced this? I think that's a real nuisance: why
should the original language be English?

I have already mentionned, with more details,  the problem in the
subject "Accents in translation strings", but there was no answer, so
I repeat it.

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



Re: Count the times a user has logged into the system

2007-08-02 Thread Chris Hoeppner

Seems a bit hacky actually. But if there's no other way...

Thanks a lot Mackenzie!

2007/8/2, Mackenzie Kearl <[EMAIL PROTECTED]>:
>
> you can just create a profile with a field number of times logged in.
> This could be updated in a custom login view that you write.
>
> check out http://www.djangobook.com/en/beta/chapter12/
>
> def login(request):
> username = request.POST['username']
> password = request.POST['password']
> user = auth.authenticate(username=username, password=password)
> if user is not None and user.is_active:
> # Correct password, and the user is marked "active"
> auth.login(request, user)
> # Redirect to a success page.
> return HttpResponseRedirect("/account/loggedin/")
> else:
> # Show an error page
> return HttpResponseRedirect("/account/invalid/")
>
>
> >
>


-- 
Best Regards,
Chris Hoeppner - www.pixware.org // My weblog

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 selected value set in newforms

2007-08-02 Thread Nis Jørgensen

[EMAIL PROTECTED] skrev:
> I think the problem is related to passing the resultsdict dictionary to the 
> DisplayForms.
> Once, I did not pass in the dictionary then the initial value works.
>   
Yes. Passing in values creates a bound form. Initial data are used only
for unbound forms.  I think the documentation is quite specific on that
issue:

"""
The initial argument lets you specify the initial value to use when
rendering this Field in an unbound Form.

...
This is why initial values are only displayed for unbound forms. For
bound forms, the HTML output will use the bound data.

Also note that initial values are /not/ used as "fallback" data in
validation if a particular field's value is not given. initial values
are /only/ intended for initial form display:
"""

Nis


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Admin & Models

2007-08-02 Thread Nis Jørgensen

Nathan Ostgard skrev:
> list_display can use functions as their value... so, you can have:
>
> class Employee(models.Model):
>   sub_dept = ForeignKey(SubDept)
>
>   def company(self):
> return sub_dept.dept.company
>
>   def dept(self):
> return sub_dept.dept
>
>   class Admin:
> list_display = ('first_name, 'last_name', 'company', 'dept',
> 'sub_dept')
>   

My guess is that the poster wanted this info available on the page for
an individual employee, not the list. At least that is what I need (and
haven't found an easy way of doing).

Nis

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Count the times a user has logged into the system

2007-08-02 Thread Mackenzie Kearl

you can just create a profile with a field number of times logged in.
This could be updated in a custom login view that you write.

check out http://www.djangobook.com/en/beta/chapter12/

def login(request):
username = request.POST['username']
password = request.POST['password']
user = auth.authenticate(username=username, password=password)
if user is not None and user.is_active:
# Correct password, and the user is marked "active"
auth.login(request, user)
# Redirect to a success page.
return HttpResponseRedirect("/account/loggedin/")
else:
# Show an error page
return HttpResponseRedirect("/account/invalid/")


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: 404 for date-based generic views--Help!

2007-08-02 Thread Drasty

I should also note that adding
 allow_future=True
results in the same 404 error. (I'm also testing with data with dates
in 2006, so "TIME_ZONE" in settings.py shouldn't be a contributing
factor, even though I'm using the "correct" designation for where I
am.)

On Aug 2, 11:42 am, Mackenzie Kearl <[EMAIL PROTECTED]>
wrote:
> You should put some template code up as well i know that I recently
> could not see posts that existed because
> allow_future: defaults to 
> Falsehttp://www.djangoproject.com/documentation/generic_views/#django-view...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Count the times a user has logged into the system

2007-08-02 Thread Chris Hoeppner

I can recall this being covered some time ago, but google won't throw
up my answers. So, sorry for double post :)

I'd like to count the times a user has logged in (if possible without
hacking on contrib.auth). Actually just the first 10 times or so. I
want to show a few mini-tutorials the first few times the user logs
in. Like the first 3 or 5 times for basic stuff, and 7 - 8 for the
more esoteric features.

I can easily count, for example, the posts a user has made, since
they're linked to him through a foreign key (user.post_set.count())
and things like that, but how to count the times a user has logged in?

Thanks for your continuous help!


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



Re: How to get selected value set in newforms

2007-08-02 Thread jeffhg58
I think the problem is related to passing the resultsdict dictionary to the 
DisplayForms.
Once, I did not pass in the dictionary then the initial value works.

Jeff

-- Original message -- 
From: [EMAIL PROTECTED] 

Nis,

Thanks for the reply. I tried your example and that does not work. Here is the 
snippet of my code:

views.py

def displayresults(request, object_id):
 result = Result.objects.get(pk=object_id)
 
 startdatevalue = ''
starttimevalue = ''
startdatestr = '%s' % result.ExecutionStartDate
if startdatestr != 'None':
   startdatevalue = "%04d-%02d-%02d" % ( 
result.ExecutionStartDate.year, result.ExecutionStartDate.month, 
   result.ExecutionStartDate.day)
   starttimevalue = "%02d:%02d:%02d" % ( 
result.ExecutionStartDate.hour, result.ExecutionStartDate.minute,
   result.ExecutionStartDate.second)
 
 result_dict = {'TestName': result.TestName,
 'TestVersion': result.TestVersion,
 'ExecutionStartDate_date': startdatevalue,
 'ExecutionStartDate_time': starttimevalue,
 'SubmitDate': result.SubmitDate,
 'ExecutionTime': result.ExecutionTime,
 'Owner': result.Owner,
 'Project': result.ProjectId,
 'Phase': result.PhaseId,
 'Testtype': result.TestTypeId,
 'Station': result.StationId,
 'UserIntervention': result.UserInt erventionFlag,
}
   form = DisplayResults(result_dict)

resultforms.py:
class DisplayResults(forms.Form):
   TestName = forms.CharField()
TestVersion = forms.CharField()
ExecutionStartDate_date = forms.DateField()
ExecutionStartDate_time = forms.TimeField()
SubmitDate = forms.CharField()
ExecutionTime = forms.CharField()
Owner = forms.CharField()
Project = forms.CharField()
Phase = forms.CharField()
Testtype = forms.CharField()
status = forms.ChoiceField(required=False,choices 
=(('choice1','Choice1'),('choice2','Choice 2')), initial = 'choice2' )

Here is the html output:

Status:
Choice1
Choice 2


Jeff

-- Original message -- 
From: Nis Jørgensen <[EMAIL PROTECTED]> 

> 
> [EMAIL PROTECTED] skrev: 
> > I am still having problems setting the select widget to the 3rd value in 
> > the 
> drop down list. 
> > Looking further it seems that the html does not have the 
> > selected="selected" 
> value in any of the items. 
> > The documentation states that if use a bound form you will see that in the 
> html. 
> 
> "initial" data are showed in an UNBOUND form. If the form is bound, it 
> shows the data you bound it to. This is clearly stated in the 
> documentation - I assume you mistyped here. 
> 
> > How would you go about getting the selected value in the html for a 
> choicefield. I tried the initial parameter in the choicefield and that does 
> not 
> change which value is selected. It always happens to be the first in the 
> list. 
> > 
> > Any help would greatly appreciated. 
> 
> For an unbound form, it works for me: 
> 
> """ 
> $ cat forms.py 
> from django import newforms as forms 
> 
> class SearchForm (forms.Form): 
> campaign = forms.ChoiceField(required=False,choices 
> =(('choice1','Choice1'),('choice2','Choice 2')), initial = 'choice2' ) 
> sf = SearchForm() 
> print sf 
> 
> $ python forms.py 
> Campaign:> name="campaign" id="id_campaign"> > Choice1 > Choice 2 > 
> """ 
> 
> Can you please 
> 
> a) Confirm that the above works for you 
> b) Post a self-contained example which shows your problem 
> 
> Nis 
> > 
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: schema evolution

2007-08-02 Thread Derek Anderson

this is the right place.  or anyone can feel free to PM me.

which database are you using?  can you give me a copy of your model file 
and a dump of your existing schema?


Romo wrote:
> Hello!
> 
> I don't know if this is the right place to a little problem I have
> with this...
> 
> I installed schema-evolution and everything seemed to be fine... when
> i try to run it with:
> 
> python manage.py sqlevolve app_name (obviously app_name is not my app
> name :P)
> 
> I get the following:
> 
> BEGIN;
> Traceback (most recent call last):
>   File "manage.py", line 11, in ?
> execute_manager(settings)
>   File "/usr/lib/python2.4/site-packages/django/core/management.py",
> line 1898, in execute_manager
> execute_from_command_line(action_mapping, argv)
>   File "/usr/lib/python2.4/site-packages/django/core/management.py",
> line 1858, in execute_from_command_line
> output = action_mapping[action](mod)
>   File "/usr/lib/python2.4/site-packages/django/core/management.py",
> line 519, in get_sql_evolution
> output = get_sql_evolution_check_for_changed_field_flags(klass,
> new_table_name)
>   File "/usr/lib/python2.4/site-packages/django/core/management.py",
> line 627, in get_sql_evolution_check_for_changed_field_flags
> existing_fields = introspection.get_columns(cursor,db_table)
> AttributeError: 'module' object has no attribute 'get_columns'
> 
> I've got django .96
> 
> Cheers
> 
> 
> > 
> 


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



Re: 404 for date-based generic views--Help!

2007-08-02 Thread Drasty

On Aug 2, 11:42 am, Mackenzie Kearl <[EMAIL PROTECTED]>
wrote:
> You should put some template code up as well

Here you go (there are no variables in "zora.html"):

{% extends "zora.html" %}

{% block title %}Pictures of Zora (from {{ day|date:"N d, Y" }}){%
endblock title %}

{% block bodystyle %}{% endblock bodystyle %}

{% block content %}
Pictures from {{ day|date:"F j, Y" }}

{% for object in object_list %}
{{ object.title }}
taken at {{ object.time|date:"P" }}
{% endfor %}

{% endblock content %}


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: 404 for date-based generic views--Help!

2007-08-02 Thread Mackenzie Kearl

You should put some template code up as well i know that I recently
could not see posts that existed because
allow_future: defaults to False
http://www.djangoproject.com/documentation/generic_views/#django-views-generic-date-based-archive-day


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: schema evolution

2007-08-02 Thread Romo

Hello!

I don't know if this is the right place to a little problem I have
with this...

I installed schema-evolution and everything seemed to be fine... when
i try to run it with:

python manage.py sqlevolve app_name (obviously app_name is not my app
name :P)

I get the following:

BEGIN;
Traceback (most recent call last):
  File "manage.py", line 11, in ?
execute_manager(settings)
  File "/usr/lib/python2.4/site-packages/django/core/management.py",
line 1898, in execute_manager
execute_from_command_line(action_mapping, argv)
  File "/usr/lib/python2.4/site-packages/django/core/management.py",
line 1858, in execute_from_command_line
output = action_mapping[action](mod)
  File "/usr/lib/python2.4/site-packages/django/core/management.py",
line 519, in get_sql_evolution
output = get_sql_evolution_check_for_changed_field_flags(klass,
new_table_name)
  File "/usr/lib/python2.4/site-packages/django/core/management.py",
line 627, in get_sql_evolution_check_for_changed_field_flags
existing_fields = introspection.get_columns(cursor,db_table)
AttributeError: 'module' object has no attribute 'get_columns'

I've got django .96

Cheers


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



Re: How to get selected value set in newforms

2007-08-02 Thread jeffhg58
Nis,

Thanks for the reply. I tried your example and that does not work. Here is the 
snippet of my code:

views.py

def displayresults(request, object_id):
 result = Result.objects.get(pk=object_id)
 
 startdatevalue = ''
starttimevalue = ''
startdatestr = '%s' % result.ExecutionStartDate
if startdatestr != 'None':
   startdatevalue = "%04d-%02d-%02d" % ( 
result.ExecutionStartDate.year, result.ExecutionStartDate.month, 
   result.ExecutionStartDate.day)
   starttimevalue = "%02d:%02d:%02d" % ( 
result.ExecutionStartDate.hour, result.ExecutionStartDate.minute,
   result.ExecutionStartDate.second)
 
 result_dict = {'TestName': result.TestName,
 'TestVersion': result.TestVersion,
 'ExecutionStartDate_date': startdatevalue,
 'ExecutionStartDate_time': starttimevalue,
 'SubmitDate': result.SubmitDate,
 'ExecutionTime': result.ExecutionTime,
 'Owner': result.Owner,
 'Project': result.ProjectId,
 'Phase': result.PhaseId,
 'Testtype': result.TestTypeId,
 'Station': result.StationId,
 'UserIntervention': result.UserInterventionFlag,
}
   form = DisplayResults(result_dict)

resultforms.py:
class DisplayResults(forms.Form):
   TestName = forms.CharField()
TestVersion = forms.CharField()
ExecutionStartDate_date = forms.DateField()
ExecutionStartDate_time = forms.TimeField()
SubmitDate = forms.CharField()
ExecutionTime = forms.CharField()
Owner = forms.CharField()
Project = forms.CharField()
Phase = forms.CharField()
Testtype = forms.CharField()
status = forms.ChoiceField(required=False,choices 
=(('choice1','Choice1'),('choice2','Choice 2')), initial = 'choice2' )

Here is the html output:

Status:
Choice1
Choice 2


Jeff

-- Original message -- 
From: Nis Jørgensen <[EMAIL PROTECTED]> 

> 
> [EMAIL PROTECTED] skrev: 
> > I am still having problems setting the select widget to the 3rd value in 
> > the 
> drop down list. 
> > Looking further it seems that the html does not have the 
> > selected="selected" 
> value in any of the items. 
> > The documentation states that if use a bound form you will see that in the 
> html. 
> 
> "initial" data are showed in an UNBOUND form. If the form is bound, it 
> shows the data you bound it to. This is clearly stated in the 
> documentation - I assume you mistyped here. 
> 
> > How would you go about getting the selected value in the html for a 
> choicefield. I tried the initial parameter in the choicefield and that does 
> not 
> change which value is selected. It always happens to be the first in the 
> list. 
> > 
> > Any help would greatly appreciated. 
> 
> For an unbound form, it works for me: 
> 
> """ 
> $ cat forms.py 
> from django import newforms as forms 
> 
> class SearchForm (forms.Form): 
> campaign = forms.ChoiceField(required=False,choices 
> =(('choice1','Choice1'),('choice2','Choice 2')), initial = 'choice2' ) 
> sf = SearchForm() 
> print sf 
> 
> $ python forms.py 
> Campaign:> name="campaign" id="id_campaign"> > Choice1 > Choice 2 > 
> """ 
> 
> Can you please 
> 
> a) Confirm that the above works for you 
> b) Post a self-contained example which shows your problem 
> 
> Nis 
> 
> 
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 admin and edit_inline

2007-08-02 Thread Lic. José M. Rodriguez Bacallao
if I have a model edited inline with other in the admin site, how can
I specified  the ordering of the inline edited model fields and it
don't show up in admin first page?

-- 
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: create_or_update() shortcut

2007-08-02 Thread Don Arbow

On Aug 2, 2007, at 2:01 AM, Jens Diemer wrote:
>
> We have the shortcut get_or_create() [1], but whats about a  
> create_or_update() ?
>
> [1] http://www.djangoproject.com/documentation/db-api/#get-or- 
> create-kwargs


The shortcut already exists, it's called save().

http://www.djangoproject.com/documentation/db-api/#how-django-knows- 
to-update-vs-insert

Don

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



Re: Admin and ManyToManyField

2007-08-02 Thread Lucky B

null=True only affects the database representation, you need to set
blank=True. The reason you can do it in the command line is that you
can bypass admin's validators through the command line.

On Aug 2, 11:08 am, Ramashish Baranwal <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I have a model that has a ManyToManyField. When I try to add/edit an
> object of this model in admin, it says that the ManyToManyField is
> required i.e. I can not leave it out. While, from the shell I can
> easily create an object without adding anything in the
> ManyToManyField. The same happens for ForeignKey also even though I
> have set null=True. Is this by design? I am using version 0.96
>
> Thanks,
> Ram


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: ModelMultipleChoiceField doesn't do initial selection

2007-08-02 Thread Lucky B

I think you should be using form_for_instance on the dvd instance
instead of the generic form contructor.
http://www.djangoproject.com/documentation/newforms/#form-for-instance

On Aug 2, 11:14 am, "Kai Kuehne" <[EMAIL PROTECTED]> wrote:
> No ideas anyone? :-/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 selected value set in newforms

2007-08-02 Thread Nis Jørgensen

[EMAIL PROTECTED] skrev:
> I am still having problems setting  the select widget to the 3rd value in the 
> drop  down list.
> Looking further it seems that the html does not have the selected="selected" 
> value in any of the items.
> The documentation states that if use a bound form you will see that in the 
> html.

"initial" data are showed in an UNBOUND form. If the form is bound, it
shows the data you bound it to. This is clearly stated in the
documentation - I assume you mistyped here.

> How would you go about getting the selected value in the html for a 
> choicefield. I tried the initial parameter in the choicefield and that does 
> not change which value is selected. It always happens to be the first in the 
> list.
>
> Any help would greatly appreciated.

For an unbound form, it works for me:

"""
$ cat forms.py
from django import newforms as forms

class SearchForm (forms.Form):
campaign = forms.ChoiceField(required=False,choices
=(('choice1','Choice1'),('choice2','Choice 2')), initial = 'choice2' )
sf = SearchForm()
print sf

$ python forms.py
Campaign:
Choice1
Choice 2

"""

Can you please

a) Confirm that the above works for you
b) Post a self-contained example which shows your problem

Nis


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Admin & Models

2007-08-02 Thread Nathan Ostgard

list_display can use functions as their value... so, you can have:

class Employee(models.Model):
  sub_dept = ForeignKey(SubDept)

  def company(self):
return sub_dept.dept.company

  def dept(self):
return sub_dept.dept

  class Admin:
list_display = ('first_name, 'last_name', 'company', 'dept',
'sub_dept')


On Aug 1, 3:16 pm, Rohit <[EMAIL PROTECTED]> wrote:
> Actually my question is two fold, most likely due to brain farts on my
> end. I'm relatively a newbie to Django, so please bear with me.
>
> Here's my scenario. I have this for my relationships:
> Company->Dept->Sub-Dept->Employees->Roles
> "->" represents a one-to-many relationship.
>
> Problem #1:
>
> If I do something like this:
> Class Company(models.Model):
>  name...
>
> Class Dept(models.Model):
> company = ForeignKey(Company)
> name...
>
> Class Sub-Dept(models.Model):
> dept = ForeignKey(Dept)
> name...
>
> Class Employee(models.Model):
> sub-dept = ForeignKey(Sub-Dept)
> first_name...
>
> Class Admin:
> list_display = ( 'first_name', 'last_name', 'sub-dept', )
>
> The problem is when I go into the admin screen and view employees,
> there is no way of displaying the company and dept. info next to the
> name of the employee. How can I accomplish that?
>
> Problem #2:
> This kinda arises from my efforts trying to fix Problem #1.
>
> I changed my code like so:
>
> .
> .
> Class Employee(models.Model):
> company = ForeignKey(Company)
> dept= ForeignKey(Dept)
> sub-dept  = ForeignKey(Sub-Dept)
> first_name...
>
> Class Admin:
> list_display = ( 'first_name', 'last_name', 'company', 'dept',
> 'sub-dept', )
>
> Now the problem is when I add an employee, I have to add some kind of
> validation to the admin interface that checks whether the sub-dept,
> dept and company match. My main issue is where can I add this
> validation so that it is reflected in the admin interface?
>
> Thanks in advance for the pointers.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Something like a mini Crystal Reports with Django

2007-08-02 Thread Lucky B

You could try Eclipse BIRT for a WYSIWYG interface. But otherwise you
can create a view however you want to report your data doing whatever
manipulation you wanted. I don't see what else you would need other
than to create a view.

On Aug 2, 5:17 am, Mir Nazim <[EMAIL PROTECTED]> wrote:
> Anybody has any views on this.
>
> --
> PS: posting just to keep this topic fresh
>
> On Jul 31, 4:28 pm, Mir Nazim <[EMAIL PROTECTED]> wrote:
>
> > Hello
>
> > I was wondering has anybody done application that was something like a
> > mini crystal reports. Generating a report based of model items
> > selected in a WYSIWYG(ok this is not important) fashion.  And
> > generating a HTML tables based report with defined calculations etc.
>
> > I understand that Django Admin has some kind of similar facilities. I
> > am looking into them. In the mean time thought that may be some one
> > else might be doing similar stuff somewhere.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: ModelMultipleChoiceField doesn't do initial selection

2007-08-02 Thread Kai Kuehne

No ideas anyone? :-/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Admin and ManyToManyField

2007-08-02 Thread Ramashish Baranwal

Hi,

I have a model that has a ManyToManyField. When I try to add/edit an
object of this model in admin, it says that the ManyToManyField is
required i.e. I can not leave it out. While, from the shell I can
easily create an object without adding anything in the
ManyToManyField. The same happens for ForeignKey also even though I
have set null=True. Is this by design? I am using version 0.96

Thanks,
Ram


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Windows XP tips and tricks

2007-08-02 Thread John Travolta
Great Windows XP tips and tricks http://windowsxpsp2pro.blogspot.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?hl=en
-~--~~~~--~~--~--~---



Re: Including view in a template

2007-08-02 Thread Kyle Fox

You might want to try writing an inclusion tag:
http://www.djangoproject.com/documentation/templates_python/#inclusion-tags

They are much simpler to write than template tags, and more "designer
friendly."  They let you write a separate template that gets rendered
inside of another template (similar to how partials worked in Rails).

So for example you could write a template tag called 'list_users', and
create a template called 'list_users.html'.  Then in
frontpage_template.html you could add something like {% list_users %}
and it will render the list_users.html template.

I work primarily with designers who write the actual templates, so
it's much more intuitive for them to simply drop in something like {%
main_menu %} whenever they want to show the site nav, and then just
edit main_menu.html when they want to modify the markup/design.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: templates..

2007-08-02 Thread Andy McKay

On 2 Aug 2007, at 14:11, Marco A. wrote:
> NameError at /foo/ global name 'get_template' is not defined

You haven't defined get_template anywhere in your import statements  
(below), so you've got an error in Python back. Define it so Python  
knows what it is.

A quick google tells me the appropriate import is:

from django.template.loader import get_template

So try adding that

> I have this code in my view :
>
> from cit2  import utente
> from django.http import HttpResponse
> from django.template import Context, Template
>
>
> def login(request):
> html = "HI"
> get_template('prova.html')
> return HttpResponse(html)


--
   Andy McKay




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



templates..

2007-08-02 Thread Marco A.
Hi !
I have a problem to setting up the template :

NameError at /foo/ global name 'get_template' is not defined Request Method:
GET  Request URL: http://127.0.0.1:8000/foo/  Exception Type:
NameError  Exception
Value: global name 'get_template' is not defined  Exception Location:
/home/tulap/cit2/../cit2/utente/views.py
in login, line 8  Python Executable: /usr/bin/python  Python Version: 2.5.1

I have this code in my view :

from cit2  import utente
from django.http import HttpResponse
from django.template import Context, Template


def login(request):
html = "HI"
get_template('prova.html')
return HttpResponse(html)


In the settings.py there is :

TEMPLATE_DIRS = (
  "/home/marco/cit2/templates"

)

And there is a file called prova.html in the directory.

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



newforms / newforms-admin: customizing label_tag with css -- how does newforms-admin do it?

2007-08-02 Thread _

Hi,

I'd like to add some css to my field.label_tag() if the field is
required (so it generates class="required" as part of the ).
I'm using a straight forms.form_from_model but I can't really see how
it can be done in an intelligent manner. I've tried to figure out how
newforms-admin does it (in change_form.html, for example) -- but I
can't make it out. Any advice?

My template looks like this:

{% for field in form %}

{{field.label_tag}}{{ field }}

{% endfor %}

I see that you can set attrs of a field to specify css--but can you do
this with a callback with form_from_model?

I see there's been a little discussion about css and widgets -- but no
resolution:
http://groups.google.com/group/django-users/browse_thread/thread/50d6963a3e91c3fc/9833404291ac4df7?lnk=gst=css+newforms+label=3#9833404291ac4df7

Cheers,

Allen


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: 404 for date-based generic views--Help!

2007-08-02 Thread Drasty

I figured out the year archive issue (it doesn't use the object_list,
argh!) but still get 404s for the day and detail generic views.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



404 for date-based generic views--Help!

2007-08-02 Thread Drasty

I'm getting 404 errors on day and detail views for date-based generic
views. In addition, the year archive doesn't show any entries, but the
month view does!

Here's my urlconf--is there something I'm missing? (I'm using Python
2.4.4, MySQL, & the dev server on localhost.)


from django.conf.urls.defaults import *
from datetime import datetime, date
from commonplace.family.models import ZoraPic


def latest_pics():
return ZoraPic.public_objects.all()[:3]

def year_list():
return ZoraPic.public_objects.dates('time', 'year').order_by('time')


zora_latest_dict = {
'extra_context': {
'latest_pics': latest_pics,
'year_list': year_list
}
}
zora_dict = {
'queryset': ZoraPic.objects.all(),
'date_field': 'time',
'extra_context': {
'year_list': year_list
}
}


urlpatterns = patterns('django.views.generic',
(r'^(?P\d{4})/(?P\d{2})/(P?\d{2})/(?P[-\w]+)/
$', 'date_based.object_detail', dict(zora_dict, slug_field='slug',
month_format='%m', template_name='zora/detail.html')),
(r'^(?P\d{4})/(?P\d{2})/(P?\d{2})/$',
'date_based.archive_day', dict(zora_dict, month_format='%m',
template_name='zora/day.html')),
(r'^(?P\d{4})/(?P\d{2})/$', 'date_based.archive_month',
dict(zora_dict, month_format='%m', template_name='zora/month.html')),
(r'^(?P\d{4})/$', 'date_based.archive_year', dict(zora_dict,
template_name='zora/year.html')),
(r'^$', 'simple.direct_to_template', dict(zora_latest_dict,
template='zora.html')),
)


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



Re: mod_python apache2 path problem

2007-08-02 Thread Graham Dumpleton

On Aug 2, 6:11 pm, Giorgio Salluzzo <[EMAIL PROTECTED]>
wrote:
> On Jul 31, 12:25 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > Huh. What bug, strange behaviour in mod_python? What old threads?
>
> Excuse me, I tought he was having a problem similar to the 
> following:http://www.modpython.org/pipermail/mod_python/2003-July/013947.html
>
> We had the same and I tried to solve it before deciding to take other
> deployment decisions.

The behaviour exhibited in that post on mod_python list is perfectly
normal for Apache and is just how Apache works. This strangeness of
Apache in the way mod_python handlers works is part of the reason why
SCRIPT_NAME for a WSGI application cannot be automatically determined
by WSGI adapters for mod_python. The only easy way SCRIPT_NAME can be
worked out properly is by doing script determination from a
transhandler. To do such a thing in Python, because all requests for
the virtual server go through Python code, would unnecessarily slow
down request handling. FWIW, because mod_wsgi is all in C code it
doesn't have this problem and can work out SCRIPT_NAME properly by
using a transhandler.

Either way that strangeness should not have been an issue as from
memory Django just uses req.uri directly and is not dependent on
req.filename or req.path_into.

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: Compare column entries in database query

2007-08-02 Thread Russell Keith-Magee

On 8/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I want to find all entries in a database where two specific fields are
> equal:
>
> mytable.objects.filter(column_a='column_b')

At present, the answer is unfortunately 'you can't do this' (unless
you use a hack like the one you mentioned).

I've had a few ideas on how to fix this; however, fixing this area of
code would require changes to an area that is currently undergoing a
major refactor. Once the query engine changes are complete, I have a
number of issues to address - this is one of them.

Yours,
Russ Magee %-)

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



Composing an URL using the current search query

2007-08-02 Thread Filipe Correia

Hi,

I'm struggling with an issue similar to the one presented on this
thread:
http://groups.google.com/group/django-users/browse_frm/thread/536c0a7ba9f8c155/5d61867c4339e4d8

In a view, getting the various elements that compose the current URL's
query string is easy, one only needs to use the "request" object:

request.GET['name']

however, in my case I would like to preserve the current querystring,
whichever it is, replacing (or adding) only the value for a certain
variable (say, the value for "page"). So I would be reading the parsed
query string only to compose it again with very little change.

Is there a more elegant way to do this?

thanks in advance,
Filipe Correia


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Model Examples page, gone?

2007-08-02 Thread Nis Jørgensen

Nimrod A. Abing skrev:
> Hello,
>
> I was just going through the current docs and wanted to look up some
> examples and I noticed that the Model Examples page is gone:
>
> http://www.djangoproject.com/documentation/models/
>
> though it can still be accessed in the older versions of the docs.
>
> http://www.djangoproject.com/documentation/0.95/models/
>   
Apparently that bit of documentation is broken - someone filed a ticket:
http://code.djangoproject.com/ticket/5051

Nis

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 do filtring drop down list by other drop down list in django admin

2007-08-02 Thread Setas

2 foreignkeys in one model..
 they are related by many to one

class Theaters(models.Model):



class Halls(models.Model):
..
Theaterss = models.ForeignKey(Theaters)
  .

class Repertory(models.Model):

Theaterss = models.ForeignKey(Theaters)
Hallss = models.ForeignKey(Halls)
  ..

how it must look ? posible 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
-~--~~~~--~~--~--~---



Compare column entries in database query

2007-08-02 Thread [EMAIL PROTECTED]

Hi everybody!

I want to find all entries in a database where two specific fields are
equal:

mytable.objects.filter(column_a='column_b')

But this gives me no results at all. I now managed to get it done with
a .extra(), but I was wondering if this is the only possible solution.
All examples in the documentation work with static values for
comparison and there are no further details about the right hand side
of the query.

Thanks for reading!
Thomas.

P.S.:
Here's the query which get's the work done:
mytable.objects.extra(where=['column_a=column_b'])


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Trigger a django user password change...

2007-08-02 Thread Jens Diemer


I would like to do something if the django user password has been set or update.
So i trigger signals.post_save with the User class, like this:


===

from django.db.models import signals
from django.dispatch import dispatcher


def update(sender, instance, signal, *args, **kwargs):

 user_obj = instance

 ...

 user_obj.message_set.create(message="Updated!")


dispatcher.connect(update, signal=signals.post_save, sender=User)

===


But my function 'update' is not only called if the user password changed.
The problem is, in the User model exists e.g. 'last_login'. So the save method 
called every time, the user logged in :(

One idea is this:

===

old_passwords = {}
def save_old_pass(sender, instance, signal, *args, **kwargs):
 user_obj = instance
 old_pass = user_obj.password
 old_passwords[user_obj] = old_pass

def update(sender, instance, signal, *args, **kwargs):
 user_obj = instance
 new_password = user_obj.password

 if user_obj in old_passwords and old_passwords[user_obj] == new_password:
 # Nothing to change
 return

 ...

 user_obj.message_set.create(message="Updated!")


from django.db.models import signals
from django.dispatch import dispatcher

dispatcher.connect(save_old_pass, signal=signals.post_init, sender=User)
dispatcher.connect(update, signal=signals.post_save, sender=User)

===


This works, but save_old_pass() would be often called, if the user is logged in.
So it's not a really good idea.


Any better ideas?



-- 
Mfg.

Jens Diemer



A django powered CMS: http://www.pylucid.org


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



Re: Trouble with installing stockphoto

2007-08-02 Thread yml

Hello,

It looks like your "base.html" is in a folder which is not defined in
the "TEMPLATE_DIRS". In order to fix your problem you should add this
directory to this tuple.
I hope that help

On Aug 2, 5:38 am, Danno <[EMAIL PROTECTED]> wrote:
> So I was able to import everything it looks like ok, but when i go 
> tohttp://localhost/stockphoto/
>
> it is giving me the following error:
> TemplateSyntaxError at /stockphoto/
> Template u'base.html' cannot be extended, because it doesn't exist
>
> So I navigate to my installed stockphoto at c:/python25/Lib/site-
> packages/stockphoto/templates/stockphoto/base.html and sure enough the
> only thing in it is {% extends "base.html" %}
> It is trying to extend itself as far as I can tell.
>
> Any help on this would be extremely appreciated, Thank you!
>
> Rocksteady,
> Danno~
>
> On Aug 1, 2:17 am, Danno <[EMAIL PROTECTED]> wrote:> I am having a bit of 
> trouble installing stockphoto 
> (http://www.carcosa.net/jason/software/django/stockphoto/README.html)
>
> > I am wanting to try out just the functionality of the app itself, not
> > yet integrating it with a current project and am running into a few
> > errors.  Here is my work flow as to how I've set up a new project to
> > have stockphoto:
>
> > I downloaded the stockphoto-0.2.tar.gz, uncompressed it and have the
> > folder stockphoto-0.2 in c:/django/stockphoto-0.2
>
> > command line>cd : c\django
>
> > c\django> manage.py startproject testproject
>
> > from here, I have tried multiple ways toinstallstockphoto as an app
> > inside the c:/django/testproject/ directory and i just can't get it.
>
> > Any and all help you can give this newbie will be extremely
> > appreciative.  Thank you guys!
>
> > Rocksteady,
> > Danno~


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Something like a mini Crystal Reports with Django

2007-08-02 Thread Mir Nazim

Anybody has any views on this.

--
PS: posting just to keep this topic fresh

On Jul 31, 4:28 pm, Mir Nazim <[EMAIL PROTECTED]> wrote:
> Hello
>
> I was wondering has anybody done application that was something like a
> mini crystal reports. Generating a report based of model items
> selected in a WYSIWYG(ok this is not important) fashion.  And
> generating a HTML tables based report with defined calculations etc.
>
> I understand that Django Admin has some kind of similar facilities. I
> am looking into them. In the mean time thought that may be some one
> else might be doing similar stuff somewhere.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Model Examples page, gone?

2007-08-02 Thread Nimrod A. Abing

Hello,

I was just going through the current docs and wanted to look up some
examples and I noticed that the Model Examples page is gone:

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

though it can still be accessed in the older versions of the docs.

http://www.djangoproject.com/documentation/0.95/models/

Has anything changed in the examples?
-- 
_nimrod_a_abing_

http://abing.gotdns.com/
http://www.preownedcar.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?hl=en
-~--~~~~--~~--~--~---



value for choices arguments for newforms.MultipleSelectField

2007-08-02 Thread james_027

hi

somewhere on the django documentation I saw the choice provided for
MultipleSelectField is from a Database but I can't recall where I read
it but I do it this way, let me know if there are better alternative

items = newforms.MultipleChoiceField(choices = [('i.id', 'i.name') for
i in Items.objects.all()])

Thanks
james


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



Re: mod_python apache2 path problem

2007-08-02 Thread Giorgio Salluzzo



On Jul 31, 12:25 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:

> Huh. What bug, strange behaviour in mod_python? What old threads?

Excuse me, I tought he was having a problem similar to the following:
http://www.modpython.org/pipermail/mod_python/2003-July/013947.html

We had the same and I tried to solve it before deciding to take other
deployment decisions.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Django equivalent of ROR flash

2007-08-02 Thread Jarek Zgoda

[EMAIL PROTECTED] napisał(a):

>> Django provides something similar in the authentification app, but it
>> works only the the authentificated users :
>>
>> http://www.djangoproject.com/documentation/authentication/#messages
> 
> What would be the best way to implement something like this in django
> (without using the authentication bits)?

We did it using sessions and simple context processor that adds messages
from session to request context then clears the message lists in session.

-- 
Jarek Zgoda
Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Trouble with installing stockphoto

2007-08-02 Thread mojo

You should create this base.html template.
This is not self extension.

There are more problems with win32, i.e. file paths.

-Original Message-
From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of Danno
Sent: Thursday, August 02, 2007 7:39 AM
To: Django users
Subject: Re: Trouble with installing stockphoto


So I was able to import everything it looks like ok, but when i go to
http://localhost/stockphoto/

it is giving me the following error:
TemplateSyntaxError at /stockphoto/
Template u'base.html' cannot be extended, because it doesn't exist

So I navigate to my installed stockphoto at c:/python25/Lib/site-
packages/stockphoto/templates/stockphoto/base.html and sure enough the
only thing in it is {% extends "base.html" %}
It is trying to extend itself as far as I can tell.

Any help on this would be extremely appreciated, Thank you!

Rocksteady,
Danno~


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Django equivalent of ROR flash

2007-08-02 Thread Fabien Schwob

Hello,

> Does Django have this
> http://api.rubyonrails.com/classes/ActionController/Flash.html

Django provides something similar in the authentification app, but it
works only the the authentificated users :

http://www.djangoproject.com/documentation/authentication/#messages



-- 
Fabien SCHWOB

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 equivalent of ROR flash

2007-08-02 Thread james_027

Does Django have this 
http://api.rubyonrails.com/classes/ActionController/Flash.html

Thanks
james


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



Re: pydev

2007-08-02 Thread Nimrod A. Abing

On 8/2/07, eXt <[EMAIL PROTECTED]> wrote:
>
> Hi
>
>As I said earlier i don't have (and don't remember) these settings.
> But you're right - it was in eclipse.ini. Now I use Eclipse Europa and
> Java 6 on Kubuntu (32 bit) and I don't have any errors (even null
> references mentioned by Nimrod).

It appears to be a random occurence on my setup tied to
autocompletion. There are instances when autocomplete triggers and CPU
usage spikes up, at times it results in a null reference exception.

Anyway, glad to see you got it working already.
-- 
_nimrod_a_abing_

http://abing.gotdns.com/
http://www.preownedcar.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?hl=en
-~--~~~~--~~--~--~---



Re: Do I have to send shopping cart data to every template in my app?

2007-08-02 Thread oggie rob

On Aug 1, 11:22 pm, oggie rob <[EMAIL PROTECTED]> wrote:
> This is what middleware is made 
> for.http://www.djangoproject.com/documentation/middleware/
>
>  -rob

Sorry, I have recently been working with shopping carts and had
redirection on my brain. Fabien's suggestion is probably what you are
after.

 -rob


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



  1   2   >