Presence of ForeignKey in list_display kills admin list view

2008-01-03 Thread Lee Hinde

I have two models, presented below:

class Winery(models.Model):
"""(Winery description)"""
name = models.CharField(blank=False, maxlength=100,
db_index=True)
winery_id = models.CharField(blank=True, maxlength=100)
corporate_name = models.CharField(blank=True, maxlength=100)
address = models.CharField(blank=True, maxlength=100)
city = models.CharField(blank=True, maxlength=100)
state = models.CharField(blank=True, maxlength=10)
zipcode = models.CharField(blank=True, maxlength=11)

class Admin:
list_display = ('name',)
search_fields = ('name',)
class Meta:
 ordering =  ('name',)
 verbose_name_plural = "Wineries"

def __str__(self):
return self.name

def __unicode__(self):
return self.name


class Wine(models.Model):
"""The Wine table"""
class_number = models.CharField(blank=True, maxlength=100)
wine_name = models.CharField(blank=True, maxlength=100,
db_index=True)
appellation = models.CharField(blank=True, maxlength=100)
appellation_id = models.ForeignKey(Appellation,
verbose_name="Appellation")
vintage_date = models.CharField(blank=True, maxlength=10)
estate_bottled = models.NullBooleanField()
vineyard_designation = models.NullBooleanField(default=False)
vineyard_name = models.CharField(blank=True, maxlength=100)
varietal = models.CharField(blank=True, maxlength=100)
varietal_id = models.ForeignKey(Varietal, verbose_name="Varietal")
gallons_produced = models.PositiveIntegerField(blank=True,
null=True)
residual_sugar = models.DecimalField(max_digits=2,
decimal_places=2)
retail_price = models.DecimalField(max_digits=5, decimal_places=2)
bottle_size = models.CharField(blank=True, maxlength=100)
winery_id = models.ForeignKey(Winery, verbose_name="Winery")

class Meta:
ordering =  ('winery_id','appellation_id','class_name')

class Admin:
ordering =  ('winery_id','appellation_id','class_name')
list_display =
('winery_id','wine_name','class_name','vintage_date')
list_filter  = ("award_medal",)
search_fields = ('^winery_id__name',)

def __unicode__(self):
return self.wine_name


In Admin, no data is shown when I list Wines. If I remove the
"winery_id" reference in Wine's list_display, I get a complaint about
the Meta classes' ordering line. ((1054, "Unknown column
'winecomp_winery.name' in 'order clause'"))

If I comment out the Meta class (and remove the winery_id field), I
get a list. But without the Winery field.

If I comment out the Meta class and leave in the winery_id field, I
get a list, but with no data.

Django version 0.97-pre-SVN-unknown, using settings
'winesite.settings'

I started playing around with this app as a learning tool last summer,
it's evolved and I picked it up again as I gave myself the Django book
as a Christmas present. It seems like this was working before. But it
was several months ago and I'm old and foggy.

The book says that the __str()__ of the related object is used if a
foreign key is used in a list_display. When I came back to the
project, it seemed like in some situations (that I can't recall right
now) __unicode()__ was preferred. That's why I have both.

Any guidance would be appreciated. I've googled the group and the
internet without much recent commentary on this, so I'm hoping there's
a typo someone will see.


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

2008-01-03 Thread Kenneth Gonsalves


On 04-Jan-08, at 12:41 PM, LRP wrote:

> So, it appears that my major problem is version. As several of you
> point out, I'm running version 0.95.1-1, which I downloaded from the
> current stable Debian repository, etch. I see that the Debian testing
> repository, lenny, contains 0.96.1-1.
>
> Now I'll have to figure out how to run a Debian lenny (testing) ap on
> my Debian etch (stable) system -- a question probably better asked on
> a Debian forum.

forget running the debian version - it will always be way out of  
date. Use the latest svn trunk as described in the tutorial. Also  
forget about using the django book - use the latest docs on the web  
site. The latest svn has too many goodies not present in .96 that it  
is a shame not to use it.

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
Foss Conference for the common man: http://registration.fossconf.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: Django... False promises?

2008-01-03 Thread LRP

First, many thanks to all the kind salts who've responded to my SOS.

And particular thanks to Karen Tracey who replied to my first plea for
help. Your reply did slip by me. And it was a most helpful one.

So, it appears that my major problem is version. As several of you
point out, I'm running version 0.95.1-1, which I downloaded from the
current stable Debian repository, etch. I see that the Debian testing
repository, lenny, contains 0.96.1-1.

Now I'll have to figure out how to run a Debian lenny (testing) ap on
my Debian etch (stable) system -- a question probably better asked on
a Debian forum.

You kind support has certainly helped sway me toward the view that
Django is well worth pursing further.

All the best,

Lloyd



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



Re: Flatpages and APPEND_SLASH=True

2008-01-03 Thread Ville Säävuori

This broke my site so I had to fix it. I ended up fixing the Flatpages
app to behave with APPEND_SLASH=True. I added a ticket with a patch
(also to docs): http://code.djangoproject.com/ticket/6309

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

2008-01-03 Thread mickey ristroph

I am using 0.96, but switching to svn now. Thanks for the pointer!
I'll look for it when I am done switching over.

On Dec 28 2007, 5:11 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote:
> What version of django do you use? In trunk there is classic password/
> confirm schema.
>
> On 29 дек, 01:39, mickeyristroph<[EMAIL PROTECTED]> wrote:
>
> > Does anyone have a good way to have the replace the alg$salt$hexdigest
> > input for the Add User admin page with a more traditional password/
> > password confirmation input? I would still like the password encrypted
> > in the database.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Flatpages and APPEND_SLASH=True

2008-01-03 Thread Ville Säävuori

I'm not sure if this is a bug in my setup, a bug in Django or not a
bug at all. I have the great APPEND_SLASH=True in my settings for
canonical urls, and I'm using contrib.flatpages. Problem is, after the
changes in r6582, all flatpages with url ending slash (ie, all of my
flatpages) do not redirect without a slash but rather end up as 404.

So, flatpage with slug "/foo/" and request to "/foo" end up as 404. If
I change my flatpages slug to "/foo", requests to both "/foo" and "/
foo/" work, but now the page has two different urls, which obviously
sucks big hairy balls.

Is this a bug in Django or am I missing something?

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



Will Django ever get good support for Art and Comedy???

2008-01-03 Thread SamFeltus

Django rocks, but it needs better support for comedy and artsy shiny
frilly stuff...

2008 Django generated Mardi Gras pages OTW...

:)

http://samfeltus.com/pythonista/MardiGrasPreview.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
-~--~~~~--~~--~--~---



Session problem

2008-01-03 Thread Dani

Hi, I think I have a problem with session in django, maybe it will
sound to any of you like a known issue.

In general, the problem is that sometimes sessions are not saved. It
usually happens if the server was up for more than 24 hours. If I
restart the server the problem resolves.

Code example :

def cookie_test(request):
if request.GET.has_key('tried'):
if request.session.test_cookie_worked():
looger.info('deleting test cookie')
request.session.delete_test_cookie()
return show_error(request, 'Cookies are OK!', 'Cookies seem to be
working. You can keep using the website.')
else:
looger.info('no test cookie')
return bipto_render_to_response(request,
'cookie_error.html', {'hide_side':True})
else:
logger.info('setting test cookie')
request.session.set_test_cookie()
return HttpResponseRedirect(reverse('cookie_test') + '?
tried=1')

this view suppose to be a simple cookie test. show_error and
bipto_render_to_response just create response objects for the user.
After 24 hours, the test cookie is never set even though the client
browser accepts cookies (and sends the correct session id, I checked
with a sniffer).

there is no "delete_test_cookie" anywhere else in my code

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: Counting and indexing objects

2008-01-03 Thread Malcolm Tredinnick


On Fri, 2008-01-04 at 03:26 +, Tom Badran wrote:
> Sure malcolm. Essentially what i have is table of pictures defined by
> the following model (forgive typos, this is just extracted minus extra
> junk. Album class is a model with title fields etc.):
> 
> class Picture(models.Model ):
> album = models.ForeignKey(Album)
> image = models.ImageField(upload_to="some_sane_directory")
> 
> class Meta:
> ordering = ['id']
> 
> Then in my view i get a picture by id using: 
> 
> picture = get_object_or_404(Picture, id=id) // where id is the
> parameter to the view function
> 
> And i want to be able to do something along the lines of (but with
> minimal amount of database stress):
> 
> album_pictures = Picture.objects.filter(album=picture.album)
> total = album_pictures.count()
> index = album_pictures.index_of(picture)

Okay, so you have to do this boring way and just pull things back into
Python structures. You want to used .index(), so convert from an
iterator to a list and you'll be able to do that:

index = list(album_pictures).index(picture)

This works because two Model instances compare as "equal" when their
primary keys are equal. So although album_pictures won't contain exactly
the same Python object (in the sense that id() will return different
values), it will contain something with the same pk as picture and that
is all that's required.

Regards,
Malcolm


-- 
He who laughs last thinks slowest. 
http://www.pointy-stick.com/blog/


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

2008-01-03 Thread Tom Badran
Sure malcolm. Essentially what i have is table of pictures defined by the
following model (forgive typos, this is just extracted minus extra junk.
Album class is a model with title fields etc.):

class Picture(models.Model):
album = models.ForeignKey(Album)
image = models.ImageField(upload_to="some_sane_directory")

class Meta:
ordering = ['id']

Then in my view i get a picture by id using:

picture = get_object_or_404(Picture, id=id) // where id is the parameter to
the view function

And i want to be able to do something along the lines of (but with minimal
amount of database stress):

album_pictures = Picture.objects.filter(album=picture.album)
total = album_pictures.count()
index = album_pictures.index_of(picture)

It's possible this is a completely batshit crazy way of getting to where i
want to be, so let me know if i've completely missed the obvious way to do
this.

Thanks

Tom

On Jan 4, 2008 1:37 AM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:

>
>
> On Thu, 2008-01-03 at 15:20 +, Tom Badran wrote:
> > Thanks for the hints Tim. The problem is that i'm not using the whole
> > sequence, im just pulling one item out of the query set and was hoping
> > for a way to get the position without having to use the whole set, in
> > the same vain that count() is much more sensible a choice than len()
> > as it gets optimised down to an SQL count by django. Thanks for
> > pointing out enumerate though, im actually embarrassed i didn't know
> > that, it looks very very useful.
>
> The problem is that you're asking for the equivalent of "given an object
> x that came from a list L at some random point in the past, what is the
> index of x in L?" Note that the answer is NOT necessarily L.index(x) for
> Python lists, because that only finds the first occurrence of "x" (and
> it's not L.index(x) for all iterable sequence, since the index concept
> isn't necessarily determinable for a non-reversible iterator). What I'm
> trying to say is that the general case is not solvable here. You need to
> know how you got the original object to know where it came from. So it's
> very much going to depend on how you pulled out the object 'x'.
>
> Do you have some short code that demonstrates how you are extracting the
> object in the first place? That might help with suggestions as to how
> you can note the position later.
>
> Regards,
> Malcolm
>
> --
> Why be difficult when, with a little bit of effort, you could be
> impossible.
> http://www.pointy-stick.com/blog/
>
>
> >
>


-- 
Tom Badran
http://badrunner.net

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



Re: Foreignkey relationship trouble

2008-01-03 Thread hern42

Thank you for your help... I am working on it in these lines.
Best.
Hrn
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to use random of Built-in filter reference in templates?

2008-01-03 Thread jt.wang
Alex Koshelev 写道:
>> ./manage.py shell
>> 
 from django.template.defaultfilters import random
 l = [ 1, 2, 3, 4 ]
 random( l )
 
> 2
>   
 random( l )
 
> 1
>   
 random( l )
 
> 4
>   
 random( l )
 
> 2
>   
 random( l )
 
> 2
>   
 random( l )
 
> 3
>
> In template context behaviour is the same.
>
> On 3 янв, 19:09, "jt.wang" <[EMAIL PROTECTED]> wrote:
>   
>> hi ,
>> we can  see
>>
>> "random
>>
>> Returns a random item from the 
>> list."fromhttp://www.djangoproject.com/documentation/templates/.butit is 
>> diffcult
>> to understand without examples.
>> so,is there anyone who can give me an example about "random" of Built-in
>> filter reference in templates?
>>
>> thanks!
>>
>>  wjtbox01.vcf
>> 1KЗагрузить
>> 
> >
>
>   
thank alex koshelev and tim chase, thank you very much.

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

begin:vcard
fn:jt wang
n:wang;jt
email;internet:[EMAIL PROTECTED]
note;quoted-printable:=E5=AD=A6=E4=BC=9A=E5=86=92=E6=B3=A1=E6=8B=89=E6=8E=A7=E4=BB=B6=EF=BC=8C=E8=
	=B5=B0=E9=81=8D=E5=A4=A9=E4=B8=8B=E9=83=BD=E4=B8=8D=E6=80=95
version:2.1
end:vcard



Re: Ajax widget

2008-01-03 Thread Malcolm Tredinnick


On Thu, 2008-01-03 at 15:25 -0800, mike wrote:
> I am trying to implement the Dojo Select box into a template I am
> creating.
> I have used the formtags that is inluded in the nongselect tar
> package. but It seems with the development version of django the
> import
> statements   {% load formtags %}  no longer work,   I need a way to
> replace the

You seem to be mixing up multiple problem reports here, but let's start
with this one. The "load" tag still works in Django. So you should try
to figure out why whatever third-party code you're using doesn't want to
load with the development version.

Regards,
Malcolm

-- 
No one is listening until you make a mistake. 
http://www.pointy-stick.com/blog/


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

2008-01-03 Thread Malcolm Tredinnick


On Thu, 2008-01-03 at 23:10 +0530, venkata subramanian wrote:
> Hi,
>  I had a problem recently.
>  To access the request object in all of my templates.
>  The solution I got surprised me. It involved explicitly passing on
> the request object from the views.
>  (Example, to pass a RequestContext object as a context_instance
> parameter in render_to_response method).
> 
> It surprised me because since request object is available to every
> view, why should the request
> object not be accessible in all templates by default?

Using RequestContext means that all the context processors are run. This
overhead isn't needed in all cases. So Django provides a way to render a
temlpate without the context processors being run (if you use Context())
and with the context processors being run (if you use RequestContext()).
If we always did the second thing, there would be no way to do the first
thing.

It's trivial (not just easy, completely trivial) to write your own
version of render_to_response() if you always want to use
RequestContext. The entire function is two lines long. Of course, you'll
have to pass it the 'request' instance every time, so that it's
initialised correctly, but that's the cost of wanting request-related
stuff.

Yes, we could have the default being the reverse of what it is now, but
the arguments each way are pretty easily balanced. Sometimes you always
want to use RequestContext, sometimes you don't need it at all. So
there's no strong reason to change things when it's so easy to write
your won alternative shortcut.

Regards,
Malcolm

-- 
The early bird may get the worm, but the second mouse gets the cheese. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Basic Form Design Question: Pulling as much as possible from models

2008-01-03 Thread Malcolm Tredinnick


On Thu, 2008-01-03 at 09:51 -0800, Wes Winham wrote:
> Hello,
> 
> I've got a bit of a design issue I'm trying to wrap my head around in
> order to do things the Django Way.
> 
> I'm attempting to creating a simple form that allows a user to take a
> multiple choice "quiz." Quiz is a model and it has a many to many with
> Questions which has a m2m with AnswerOptions.
> 
> I'm also not sure on which is the best way to get the questions and
> answers to the form and I'm not sure if I should be using one form, or
> a collection of forms.

Hmm  deja vu. I've been working on an almost analogous problem this
morning. I haven't coded it all up yet, but here's my current design
thinking...

Each question is a form class. You can use the same form class each time
and part of its __init__ method will be to store the "question" string
(say in self.question). I will display 'N' of these on the page using
the "prefix" attribute to the form's __init__ method. So it will look
something like this:

class QuestionForm(forms.Form):
   answers = forms.ChoiceField(widget=forms.RadioSelect)

   def __init__(self, question, *args, **kwargs):
  super(Question, self).__init__(*args, **kwargs)
  self.question = question
  self.fields['answers'].choices = ...
 
I also have some meta-information in the form, such as a security hash
to make sure the form isn't modified, so that uses another form class
(which currently just contains the security hash, but I might need other
stuff when I flesh things out).

Then my view will look like this:

def quiz_view(request, quiz_id):
   quiz = Quiz.objects.get(pk=quiz_id)
   if request.method == 'POST':
  # TODO ...
   else:
  meta = MetaForm(quiz)
  q_forms = []
  for num, question in enumerate(quiz.questions.all()):
 q_forms.append(QuestionForm(question, prefix=str(num)))
   return render_to_response('quiz.html', {'meta': meta_form,
  'question_forms': q_forms})

and then, in the template:

   
  {{ meta }}
  {% for form in question_forms %}
 {{ form.question }}
 {{ form.as_p }}
  {% endfor %}
  
   

Obviously, a lot has been glossed over here (and there are no doubt some
bugs, as I haven't finalised the code in my case yet and I'm simplifying
a bunch of stuff). The point I want to make, though, is that I'm using
multiple form classes to render a *single* HTML form. I'm also shoving
things like the question text into the appropriate form so that I can
use that normally in the template (it's not a form field, so it wouldn't
normally be displayed).

In the final analysis, I'll end up pulling out the form creation stuff
into a separate function, since I need to do it in multiple places (at
least, in both the POST and GET paths), but that's just normal stuff.

Hopefully this gives you another idea to play with. I don't think any of
your options allowed for the possibility of multiple form classes, but
sometimes that can make things a lot easier.

Regards,
Malcolm

-- 
Save the whales. Collect the whole set. 
http://www.pointy-stick.com/blog/


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



Replicating admin behavior in front end

2008-01-03 Thread Rodrigo Culagovski

I am making a site that will handle and display a magazine article
database. I would like for front end (anonymous, not logged in) users
to be able to use some of the same functionality the admin interface
offers, namely the ability to sort by column (and reverse the order),
and filter by year, publication, etc.
Ideally, it should be as easy as adding the 'Admin' subclass is to a
class in models.py:

class Admin:
list_display = ('titulo', 'revista', 'ano','visible')
list_filter = ('revista', 'pais','categoria','ano')
ordering = ('-ano',)
search_fields = ('titulo','autores','revista')
date_hierarchy = 'fecha_modificacion'
save_on_top = True

Basically, I wonder if there's some read-only, public version of the
admin interface.

Thanks,

Rodrigo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Counting and indexing objects

2008-01-03 Thread Malcolm Tredinnick


On Thu, 2008-01-03 at 15:20 +, Tom Badran wrote:
> Thanks for the hints Tim. The problem is that i'm not using the whole
> sequence, im just pulling one item out of the query set and was hoping
> for a way to get the position without having to use the whole set, in
> the same vain that count() is much more sensible a choice than len()
> as it gets optimised down to an SQL count by django. Thanks for
> pointing out enumerate though, im actually embarrassed i didn't know
> that, it looks very very useful. 

The problem is that you're asking for the equivalent of "given an object
x that came from a list L at some random point in the past, what is the
index of x in L?" Note that the answer is NOT necessarily L.index(x) for
Python lists, because that only finds the first occurrence of "x" (and
it's not L.index(x) for all iterable sequence, since the index concept
isn't necessarily determinable for a non-reversible iterator). What I'm
trying to say is that the general case is not solvable here. You need to
know how you got the original object to know where it came from. So it's
very much going to depend on how you pulled out the object 'x'.

Do you have some short code that demonstrates how you are extracting the
object in the first place? That might help with suggestions as to how
you can note the position later.

Regards,
Malcolm

-- 
Why be difficult when, with a little bit of effort, you could be
impossible. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: render xml component in container

2008-01-03 Thread Malcolm Tredinnick


On Wed, 2008-01-02 at 22:44 -0800, Tiger Uppercut wrote:
> Hi,
> 
> I'm looking for the most pythonic [or djangonautic] way to render a
> FusionChart [http://www.fusioncharts.com/gadgets/docs/] in Django.  I
> searched through the forums and didn't see this addressed directly --
> my apologies if this is very basic and obvious! 
> 
> 1. I have a django template, container.html:
> 
> {% block head %}
>  src="/site_media/swf/Charts/FusionCharts.js">
> {% endblock head %}
> 
> {% block main_content %}
>
> The chart will appear within this DIV. This text will
> be replaced by the chart. 
>   
>   
> 
> var myChart = new
> FusionCharts("/site_media/swf/Charts/HLinearGauge.swf",
> "myChartId", "400", "200", "0", "0");  
> 
> myChart.setDataXML("your_data.xml"); 
> 
> myChart.render("chartdiv"); 
> 
>   
> {% endblock main_content %}
> 
> 2. your_data.xml is also a django template, stored in
> myapp/templates/you/your_data.xml, and the TEMPLATE_DIRS setting
> includes myapp/template 
> 
>  upperLimitDisplay='Good' palette='1' numberSuffix='%'
> chartRightMargin='20'>
>
>label='Bad'/>
>label='Moderate'/>
>label='Good'/>
>
>
>   
>
> 
> 
> 3. I have a view --- def your_data(request).  I want this view to
> 
> 
> a) populate the your.value object in the xml template -- your_data.xml
> b) render the containing template, container.html.
> 
> 
> Any suggestions on the best approach for this ... ?

I think you've got the horse and cart is slightly the wrong order here.
Rendering the first template should be easy, since it's just a normal
render_to_response() call. It looks like this is designed to be part of
some larger template that wraps things in html elements, etc. So maybe
there's a {% extends "foo.html" %} missing at the top.

Now imagine that you've served that data to the user's browser and it is
executing away. It gets to the point where it needs the file
your_data.xml and so will, at that point only, call back to the
webserver to retrieve the file. So you now need a view that responds to
the request for your_data.xml and serves up the template you've
constructed.

If you know what should be in the context variable "your" at that point,
you've got no problems. The view for your_data.xml just returns the
rendered template. If you don't know "your", but you did know it when
you served the original template, you have to get a bit tricky. You
could change the name of the XML template from your_data.xml to
your_data_.xml (where  is some identifier). Then your URL
pattern knows how to serve things that look like

^your-data-(?P\d+).xml$

and your view function will take an "ident" parameter that tells you how
to look up the "your" object for populating the data. You could also
shove this information into the user's session or use a query parameter,
but munging the name makes things nice and clear and RESTful, so it
would be my natural reaction.

In short, this isn't a single view, since it's multiple HTTP requests
from the browser (this is what I meant by getting things in the right
order: one view is one request, so work out the requests to determine
the views you need). You need two views and (maybe) some way of passing
information from the first response to the second.

Regards,
Malcolm

> 
-- 
A conclusion is the place where you got tired of thinking. 
http://www.pointy-stick.com/blog/


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

2008-01-03 Thread Marty Alchin

On 1/3/08, LRP <[EMAIL PROTECTED]> wrote:
> Ah, Django promises much, but so far has delivered nothing but Mal de
> Mar. Please tell me that there is smoother sailing beyond this patch
> of troubled waters.

First off, let me say that I absolutely love your nautical theme! I do
tend to call Django users Djangonauts, so it's great to see an email
written like this. (and no, that's not sarcasm, I really dig it!)

> 1) Picked as my nautical chart The Django Book... Must be
> authoritative, right?

As authoritative as a dead tree book about ever-evolving software can
be, anyway.

> 2) We've barely cast moorings and into Chapter 2 when The Book tells
> me to pick a database. Fine. I have an affinity for Postgres. Tells me
> to find and install pyscopg. OK, I find it, try to install it
> according to instructions. Get mysterious error message. Double check
> all my work. No help. Post problem to this fine forum. No response.

First, besides being a requirement, the process of installing Python
database drivers is outside the scope of Django itself. Microsoft
Office doesn't tell you how to obtain and install Windows, does it?

Second, while many of us take pride in the quality and responsiveness
of the Django community, the lack of response on one question
shouldn't be used as an indicator of the quality of the software.

> Now that's nervous making. On two counts.

So far, I can only see that you've had one problem, which doesn't
quite add up to two. But who's counting?

> 3) Ah, the clouds part! Further digging leads me to discover that
> pyscopg is available as python-psycopq2 in the Debian etch
> repository.  Excellent! Aptitude loads it up in a jiffy and the sea is
> calm again!
>
> Why didn't The Book steer me right to begin with?

Because its authors aren't psychic. That may sound cheeky, but that's
the simple truth. Not everybody uses Debian, or any other environment
for that matter, so it's impossible to predict precisely what
instructions you'll need. And including instructions for every
possible combination would require a book of its own.

> 4) I create a project. Launch the built-in web server. Success! See
> the friendly blue banner. Feeling good.

Congrats!

> 5) But... We sail on to Chapter 3. Create the view
> current_datetime(request) in views.py. Done. and map the view to the
> URL in urls.py as follows:
>
> urlpatterns = patterns(",
> (r'^time/$' , current_datetime),
> )
>
> I follow the instructions meticulously.  Double-check the code. Enter
> the URL...
>
> Shipwreck!
>
> 6) I get the error message 'function' object has no attribute 'rindex'
> Exception location: /var/lib/python-support/python2.4/django/core/
> resolvers.py in get_mod_func, line 23
>
> Who ordered up this "rindex?"

It sounds like you're using Django 0.95, which worked a little bit
differently with regard to the code you wrote. Upgrade to 0.96.1 or
check it out from SVN and you'll be fine. While the book does fall
short of explicitly demaning 0.96 (though the web site is much more
clear about this), it does quite clearly indicate the version number
in the installation section of Chapter 2.

The authors clearly expected that anyone who hadn't already been using
Django when they purchased the book would simply download the current
release, which had been 0.96 for quite some time before the book was
published.

> Am I expected to flounder around in the bowls of django to make this
> tub seaworthy? This newbie is beginning to feel like Django may not be
> all that seaworthy. Or maybe the chart has steered me wrong? Or could
> it be my novice seamanship? Whatever. We're barely out of harbor and
> the good ship is leaking like a sieve.

Again, nothing so far has indicated any faults with the ship itself,
just with your particular voyage. That's not to say there's anything
wrong with you, of course. There are just a variety of factors at work
(Debian with some type of compiling problem, a lack of psycopg experts
at the time of your question, and an old copy of Django) that are
combining to cause you some problems, but they're all beyond what the
software or its developers can control.

> And so, I put this note in a bottle and cast it to the waves. Please
> tell me how I can caulk the leaky seams, continue afloat, and earn my
> sea legs.

Well, you've already done everything you need, and then some. The two
most important pieces of advice I can offer are as follows:

* Be willing to do some digging when problems occur. Quite often, a
quick Google search reveals many answers to known problems.

* Ask questions when you get stuck. I appreciate that your first
question didn't get turn out so well, but that's the exception, not
the rule. You can ask here or on IRC[1], but be willing to give people
some time to answer.

> And please reassure me that it's worth it.

I don't know how reassuring I can be over the Internet, but I can tell
you that after just 2 days of using Django, I uninstalled everything I
can used previously. And n

Re: Django... False promises?

2008-01-03 Thread Jeff Anderson
Hello!

I am amused by your extensive use of the nautical analogy.

1) nautical charts
I haven't used the django book myself, I prefer to use
www.djangoproject.org/documentation
I also use the svn version, which has many more features than 0.96.

2) If you are interested in just playing with the django api, try using
sqlite instead of postgresql. It is lightweight, and suitable for
testing (and even low-traffic websites in a production environment).
Your misfortune at the pyscopg strait is a tragic one, but there are
other channels to choose, sqlite being only one choice. Unfortunately,
postgresql support depends on this external module, and the difficulty
you had is hardly the fault of django itself.
Posts relating to things outside of django belong on their respective
lists, such as a debian forum, or even a list relating to the module
itself. Questions out of the scope of this mailing list do tend to go
unanswered, which is unfortunate, but I wouldn't have been much help, as
I have never touched postgresql, let alone any python modules to
interface with it.
Setup of external modules are outside the scope of the book, especially
when talking about a platform-dependent setup. If they included
instructions for setting it up on debian, they'd also have to include
them for gentoo, mac os x, windows XP, windows vista, freebsd, solaris,
rhel5, gobo linux, and many others. The book would then be a reference
manual on how to install module x (where x is anything that django might
need to use) rather than a book on django itself.

3-4-5) This sounds like you did experience some of the nice things that
django has to offer. Remember the good things!

6) This has been answered in other replies to this thread, so I won't
touch on it.

I was exposed to django when I was a beginning python programmer. I have
found that to fully appreciate and understand some of the features of
django, it was necessary for me to get familiar with more python. I can
understand your frustration installing the pyscopg module, especially if
you had never installed a python module before.

There are times when I am revising a project, or starting a new one, and
I really appreciate all the work and time django saves me. I fully
recommend learning more about django and about python-- it will end up
being a time investment well worth it!

Good Luck!

Jeff Anderson

LRP wrote:
> Ah, Django promises much, but so far has delivered nothing but Mal de
> Mar. Please tell me that there is smoother sailing beyond this patch
> of troubled waters.
>
> 1) Picked as my nautical chart The Django Book... Must be
> authoritative, right?
>
> 2) We've barely cast moorings and into Chapter 2 when The Book tells
> me to pick a database. Fine. I have an affinity for Postgres. Tells me
> to find and install pyscopg. OK, I find it, try to install it
> according to instructions. Get mysterious error message. Double check
> all my work. No help. Post problem to this fine forum. No response.
>
> Now that's nervous making. On two counts.
>
> 3) Ah, the clouds part! Further digging leads me to discover that
> pyscopg is available as python-psycopq2 in the Debian etch
> repository.  Excellent! Aptitude loads it up in a jiffy and the sea is
> calm again!
>
> Why didn't The Book steer me right to begin with?
>
> 4) I create a project. Launch the built-in web server. Success! See
> the friendly blue banner. Feeling good.
>
> 5) But... We sail on to Chapter 3. Create the view
> current_datetime(request) in views.py. Done. and map the view to the
> URL in urls.py as follows:
>
> urlpatterns = patterns(",
> (r'^time/$' , current_datetime),
> )
>
> I follow the instructions meticulously.  Double-check the code. Enter
> the URL...
>
> Shipwreck!
>
> 6) I get the error message 'function' object has no attribute 'rindex'
> Exception location: /var/lib/python-support/python2.4/django/core/
> resolvers.py in get_mod_func, line 23
>
> Who ordered up this "rindex?"
>
> Am I expected to flounder around in the bowls of django to make this
> tub seaworthy? This newbie is beginning to feel like Django may not be
> all that seaworthy. Or maybe the chart has steered me wrong? Or could
> it be my novice seamanship? Whatever. We're barely out of harbor and
> the good ship is leaking like a sieve.
>
> And so, I put this note in a bottle and cast it to the waves. Please
> tell me how I can caulk the leaky seams, continue afloat, and earn my
> sea legs.
>
> And please reassure me that it's worth it.
>
> Many thanks,
>
> Lloyd
>
>
>
> --~--~-~--~~~---~--~~
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com
> To unsubscribe from this group, send email to [EMAIL PROTECTED]
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en
> -~--~~~~--~~--~--~---
>
>   




signature.asc
Des

Re: Django... False promises?

2008-01-03 Thread Malcolm Tredinnick


On Thu, 2008-01-03 at 16:51 -0800, LorenDavie wrote:
> Hi  Lloyd,
> 
> In your urls.py file, you want to specify the  view as a string -
> you're currently missing the quotes around it.  It should look like
> this:
> 
> urlpatterns = patterns(",
> (r'^time/$' , 'current_datetime'), # <-- quotes added!
> )
> 
> The (not particularly helpful) message you're getting is django
> attempting a string operation (an rindex - right index) on an actual
> python function object instead of a string.  I'm guessing that you
> imported the view into the urls.py file, which is how you even got
> that far.

Okay ,this is twice now that somebody's written this. It isn't true!

For quite a while Django has allowed function references as the second
argument in a URL tuple. It makes for slightly safer code (typos get
caught early, for example) and shorter code, too.

As Fredrik Lundh pointed out, the "callable has no attribute rindex"
error points to the original poster using 0.95, rather than 0.96. There
was a problem with callables not involving periods in their
specification (ticket #2875) and it was fixed in r4047 on November 7,
2006 -- a few months after 0.95 was released.

Regards,
Malcolm

-- 
What if there were no hypothetical questions? 
http://www.pointy-stick.com/blog/


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

2008-01-03 Thread LorenDavie

Hi  Lloyd,

In your urls.py file, you want to specify the  view as a string -
you're currently missing the quotes around it.  It should look like
this:

urlpatterns = patterns(",
(r'^time/$' , 'current_datetime'), # <-- quotes added!
)

The (not particularly helpful) message you're getting is django
attempting a string operation (an rindex - right index) on an actual
python function object instead of a string.  I'm guessing that you
imported the view into the urls.py file, which is how you even got
that far.

Good luck.

On Jan 3, 7:07 pm, LRP <[EMAIL PROTECTED]> wrote:
> Ah, Django promises much, but so far has delivered nothing but Mal de
> Mar. Please tell me that there is smoother sailing beyond this patch
> of troubled waters.
>
> 1) Picked as my nautical chart The Django Book... Must be
> authoritative, right?
>
> 2) We've barely cast moorings and into Chapter 2 when The Book tells
> me to pick a database. Fine. I have an affinity for Postgres. Tells me
> to find and install pyscopg. OK, I find it, try to install it
> according to instructions. Get mysterious error message. Double check
> all my work. No help. Post problem to this fine forum. No response.
>
> Now that's nervous making. On two counts.
>
> 3) Ah, the clouds part! Further digging leads me to discover that
> pyscopg is available as python-psycopq2 in the Debian etch
> repository.  Excellent! Aptitude loads it up in a jiffy and the sea is
> calm again!
>
> Why didn't The Book steer me right to begin with?
>
> 4) I create a project. Launch the built-in web server. Success! See
> the friendly blue banner. Feeling good.
>
> 5) But... We sail on to Chapter 3. Create the view
> current_datetime(request) in views.py. Done. and map the view to the
> URL in urls.py as follows:
>
> urlpatterns = patterns(",
>     (r'^time/$' , current_datetime),
> )
>
> I follow the instructions meticulously.  Double-check the code. Enter
> the URL...
>
> Shipwreck!
>
> 6) I get the error message 'function' object has no attribute 'rindex'
> Exception location: /var/lib/python-support/python2.4/django/core/
> resolvers.py in get_mod_func, line 23
>
> Who ordered up this "rindex?"
>
> Am I expected to flounder around in the bowls of django to make this
> tub seaworthy? This newbie is beginning to feel like Django may not be
> all that seaworthy. Or maybe the chart has steered me wrong? Or could
> it be my novice seamanship? Whatever. We're barely out of harbor and
> the good ship is leaking like a sieve.
>
> And so, I put this note in a bottle and cast it to the waves. Please
> tell me how I can caulk the leaky seams, continue afloat, and earn my
> sea legs.
>
> And please reassure me that it's worth it.
>
> Many thanks,
>
> Lloyd
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django... False promises?

2008-01-03 Thread J. Clifford Dyer


On Thu, 2008-01-03 at 16:07 -0800, LRP wrote:
> Ah, Django promises much, but so far has delivered nothing but Mal de
> Mar. Please tell me that there is smoother sailing beyond this patch
> of troubled waters.
> 
> 1) Picked as my nautical chart The Django Book... Must be
> authoritative, right?
> 

Should be a pretty good choice.  I haven't received my copy yet, though,
so I can't say for sure.

> 2) We've barely cast moorings and into Chapter 2 when The Book tells
> me to pick a database. Fine. I have an affinity for Postgres. Tells me
> to find and install pyscopg. OK, I find it, try to install it
> according to instructions. Get mysterious error message. Double check
> all my work. No help. Post problem to this fine forum. No response.
> 
> Now that's nervous making. On two counts.
> 

Subtract one count for the helpful reply you received from Karen Tracey
on Wed, 2 Jan 2008 at 07:35:38 -0500.  Subtract the other count, because
the seaworthiness of your DB installation ought not to reflect on the
fine developers of Django.

If you didn't see the reply, maybe your spam blocker trapped it.  But
you can check the google group if you like:
http://groups.google.com/group/django-users/

> 3) Ah, the clouds part! Further digging leads me to discover that
> pyscopg is available as python-psycopq2 in the Debian etch
> repository.  Excellent! Aptitude loads it up in a jiffy and the sea is
> calm again!
> 
> Why didn't The Book steer me right to begin with?
> 

Did you tell the book you were running Debian Etch?  Maybe it thought
you were on Windows. ;)

> 4) I create a project. Launch the built-in web server. Success! See
> the friendly blue banner. Feeling good.
> 
Yay!

> 5) But... We sail on to Chapter 3. Create the view
> current_datetime(request) in views.py. Done. and map the view to the
> URL in urls.py as follows:
> 
> urlpatterns = patterns(",
> (r'^time/$' , current_datetime),
> )
> 
> I follow the instructions meticulously.  Double-check the code. Enter
> the URL...
> 
> Shipwreck!
> 
> 6) I get the error message 'function' object has no attribute 'rindex'
> Exception location: /var/lib/python-support/python2.4/django/core/
> resolvers.py in get_mod_func, line 23
> 
> Who ordered up this "rindex?"
> 

Clearly, django/core/resolvers.py ordered up this rindex. :)  Your URL
pattern passes in the function current_datetime, while the urls.py file
calls for a string naming a function.  (rindex is a method of string
objects).  Try changing current_datetime to 'current_datetime', and make
sure the first argument to patterns is two single quotes, rather than
one double quote, as it appears above.  (or two double quotes.  It
doesn't really matter.)

> Am I expected to flounder around in the bowls of django to make this
> tub seaworthy? This newbie is beginning to feel like Django may not be
> all that seaworthy. Or maybe the chart has steered me wrong? Or could
> it be my novice seamanship? Whatever. We're barely out of harbor and
> the good ship is leaking like a sieve.
> 

Nope.  Just ask when you get stuck.  Folks are pretty friendly.

> And so, I put this note in a bottle and cast it to the waves. Please
> tell me how I can caulk the leaky seams, continue afloat, and earn my
> sea legs.
> 
> And please reassure me that it's worth it.
> 

It's worth it.  A couple error messages in getting the configuration
right are most assuredly worth it.

> Many thanks,
> 
> Lloyd
> 
> 

No trouble at all.  I'm fairly new to Django myself, so don't assume my
advice is authoritative either, but hopefully it'll point you in the
right direction.  If it doesn't, come on back, and ask again.

Cheers,
Cliff



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

2008-01-03 Thread Fredrik Lundh

LRP wrote:

 > Why didn't The Book steer me right to begin with?

possibly because Django runs on tons of platforms, and those platforms 
tend to change even faster than Django itself.  any attempt to provide 
complete installation details for all possible configuration variants on 
all supported platforms would be probably be outdated within weeks...

> 5) But... We sail on to Chapter 3. Create the view
> current_datetime(request) in views.py. Done. and map the view to the
> URL in urls.py as follows:
> 
> urlpatterns = patterns(",
> (r'^time/$' , current_datetime),
> )

is the " after patterns( a double quote?  shouldn't that result in a 
SyntaxError?

> I follow the instructions meticulously.  Double-check the code. Enter
> the URL...
> 
> Shipwreck!
> 
> 6) I get the error message 'function' object has no attribute 'rindex'
> Exception location: /var/lib/python-support/python2.4/django/core/
> resolvers.py in get_mod_func, line 23
> 
> Who ordered up this "rindex?"

what django version are you using?  the book assumes 0.96 or later. 
your error message might indicate that you're running 0.95.




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

2008-01-03 Thread LRP

Ah, Django promises much, but so far has delivered nothing but Mal de
Mar. Please tell me that there is smoother sailing beyond this patch
of troubled waters.

1) Picked as my nautical chart The Django Book... Must be
authoritative, right?

2) We've barely cast moorings and into Chapter 2 when The Book tells
me to pick a database. Fine. I have an affinity for Postgres. Tells me
to find and install pyscopg. OK, I find it, try to install it
according to instructions. Get mysterious error message. Double check
all my work. No help. Post problem to this fine forum. No response.

Now that's nervous making. On two counts.

3) Ah, the clouds part! Further digging leads me to discover that
pyscopg is available as python-psycopq2 in the Debian etch
repository.  Excellent! Aptitude loads it up in a jiffy and the sea is
calm again!

Why didn't The Book steer me right to begin with?

4) I create a project. Launch the built-in web server. Success! See
the friendly blue banner. Feeling good.

5) But... We sail on to Chapter 3. Create the view
current_datetime(request) in views.py. Done. and map the view to the
URL in urls.py as follows:

urlpatterns = patterns(",
(r'^time/$' , current_datetime),
)

I follow the instructions meticulously.  Double-check the code. Enter
the URL...

Shipwreck!

6) I get the error message 'function' object has no attribute 'rindex'
Exception location: /var/lib/python-support/python2.4/django/core/
resolvers.py in get_mod_func, line 23

Who ordered up this "rindex?"

Am I expected to flounder around in the bowls of django to make this
tub seaworthy? This newbie is beginning to feel like Django may not be
all that seaworthy. Or maybe the chart has steered me wrong? Or could
it be my novice seamanship? Whatever. We're barely out of harbor and
the good ship is leaking like a sieve.

And so, I put this note in a bottle and cast it to the waves. Please
tell me how I can caulk the leaky seams, continue afloat, and earn my
sea legs.

And please reassure me that it's worth it.

Many thanks,

Lloyd



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



Re: Django on MediaTemple (dv) howto?

2008-01-03 Thread Katie Lohrenz

To clarify, that entry is specific to their (gs) accounts with the new
Django containers. The (dv) accounts don't use containers so things
are completely different. And that's been a big pain when trying to
google for (mt)-specific instructions. :( Googling for Plesk-specific
instructions has yielded me slightly better results.

On Jan 3, 3:11 pm, "Ramiro Morales" <[EMAIL PROTECTED]> wrote:
>
> Brian Rosner posted an entry about this on his blog a while back:
>
>  http://oebfare.com/blog/2007/dec/13/django-and-mediatemple/
>
> HTH
>
> --
>  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
-~--~~~~--~~--~--~---



Re: Rendering ManyToManyField in template

2008-01-03 Thread Rodrigo Culagovski

Rajesh,

I was missing the ".all" attribute in my previous attempts.

Thanks,

Rodrigo

On Jan 3, 7:17 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> Hi,
>
>
>
> > {% block content %}
> > {{articulo}}
> > 
> >  identificadores:{{articulo.identificadores}}
> > 
> > {% endblock %}
>
> Since you can have many identificadores, you need to do something like
> this in your template:
>
> 
> {% for ix in articulo.identificadores.all %}
>   {{ ix.identificador  }}
> {% endfor %}
> 
>
> -Rajesh D
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django on MediaTemple (dv) howto?

2008-01-03 Thread Katie Lohrenz

myproject.settings is relative to your python path.

Look at this line:

PythonPath "['/path/to/django'] + sys.path"

/path/to/django is the (hypothetical) folder where all my django
projects live. So inside it is a folder called myproject which has
settings.py in it.

(And if you have more questions and would prefer to email me directly,
feel free. I'm happy to help.)

On Jan 3, 4:27 pm, Josh Ourisman <[EMAIL PROTECTED]> wrote:
> Perfect, exactly what I've been looking for. Thanks!
>
> One other question that I haven't really been able to find a straight
> answer on: what am I actually supposed to replace myproject.settings
> with? Some people seem to be saying that it needs to be the path to
> the settings.py file for my project, is that the case? What should the
> path be relative to?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 especify the default form (html)

2008-01-03 Thread Jeff Anderson

mamcxyz wrote:
> I have 3 forms in the same html. One is for search, another for singup
> y anoter for login. I'm in singup, enter the values and hit enter. But
> search is executed (so, I get a nasty: Invalid login)
>   
In your html, are you using separate form tags? eg:


...
...




...
...



without enclosing your forms in separate tags, a browser might assume it
is all one form, and you would get strange errors like you describe. The
default action for a form is to use the current url as your action.

Good Luck!

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



Ajax widget

2008-01-03 Thread mike

I am trying to implement the Dojo Select box into a template I am
creating.
I have used the formtags that is inluded in the nongselect tar
package. but It seems with the development version of django the
import
statements   {% load formtags %}  no longer work,   I need a way to
replace the

{% selectrow form.reporter "/myapp/reporter_lookup/?q=%{searchString}"
"first_name" %}

Line with raw html for a text input box that will call this ajax
function for me.   I have been googling for days with no luck.
I'm using the newforms library and  form_for_instance



http://code.djangoproject.com/wiki/AJAXWidgetComboBox
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 on MediaTemple (dv) howto?

2008-01-03 Thread Josh Ourisman

Perfect, exactly what I've been looking for. Thanks!

One other question that I haven't really been able to find a straight
answer on: what am I actually supposed to replace myproject.settings
with? Some people seem to be saying that it needs to be the path to
the settings.py file for my project, is that the case? What should the
path be relative to?

On Jan 3, 4:05 pm, Katie Lohrenz <[EMAIL PROTECTED]> wrote:
> Hi, Josh. I'm on a (dv) server, too.
>
> You're right that it's a vhost.conf file that you need to edit. If you
> edit the httpd.conf or httpd.include, it'll be overwritten by Plesk
> next time you change settings in Plesk or when (mt) runs periodic
> server updates.
>
> Create a file called vhost.conf in /var/www/vhosts/YOURDOMAIN.COM/
> conf/ (There should already a file called httpd.include in this
> folder). After that, I had to resave my domain settings in Plesk to
> get Plesk to recognize my vhost file. Alternatively, you can add this
> line before the  line in your httpd.include file:
>
> Include /var/www/vhosts/YOURDOMAIN.COM/conf/vhost.conf
>
> Then all your settings get added to vhost.conf. My file looks
> something like:
>
> SetHandler python-program
> AddHandler mod_python .py
>
> PythonPath "['/path/to/django'] + sys.path"
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE myproject.settings
> PythonDebug Off
>
> 
>         SetHandler None
> 
>
> Also, if you ever want to set up django for a subdomain, create a
> vhost.conf file in /var/www/vhosts/YOURDOMAIN.COM/subdomains/SUBDOMAIN/
> conf/
>
> On Jan 3, 2:30 pm, Josh Ourisman <[EMAIL PROTECTED]> wrote:
>
> > Is there any good howto on setting up Django on a MediaTemple (dv)
> > server? Up until now I've been running various Django-powered sites
> > from Dreamhost. Now I'm migrating all my hosting over to MediaTemple,
> > but I don't seem to be able to get Django running properly. I'm stuck
> > at the point where you have to edit your httpd.conf, although various
> > searches have lead me to believe that there may be a vhosts.conf file
> > hanging around somewhere that's what I actually want to be working
> > with?
>
> > Anyway, I just need to be able to set it up so that browsing 
> > towww.sampledomaina.comtakesyou to a particular Django project, while
> > browsing to other domains that are hosted on the same server continue
> > to take you to the appropriate non-Django sites. Can anyone help me
> > out?
>
> > 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: Rendering ManyToManyField in template

2008-01-03 Thread Rajesh Dhawan

Hi,

>
> {% block content %}
> {{articulo}}
> 
>  identificadores:{{articulo.identificadores}}
> 
> {% endblock %}

Since you can have many identificadores, you need to do something like
this in your template:


{% for ix in articulo.identificadores.all %}
  {{ ix.identificador  }}
{% endfor %}


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



Re: Rendering ManyToManyField in template

2008-01-03 Thread Rodrigo Culagovski

Fixed it, in the class definition:

@property
def ids(self):
return  ' - '.join([a['identificador'] for a in
self.identificadores.values()])


On Jan 3, 6:36 pm, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote:
> I forgot to show the identificadores class:
>
> ---
> class Identificador(models.Model):
> identificador = models.CharField(max_length=200,unique=True)
>
> def __unicode__ (self):
> return self.identificador
>
> class Admin:
> pass
>
> class Meta:
> verbose_name_plural = "identificadores"
> ---
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Rendering ManyToManyField in template

2008-01-03 Thread Rodrigo Culagovski

I forgot to show the identificadores class:

---
class Identificador(models.Model):
identificador = models.CharField(max_length=200,unique=True)

def __unicode__ (self):
return self.identificador

class Admin:
pass

class Meta:
verbose_name_plural = "identificadores"
---

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



Rendering ManyToManyField in template

2008-01-03 Thread Rodrigo Culagovski

Hi,

I am trying to render the contents of a ManyToManyField in a template.
However, when viewing the page, instead of the contents, it shows:
""
I understand why this is happening, sort of, but haven't been able to
fix it.

The field is called "identificadores", deifned in the class "Articulo"
as:

class Articulo(models.Model):
identificadores =
models.ManyToManyField('Identificador',filter_interface=models.HORIZONTAL)


The template looks like:

---
{% extends "revistas/base.html" %}

{% block content %}
{{articulo}}

 identificadores:{{articulo.identificadores}}

{% endblock %}
---

and urls.py:

---
from django.conf.urls.defaults import *
from django.views.generic import list_detail
from bdrevista01.revistas.models import Articulo

articulo_info = {
"queryset" : Articulo.objects.all(),
}

articulo_detail_info = {
"queryset" : Articulo.objects.all(),
"template_object_name" : "articulo",
}


urlpatterns = patterns('',
# Example:
# (r'^bdrevista01/', include('bdrevista01.foo.urls')),

# Uncomment this for admin:
 (r'^admin/', include('django.contrib.admin.urls')),
 (r'^articulos/$', list_detail.object_list, articulo_info),
 (r'^articulos/(?P\d+)/$', list_detail.object_detail,
articulo_detail_info),
)
---
The last line is the relevant one, the URL is of the form:

http://127.0.0.1:8000/articulos/1/

I tried to define a method within the Articulo class that would return
the contents of 'identificadores', but got an 'iteration over non-
sequence' error.

Thanks,

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

2008-01-03 Thread AmanKow

I posted a diff on dpaste:  http://dpaste.com/hold/29777/

This is for a change to django/template/loader_tags.py

This change would add an explicit reuse_block tag.

{% block menu %} ... {% endblock %}

...

{% reuse_block menu %}

This change will actually reuse the parsed block.  It does not create
a new block, getting around issues of multiple block definitions.

This change could be considered for 1.0, it has minimal invasiveness
and is backwards compatible.

Thoughts?  Comments?
Wayne
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 on MediaTemple (dv) howto?

2008-01-03 Thread Ramiro Morales

On Jan 3, 2008 6:30 PM, Josh Ourisman <[EMAIL PROTECTED]> wrote:
>
> Is there any good howto on setting up Django on a MediaTemple (dv)
> server? Up until now I've been running various Django-powered sites
> from Dreamhost. Now I'm migrating all my hosting over to MediaTemple,

Brian Rosner posted an entry about this on his blog a while back:

  http://oebfare.com/blog/2007/dec/13/django-and-mediatemple/

HTH

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



Re: Django on MediaTemple (dv) howto?

2008-01-03 Thread Katie Lohrenz

Hi, Josh. I'm on a (dv) server, too.

You're right that it's a vhost.conf file that you need to edit. If you
edit the httpd.conf or httpd.include, it'll be overwritten by Plesk
next time you change settings in Plesk or when (mt) runs periodic
server updates.

Create a file called vhost.conf in /var/www/vhosts/YOURDOMAIN.COM/
conf/ (There should already a file called httpd.include in this
folder). After that, I had to resave my domain settings in Plesk to
get Plesk to recognize my vhost file. Alternatively, you can add this
line before the  line in your httpd.include file:

Include /var/www/vhosts/YOURDOMAIN.COM/conf/vhost.conf

Then all your settings get added to vhost.conf. My file looks
something like:

SetHandler python-program
AddHandler mod_python .py

PythonPath "['/path/to/django'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE myproject.settings
PythonDebug Off


SetHandler None


Also, if you ever want to set up django for a subdomain, create a
vhost.conf file in /var/www/vhosts/YOURDOMAIN.COM/subdomains/SUBDOMAIN/
conf/

On Jan 3, 2:30 pm, Josh Ourisman <[EMAIL PROTECTED]> wrote:
> Is there any good howto on setting up Django on a MediaTemple (dv)
> server? Up until now I've been running various Django-powered sites
> from Dreamhost. Now I'm migrating all my hosting over to MediaTemple,
> but I don't seem to be able to get Django running properly. I'm stuck
> at the point where you have to edit your httpd.conf, although various
> searches have lead me to believe that there may be a vhosts.conf file
> hanging around somewhere that's what I actually want to be working
> with?
>
> Anyway, I just need to be able to set it up so that browsing 
> towww.sampledomaina.comtakes you to a particular Django project, while
> browsing to other domains that are hosted on the same server continue
> to take you to the appropriate non-Django sites. Can anyone help me
> out?
>
> 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: save sometime cause duplicate data

2008-01-03 Thread Eratothene

This can happen of you multiple times price submit button on the page.

That is why it is recommended to issue HttpRedirect after POST.


Read carefully:
http://www.djangoproject.com/documentation/tutorial04/

On Dec 21 2007, 10:06 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I start only one post request,but the db save two duplicate data in
> sometimes.
> this just occur sometime,why?
>
> I used nginx(use multiple upsteam)+flup+facgi to deloy my django
> application
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Recommended tool for web load & stress testing

2008-01-03 Thread mamcxyz

I remember use JMeter eons ago. I dislike the clunky interface and the
stability problems...

Maybe is improved now?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 especify the default form (html)

2008-01-03 Thread mamcxyz

I don't know if this question is ignorance or what!

I have 3 forms in the same html. One is for search, another for singup
y anoter for login. I'm in singup, enter the values and hit enter. But
search is executed (so, I get a nasty: Invalid login).

I think this must be a obvious usability problem, but my googling not
tell me nothing (except the trick of focus a textbox).


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: creating a profile when a user is created

2008-01-03 Thread Rajesh Dhawan

Hi again,

See Malcolm Tredinnick's reply in this thread for another possible
approach:
http://groups.google.com/group/django-users/browse_thread/thread/9b4ffa2a85c522fb/be02ebbccd69240f#be02ebbccd69240f

Basically, he suggests the possibility of adding a higher priority URL
pattern that goes to your own view after the admin creates a User
object. I don't think that approach will work with "save and add
another" but will work with a "save".

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



Re: creating a profile when a user is created

2008-01-03 Thread Rajesh Dhawan

Hi Milan,

On Jan 3, 2:37 pm, Milan Andric <[EMAIL PROTECTED]> wrote:
> Is it possible to set the destination of a redirect after a create in
> the admin?

Not without hacking into the Django admin code.

>
> My scenario is such that when users are created it's also necessary to
> create a profile object.  I'm trying to figure out a quick (possibly
> hack) that would make creating a user and profile easier.  (I know,
> it's just one more step, but it's a hassle.) One possibility is to
> just redirect people to the create profile page after a user is
> created.
>
> I thought about subclassing or patching the the User model's save()
> method to also create a profile on create.  But I'd like to avoid
> adding my own patches into django if possible.

If it's sufficient to create a profile without user intervention, you
can hook onto Django's "post_save" signal. In other words, Django can
be asked to call your custom Python function whenever a User.save() is
completed. The code goes something like this:

from django.contrib.auth import models

def user_created(sender, instance):
# create profile for user instance here

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

Basically, you add this code to one of your applications' __init__.py
(or project's __init__.py) or anywhere else where it's guaranteed to
load when the application is started.

See more about signals here: http://code.djangoproject.com/wiki/Signals

If you need the user profile to also be filled up with user entered
data, you will need to create your own user creation view that
redirects to a profile creation view, etc.

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



Django on MediaTemple (dv) howto?

2008-01-03 Thread Josh Ourisman

Is there any good howto on setting up Django on a MediaTemple (dv)
server? Up until now I've been running various Django-powered sites
from Dreamhost. Now I'm migrating all my hosting over to MediaTemple,
but I don't seem to be able to get Django running properly. I'm stuck
at the point where you have to edit your httpd.conf, although various
searches have lead me to believe that there may be a vhosts.conf file
hanging around somewhere that's what I actually want to be working
with?

Anyway, I just need to be able to set it up so that browsing to
www.sampledomaina.com takes you to a particular Django project, while
browsing to other domains that are hosted on the same server continue
to take you to the appropriate non-Django sites. Can anyone help me
out?

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: Accessing request object in templates

2008-01-03 Thread Marty Alchin

On Jan 3, 2008 2:33 PM, annacoder <[EMAIL PROTECTED]> wrote:
>
> I understand *how* it is done.
>
> But, my question was not related to the how part.

Here's a quick rundown of the "why".

Templates aren't triggered by HTTP requests like views are. Instead,
they're rendered inside views, which *are* triggered by HTTP requests.
Since the request triggers the view, it makes sense for the view to
receive the request object. Since templates are rendered by views, it
makes sense for templates to receive whatever the view sends them, and
nothing more. This is a design decision for at least a few reasons.

1) It allows templates to be more easily used outside of views, for
things like rendering reports about the content in the database or
anything else you might imagine.

2) It provides a clean separation of concerns. Views deal with
requests and responses, templates deal with variables and output
formatting. And since the view's the one "in charge" of the
relationship, it should be up to the view to decide what the template
gets access to.

3) The request would have to come from somewhere. Either you provide
it to the template explicitly (usually via RequestContext) or the
template code has to reach into Python's internal runtime data to
magically retrieve the request from the view. This process is very bad
because it:

  * isn't very fast
  * is very very ugly
  * is far from foolproof
  * makes the view feel like Rob Lowe at the end of Wayne's World (if
you haven't seen it, trust me, it's not a good thing)

4) If you're more philosophical, this is also covered very clearly in
Tim Peter's Zen of Python: "Explicit is better than implicit." You
explicitly send the request to the template, so it's a Good Thing.

-Gul

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Need help creating a composite database index

2008-01-03 Thread Matt Wilson

Thanks!


On Jan 3, 1:32 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> Hi,
>
> On Jan 3, 12:28 pm, Matt Wilson <[EMAIL PROTECTED]> wrote:
>
> > This is the postgresql index I want to create:
>
> > CREATE UNIQUE INDEX v2category_nameIndex ON v2category
> > (v2organization_id, parent_category, lower(name));
>
> > How do I create this index with the Django model?
>
> This will get you close but it doesn't support function calls (like
> lower()):
>
> http://www.djangoproject.com/documentation/model-api/#unique-together
>
> So, you will need to create that INDEX through custom sql, if that
> function call is necessary:
>
> http://www.djangoproject.com/documentation/django-admin/#sqlcustom-ap...
>
> -Rajesh D
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



creating a profile when a user is created

2008-01-03 Thread Milan Andric

Is it possible to set the destination of a redirect after a create in
the admin?

My scenario is such that when users are created it's also necessary to
create a profile object.  I'm trying to figure out a quick (possibly
hack) that would make creating a user and profile easier.  (I know,
it's just one more step, but it's a hassle.) One possibility is to
just redirect people to the create profile page after a user is
created.

I thought about subclassing or patching the the User model's save()
method to also create a profile on create.  But I'd like to avoid
adding my own patches into django if possible.

Thanks for your advice,

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



Re: Accessing request object in templates

2008-01-03 Thread annacoder

I understand *how* it is done.

But, my question was not related to the how part.


On Jan 4, 12:17 am, Ariel Calzada <[EMAIL PROTECTED]> wrote:
> venkata subramanian wrote:
> > Hi,
> >  I had a problem recently.
> >  To access the request object in all of my templates.
> >  The solution I got surprised me. It involved explicitly passing on
> > the request object from the views.
> >  (Example, to pass a RequestContext object as a context_instance
> > parameter in render_to_response method).
>
> > It surprised me because since request object is available to every
> > view, why should the request
> > object not be accessible in all templates by default?
>
> > I am just eager to understand this design decision.
>
> > Thanks.
>
> You can do it
>
> in settings.py add:
>
> TEMPLATE_CONTEXT_PROCESSORS = (
>  'django.core.context_processors.auth',
> 'django.core.context_processors.request',
> )
>
> and in every view import:
>
> from django.template  import RequestContext
>
> adn finally when you make a render to response:
>
> return render_to_response ( "TEMPLATEFILE",   {},  context_instance =
> RequestContext ( request ),  )
>
> ARIEL ( 000PaRaDoX000 )
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Accessing request object in templates

2008-01-03 Thread annacoder

Can you explain what is the security issue?


On Jan 3, 10:58 pm, Sam Lai <[EMAIL PROTECTED]> wrote:
> Security maybe?
>
> Not sure, but if you add django.core.context_processors.request to
> your TEMPLATE_CONTEXT_PROCESSORS list in settings.py, you won't have
> to explicitly add the request object in every view. You still have to
> pass a RequestContext object to the render_to_response method, but you
> should be doing that anyway if you plan on using any context
> processors (which are useful for other things like users), because
> otherwise, none of the context processors get added.
>
> It would be easier if a RequestContext object gets passed by the
> render_to_response method automatically, but that isn't to hard to
> change by creating a new method.
>
> Sam
>
> On Jan 4, 1:40 am, "venkata subramanian"
>
> <[EMAIL PROTECTED]> wrote:
> > Hi,
> >  I had a problem recently.
> >  To access the request object in all of my templates.
> >  The solution I got surprised me. It involved explicitly passing on
> > the request object from the views.
> >  (Example, to pass a RequestContext object as a context_instance
> > parameter in render_to_response method).
>
> > It surprised me because since request object is available to every
> > view, why should the request
> > object not be accessible in all templates by default?
>
> > I am just eager to understand this design decision.
>
> > 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: Accessing request object in templates

2008-01-03 Thread Ariel Calzada

venkata subramanian wrote:
> Hi,
>  I had a problem recently.
>  To access the request object in all of my templates.
>  The solution I got surprised me. It involved explicitly passing on
> the request object from the views.
>  (Example, to pass a RequestContext object as a context_instance
> parameter in render_to_response method).
>
> It surprised me because since request object is available to every
> view, why should the request
> object not be accessible in all templates by default?
>
> I am just eager to understand this design decision.
>
> Thanks.
>
> >
>
>   
You can do it

in settings.py add:

TEMPLATE_CONTEXT_PROCESSORS = (
 'django.core.context_processors.auth',
'django.core.context_processors.request',
)

and in every view import:

from django.template  import RequestContext

adn finally when you make a render to response:

return render_to_response ( "TEMPLATEFILE",   {},  context_instance = 
RequestContext ( request ),  )

ARIEL ( 000PaRaDoX000 )






--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: passing data to view using httpresponseredirect

2008-01-03 Thread Peter Rowell

I didn't like my own explanation and did a little more searching.

I just found a better description of this at
http://requires-thinking.blogspot.com/2007/10/note-to-self-default-parameter-values.html.

He points out that the 'def' is an executable statement and it's only
executed once. Therefore, the foo=[] only happens once.

See the Python Language Reference for the authoritative description
  http://docs.python.org/ref/function.html

Note the subsection titled "Default parameter values are evaluated
when the function definition is executed."
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Need help creating a composite database index

2008-01-03 Thread Rajesh Dhawan

Hi,

On Jan 3, 12:28 pm, Matt Wilson <[EMAIL PROTECTED]> wrote:
> This is the postgresql index I want to create:
>
> CREATE UNIQUE INDEX v2category_nameIndex ON v2category
> (v2organization_id, parent_category, lower(name));
>
> How do I create this index with the Django model?

This will get you close but it doesn't support function calls (like
lower()):

http://www.djangoproject.com/documentation/model-api/#unique-together

So, you will need to create that INDEX through custom sql, if that
function call is necessary:

http://www.djangoproject.com/documentation/django-admin/#sqlcustom-appname-appname

-Rajesh D


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



Re: passing data to view using httpresponseredirect

2008-01-03 Thread Peter Rowell

> def new(request, errors = [], messages = []):
> ...
> [ snip]
> unfortunatly, django somehow remembers this and the arrays don't get cleaned 
> up.

It's not django that's tripping you up.

> So, normal python rules say these should get default values [] and
> thus be cleared.

Actually, normal python rules say "Don't do this."  It is (IMHO) one
of the less intuitive aspects of the language -- it's consistent, just
not intuitive. If the default value for a parameter is mutable (in
this case, a list) then what happens is that each time the function is
called without that param, then it *uses the same mutable object* for
the default value. This is why it has "memory".

Instead, set the params to None and test for that in the function.
E.g.

def new(request, errors = None, messages = None):
if errors is None:
errors = []
if messages is None:
messages = []
...

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



A proposal for syncdb finished

2008-01-03 Thread Chris Green

I've been upgrading my unit testing to use the django TestCase
framework [1].  I wrote a single function that inspects my
permissions:

setup_auth()
g1,g2, g3 create_groups()
perms1 = [permission_finder('app1.perm1'), permission_finder('app2.perm1]
perms2 =  perms + [permission_finder('app3.perm1'),]
add_perms(g1,perms)
add_perms(g2,perms2)
add_users_to_groups()

I then add those permissions to groups as a basis for all my cross-app
'role' testing within django.  I can call that from setUp across all
my derived unit tests (or inherit from my own testCase).  I think
signals would be a more elegant solution but I've run into 'fire
ordering' issue.

contrib.auth.management registers:

   dispatcher.connect(create_permissions, signal=signals.post_syncdb)

If I then add setup_auth to the same signal, my setup_auth code
triggers prior to create_permissions, making my code fail.  If I
switch to fixdumpdata on the auth app, I end up with pretty hairy
maintenance as I change what permissions groups have and whittling the
fixture down to the smallest unit.

My current solution is to include a custom TestCase involving
_pre_setup().   While that works for me, I think that the "after
everything syncs with the database but before we do anything else" is
a good place to handle cross-app issues and I think it's where several
people are looking [2][3].  The patch is fairly simple
(syncdb_finished  -> models/signals.py and a syncdb_finished signal ->
emit_syncdb_signals after the for model ... loop).

References:

[1] My discussion with Russ Magee explaining using signals to address
the account authorization problem:
   http://groups.google.com/group/django-users/msg/e8b936529a4fbe97

[2] Someone else running into similar issue (looked like a support
request so it got marked as invalid):
   http://code.djangoproject.com/ticket/6040

[3] Someone having the same idea and redirected towards fixtures
 
http://groups.google.com/group/django-users/browse_thread/thread/cb0e199820b1ff7d
-- 
Chris Green <[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: Foreignkey relationship trouble

2008-01-03 Thread Rajesh Dhawan

Hi,

> I have a class Photo and a class Category with a one to many
> relationship (many pictures can be in one category, but each photo can
> be in only one category)...
> I want to do an app for mysite/photo/category/OneCategory/ and have
> all picture in OneCategory... Nothing fancy.
> So far I managed to do it with mysite/photo/category/1 or 2 or n, n
> being the category.id but never with the actual name of the
> category...

First, setup your URL configuration regular expression to capture the
category name you need to match. That would be something like this:

(r'^photo/category/(?P[\w]+)/$', 'photos_by_category_view'),

That will call your view function photos_by_category_view with xyz
when you browse to the URL: /photo/category/xyz/

In your view function, you need a query set that will fetch all
relevant Photo objects. So, something like this would work there:

def photos_by_category_view(request, cat_name):
photos = Photo.objects.filter(category__name=cat_name)
# Send photos to your template, etc...

-Rajesh D

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



Re: Accessing request object in templates

2008-01-03 Thread Alex Koshelev

No. RequestContext instance used to handle context processors. It
doesn't pass request instance to the context. Request instance passed
to template context only by "django.core.context_processors.request"
if its installed.

On 3 янв, 20:40, "venkata subramanian" <[EMAIL PROTECTED]>
wrote:
> Hi,
>  I had a problem recently.
>  To access the request object in all of my templates.
>  The solution I got surprised me. It involved explicitly passing on
> the request object from the views.
>  (Example, to pass a RequestContext object as a context_instance
> parameter in render_to_response method).
>
> It surprised me because since request object is available to every
> view, why should the request
> object not be accessible in all templates by default?
>
> I am just eager to understand this design decision.
>
> 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: Accessing request object in templates

2008-01-03 Thread Sam Lai

Security maybe?

Not sure, but if you add django.core.context_processors.request to
your TEMPLATE_CONTEXT_PROCESSORS list in settings.py, you won't have
to explicitly add the request object in every view. You still have to
pass a RequestContext object to the render_to_response method, but you
should be doing that anyway if you plan on using any context
processors (which are useful for other things like users), because
otherwise, none of the context processors get added.

It would be easier if a RequestContext object gets passed by the
render_to_response method automatically, but that isn't to hard to
change by creating a new method.

Sam

On Jan 4, 1:40 am, "venkata subramanian"
<[EMAIL PROTECTED]> wrote:
> Hi,
>  I had a problem recently.
>  To access the request object in all of my templates.
>  The solution I got surprised me. It involved explicitly passing on
> the request object from the views.
>  (Example, to pass a RequestContext object as a context_instance
> parameter in render_to_response method).
>
> It surprised me because since request object is available to every
> view, why should the request
> object not be accessible in all templates by default?
>
> I am just eager to understand this design decision.
>
> 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
-~--~~~~--~~--~--~---



Basic Form Design Question: Pulling as much as possible from models

2008-01-03 Thread Wes Winham

Hello,

I've got a bit of a design issue I'm trying to wrap my head around in
order to do things the Django Way.

I'm attempting to creating a simple form that allows a user to take a
multiple choice "quiz." Quiz is a model and it has a many to many with
Questions which has a m2m with AnswerOptions.

I'm also not sure on which is the best way to get the questions and
answers to the form and I'm not sure if I should be using one form, or
a collection of forms.

I guess I'll try and outline the options I have in my mind right now
and hope someone can clarify what they would choose.

Getting data to the form:
A. Pass a Quiz to the form and then drag out the questions and answer
options in __init__, and set a ChoiceField for each question with the
AnswerOptions as the choices and with the label set to the text of the
question
B. Pass a dictionary of questions with the question text as the key
and the options as the value and then do the parsing in __init__ to
set the ChoiceFields
C. Something else that makes creating an arbitrary number of
ChoiceFields easier

Setting up the form:
E. Create one form called TakeQuiz that uses one of the options from
above to set a bunch of ChoiceField's
F. Create a form called AnswerQuestion that only has one ChoiceField
and takes a question and a list of choices. Then string those together
in the view.

G. Something totally different.

Any input on what is most inline with the Django way of doing things
would be appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to use random of Built-in filter reference in templates?

2008-01-03 Thread Alex Koshelev

> ./manage.py shell
>>> from django.template.defaultfilters import random
>>> l = [ 1, 2, 3, 4 ]
>>> random( l )
2
>>> random( l )
1
>>> random( l )
4
>>> random( l )
2
>>> random( l )
2
>>> random( l )
3

In template context behaviour is the same.

On 3 янв, 19:09, "jt.wang" <[EMAIL PROTECTED]> wrote:
> hi ,
> we can  see
>
> "random
>
> Returns a random item from the 
> list."fromhttp://www.djangoproject.com/documentation/templates/.butit is 
> diffcult
> to understand without examples.
> so,is there anyone who can give me an example about "random" of Built-in
> filter reference in templates?
>
> thanks!
>
>  wjtbox01.vcf
> 1KЗагрузить
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Accessing request object in templates

2008-01-03 Thread venkata subramanian

Hi,
 I had a problem recently.
 To access the request object in all of my templates.
 The solution I got surprised me. It involved explicitly passing on
the request object from the views.
 (Example, to pass a RequestContext object as a context_instance
parameter in render_to_response method).

It surprised me because since request object is available to every
view, why should the request
object not be accessible in all templates by default?

I am just eager to understand this design decision.

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: Foreignkey relationship trouble

2008-01-03 Thread Maarten

Hello,

I'm no pro about this yet.
But probably you need to explicitly use the object as follows:

If you don't use the primary key (default = id), you must first
retrieve the object:
objectA = ObjectA.objects.get(name = ...)
then you can use it:
objectB = ...(... , fk_to_ObjectA = objectA)

using the primary key you can go directly:
objectB = ...(..., fk_to_objectA = pk_value)

in your case:
foto = Photo.objects.create(photo_name = "...", category =
Category.objects.get(name = request.POST['name'])
while you can use foto = Photo.objects.create(photo_name = "...",
category = request.POST['id'])

Don't know if this is exactly what you are asking, but it should help
out.

Regards,
Maarten

hern42 schreef:
> Hello,
> I have an issue (it might be a beginner issue, if so I am sorry...
> please point to the chapter in the doc)
>
> I have a class Photo and a class Category with a one to many
> relationship (many pictures can be in one category, but each photo can
> be in only one category)...
> I want to do an app for mysite/photo/category/OneCategory/ and have
> all picture in OneCategory... Nothing fancy.
> So far I managed to do it with mysite/photo/category/1 or 2 or n, n
> being the category.id but never with the actual name of the
> category...
>
> What am I missing?
> I am pretty sure it is quite dumb but cannot find it...
>
> Best regards,
> H
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: passing data to view using httpresponseredirect

2008-01-03 Thread l5x

Why don't you use sessions?
http://www.djangoproject.com/documentation/sessions/

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



Need help creating a composite database index

2008-01-03 Thread Matt Wilson

This is the postgresql index I want to create:

CREATE UNIQUE INDEX v2category_nameIndex ON v2category
(v2organization_id, parent_category, lower(name));

How do I create this index with the Django model?

TIA

Matt
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: file uploading clean_data code missing

2008-01-03 Thread Karen Tracey
On Jan 3, 2008 10:49 AM, Chris Haynes <[EMAIL PROTECTED]> wrote:

>
> With the following form in my template
>
> 
> File: 
> {{ form.code }}
> 
> 
> 
>
> and the appended view code, I get the desired form with text box,
> Browse... and Submit buttons. But when
> browse for a plain text file and hit Submit, I get the
> HttpResponseBadRequest response and the print statements flagged with
> ##  below print the following to the server console.
> ', 'content-type':
> 'application
> /octet-stream', 'filename': 'README.txt'}]}>
> {'code': None}
>
> Why is clean_data == {'code': None} ?
>
> ---
> class SubmissionForm(forms.Form):
>code = forms.Field(widget=forms.FileInput, required=False,
>   label=_('File'), help_text=_('Upload a file'))
>

Why not forms.FileField here?


>
> def submit(request):
>if request.method == 'POST':
>new_data = request.POST.copy()
>new_data.update(request.FILES)
>print request.FILES##
>form = SubmissionForm(new_data)


Instead of this copy/update I think you should be doing:

form = SubmissionForm(request.POST, request.FILES)

as per the doc here:

http://www.djangoproject.com/documentation/newforms/#binding-uploaded-files-to-a-form

I note this is marked as "new in development version", as is FileField, so
perhaps you are running 0.96 and trying to get file upload working?
Personally I'd recommend using an SVN checkout instead, especially if you
are running into wanting to do things that have been added since 0.96.

Karen

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



passing data to view using httpresponseredirect

2008-01-03 Thread Maarten

Hi,

I took a look around the django website and the user group here, but
didn't really find an answer to this.

I my application (which does administrative things with a stock) I
have a view that allows creation of items that are stored in the
stock.

The view does different things on different actions: when accessed
without POST data it just shows a form to input the new data. This
form requires some objects (the new item has foreign keys, these need
to be passed to the form) and thus I use a
render_to_response(objects).

If the form is entered and submitted, a post is done to the same view.
When the view detects the post it will read from it and try to create
the items, ending with a httpresponseredirect to this view. (called
new())

There are two arrays that I use throughout the project (included in
the base template from which all inherit) called messages and errors
(passed as error_list and message_list). I use these to notify the
user how many objects were created succesfully, what errors occured
(most common is except error, e: errors.append("error:"%e), etc..

The return_to_response can easily handle this, but
httpresponseredirect can't. However, I have added the arguments to my
view as follows:

def new(request, errors = [], messages = []):
...

This somehow gets the errors and messages to my template after a
httpresponseredirect.
(and also with a render_to_response). That's good news, unfortunatly,
django somehow remembers this and the arrays don't get cleaned up. I
tried several things to clear the arrays, but when used with
httpresponseredirect, they need to reach the render_to_response
statement before being cleared or I can't view the message. (which was
the intention in the first place.)
Also, from what I know, this shouldn't even work as no where I'm
passing arguments to new(), not in the urls.py, not in
render_to_response and certainly not using httpresponseredirect.
So, normal python rules say these should get default values [] and
thus be cleared.

On to the question, what is going on here?
Why is it that the arrays don't get their default value ([]) and how
is it possible that they do contain the errors and messages generated?
All this just doesn't feel right to me and I haven't been able to
figure it out.
Any comments greatly appreciated!

(running postgresql on a seperate linux server and running the code on
my computer (winxp).
Browser = opera, same problems with IE though, django version 0.96,
python 2.5, psycopg2

The code:

def new(request, errors = [], messages = []):
messages.append("Current total: %d"%len(Stock.objects.all()))
if(request.POST):
textarea = request.POST['serial_boxid']
po_nr = request.POST['po_no']
if(po_nr!="POnumber"):#use nothing
npo = PO.objects.get(id=request.POST['po_no'])
try:
ndp, exist_dp =
DP.objects.get_or_create(dp_no=int(request.POST['dispatch']),
defaults={'pub_date':date.today()})
except (TypeError, ValueError), e:
errors.append("error: %s"%e)
return HttpResponseRedirect('/stock/new/')
lines = textarea.splitlines()
for units in lines:
line = units.split()
if(len(line)==2):
nstock, exists =
Stock.objects.get_or_create(serialno = line[0], boxid = line[1],
defaults={'location':request.POST['location'], 'po':npo, 'dp':ndp})
if(exists):
messages.append("created %s"%nstock)
else:
errors.append("%s already exists!"%nstock)
else:
errors.append("wrong syntax in entry: %s"%line)
return HttpResponseRedirect('/stock/new/')
else:
errors.append("Please specify a PO")
return render_to_response('stock/stock_new.html',
{'error_list':errors, 'po_list':PO.objects.all(),
'message_list':messages})
else:
return render_to_response('stock/stock_new.html',
{'po_list':PO.objects.all(), 'error_list':errors,
'message_list':messages})

Regards,
Maarten

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



Re: how to use random of Built-in filter reference in templates?

2008-01-03 Thread Tim Chase

> so,is there anyone who can give me an example about "random"
> of Built-in filter reference in templates?

I have these items:

{% for item in items %}
  {{ item }}
{% endfor %}


This is my favorite item: {{ items|random }}

-tim




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



Re: 'WSGIRequest' object has no attribute 'user'

2008-01-03 Thread Karen Tracey
On Jan 3, 2008 10:32 AM, Chris Haynes <[EMAIL PROTECTED]> wrote:

>
> On Dec 29 2007, 11:03 am, Alex Koshelev <[EMAIL PROTECTED]> wrote:
> > Is there 'django.contrib.auth.middleware.AuthenticationMiddleware' in
> > your MIDDLEWARE_CLASSES ?
>
> No. Uncommenting
>'django.middleware.common.CommonMiddleware',
>'django.contrib.sessions.middleware.SessionMiddleware',
>'django.contrib.auth.middleware.AuthenticationMiddleware',
> in the distribution settings file was progress, resulting in a
> complaint about no login.html file.


Going from the online version of the book, this was included in Step 3 here:

http://www.djangobook.com/en/1.0/chapter06/

("Also uncomment all the lines in the MIDDLEWARE_CLASSES setting tuple...")

Copying django/controb/admin/templates/admin/ to templates fixed that
> and it works now.
>

You should not have had to copy the admin templates anywhere, if the app
template loader ('
django.template.loaders.app_directories.load_template_source') is listed in
TEMPLATE_LOADERS.  I thought it was there by default -- was it not in your
case?

The generally excellent book indicates only a few of the changes
> necessary to enable the admin system.
>

Near as I can tell (working from the online version), the book does cover
all that needs to be done to enable admin.  Nevertheless it seems like I've
seen a lot of people post here with trouble in this area, so I'm trying to
understand why.  Perhaps step 3 in Chapter 6 should be more specific (list
exactly what should be in MIDDLEWARE_CLASSES), or split into two steps,
since it covers both ensuring that INSTALLED_APPS and MIDDLEWARE_CLASSES are
set properly.  But even that wouldn't address whatever caused you to have to
copy the templates -- I don't understand what happened there.

Karen

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



Re: YUI file upload and form errors

2008-01-03 Thread Graham Ullrich
Malcolm,
Thanks so much for your suggestion. With that knowledge I found the problem
in 10 minutes. The culprit turns out to be the YUI Connection Manager. As it
turns out, when handling a file upload they change the location of the
returned data. My response gets placed in a totally different child element
when there is a file field, and yet the "normal" location contains an
escaped version of the response.

FWIW, the normal location for the view response data is o.responseText. With
a file upload, the location is o.responseXML.body.textContent.

Thanks again.
Graham


On 1/3/08, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
>
>
> On Wed, 2008-01-02 at 15:38 -0800, grahamu wrote:
> [...]
> > As an example, the JSON response seen by the javascript might be:
> >
> >"{\"valid\": false, \"errors\": {\"options\": \"
    > \"errorlist\\">
  • This field is required.<\/li><\/ > > ul>\"}}" > > > > when it should be: > > > >"{\"valid\": false, \"errors\": {\"options\": \" > \"errorlist\\">This field is required.<\/li><\/ul>\"}}" > > > > You can see that the Django system encapsulates the entire response in > > tags. Additionally, the underlying error message HTML is > > also escaped. > > You might want to double-check that you're debugging the correct > problem. There is no code in Django that is adding the "pre" tags here. > The only occurrence of the string " docstring for the "debug" template tag. So working out at which step > that extra content is being added will no doubt help you zero in on the > problem code. > > Regards, > Malcolm > > -- > Two wrongs are only the beginning. > http://www.pointy-stick.com/blog/ > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---

how to use random of Built-in filter reference in templates?

2008-01-03 Thread jt.wang
hi ,
we can  see


"random

Returns a random item from the list."from 
http://www.djangoproject.com/documentation/templates/.but it is diffcult 
to understand without examples.
so,is there anyone who can give me an example about "random" of Built-in 
filter reference in templates?

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

begin:vcard
fn:jt wang
n:wang;jt
email;internet:[EMAIL PROTECTED]
note;quoted-printable:=E5=AD=A6=E4=BC=9A=E5=86=92=E6=B3=A1=E6=8B=89=E6=8E=A7=E4=BB=B6=EF=BC=8C=E8=
	=B5=B0=E9=81=8D=E5=A4=A9=E4=B8=8B=E9=83=BD=E4=B8=8D=E6=80=95
version:2.1
end:vcard



file uploading clean_data code missing

2008-01-03 Thread Chris Haynes

With the following form in my template


File: 
{{ form.code }}




and the appended view code, I get the desired form with text box,
Browse... and Submit buttons. But when
browse for a plain text file and hit Submit, I get the
HttpResponseBadRequest response and the print statements flagged with
##  below print the following to the server console.
', 'content-type':
'application
/octet-stream', 'filename': 'README.txt'}]}>
{'code': None}

Why is clean_data == {'code': None} ?

---
class SubmissionForm(forms.Form):
code = forms.Field(widget=forms.FileInput, required=False,
   label=_('File'), help_text=_('Upload a file'))

def submit(request):
if request.method == 'POST':
new_data = request.POST.copy()
new_data.update(request.FILES)
print request.FILES##
form = SubmissionForm(new_data)
if form.is_valid():
clean_data = form.cleaned_data
print clean_data##
if clean_data['code']:
submission = Submission()
submission.name = code.filename
submission.save_code_file(code.filename, code.content)
context = Context({'length': str(len(code.content)),
   'name': code.filename})
return render_to_response('submit/submitted.html',
context)
else:
return HttpResponseBadRequest('Bad file')
else:
return HttpResponseServerError('Bad form')
else:
context = Context({'form': SubmissionForm()})
return render_to_response('submit/index.html', context)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: 'WSGIRequest' object has no attribute 'user'

2008-01-03 Thread Chris Haynes

On Dec 29 2007, 11:03 am, Alex Koshelev <[EMAIL PROTECTED]> wrote:
> Is there 'django.contrib.auth.middleware.AuthenticationMiddleware' in
> your MIDDLEWARE_CLASSES ?

No. Uncommenting
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
in the distribution settings file was progress, resulting in a
complaint about no login.html file.
Copying django/controb/admin/templates/admin/ to templates fixed that
and it works now.

The generally excellent book indicates only a few of the changes
necessary to enable the admin system.

Thanks a lot for your help.

Chris

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

2008-01-03 Thread Tom Badran
Thanks for the hints Tim. The problem is that i'm not using the whole
sequence, im just pulling one item out of the query set and was hoping for a
way to get the position without having to use the whole set, in the same
vain that count() is much more sensible a choice than len() as it gets
optimised down to an SQL count by django. Thanks for pointing out enumerate
though, im actually embarrassed i didn't know that, it looks very very
useful.

Tom

On Jan 3, 2008 3:12 PM, Tim Chase <[EMAIL PROTECTED]> wrote:

>
> > In my template, i want to be able to print "Item X of Y" where
> > items are got from a QuerySet such as
> > Picture.objects.filter(album='name')
> >
> > Now Y is easy to get, its just the count() of the queryset,
> > however i cant seem to find a solution to find X. The objects
> > do have an ordering set, so they should be in the same order
> > each time the query is run. I know its bad, but i tried to
> > just to a pictures.index(picture) just for testing, but
> > QuerySet doesnt provide that method (sensibly). Any pointers?
>
> It sounds like instead of passing your queryset directly to the
> view/template, you might want to pass "enumerate(qs)"[1] to your
> view/template.  This returns pairs of zero-based indicies that
> you can use for your X.  Use the "add" filter[2] to make them
> 1-based indices.
>
> Or more easily, if you're iterating over the list of items in
> your view, you can use the "forloop.counter" property[3]:
>
>   
>   {% for picture in pictures %}
> Item {{ forloop.counter }} of {{ pictures.count }}
> {{ picture }}
>   {% endfor %}
>   
>
> -tim
>
> [1] http://docs.python.org/lib/built-in-funcs.html#l2h-24
> [2] http://www.djangoproject.com/documentation/templates/#add
> [3] http://www.djangoproject.com/documentation/templates/#for
>
> >
>


-- 
Tom Badran
http://badrunner.net

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



Re: Counting and indexing objects

2008-01-03 Thread Tim Chase

> In my template, i want to be able to print "Item X of Y" where
> items are got from a QuerySet such as
> Picture.objects.filter(album='name')
> 
> Now Y is easy to get, its just the count() of the queryset,
> however i cant seem to find a solution to find X. The objects
> do have an ordering set, so they should be in the same order
> each time the query is run. I know its bad, but i tried to
> just to a pictures.index(picture) just for testing, but 
> QuerySet doesnt provide that method (sensibly). Any pointers?

It sounds like instead of passing your queryset directly to the
view/template, you might want to pass "enumerate(qs)"[1] to your
view/template.  This returns pairs of zero-based indicies that
you can use for your X.  Use the "add" filter[2] to make them
1-based indices.

Or more easily, if you're iterating over the list of items in
your view, you can use the "forloop.counter" property[3]:

   
   {% for picture in pictures %}
 Item {{ forloop.counter }} of {{ pictures.count }}
 {{ picture }}
   {% endfor %}
   

-tim

[1] http://docs.python.org/lib/built-in-funcs.html#l2h-24
[2] http://www.djangoproject.com/documentation/templates/#add
[3] http://www.djangoproject.com/documentation/templates/#for

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Make Django admin edit return to custom page?

2008-01-03 Thread Ulf Kronman

Hi Malcom,
and thanks for the reply.

> The admin interface isn't really designed to be customised like that.
> Rather, the principle is that if you can edit one record, you can edit
> them all.

OK, I guessed that I would get that answer, but I took a chance
anyhow.

> However, a bit of reading of the source -- in particular,
> contrib.admin.views.main -- will reveal some approaches that could be
> used if you really wanted to. For example, the change_stage view (which,
> along with add_stage() is used to process a model submission) sends the
> user back to "../" upon success. So you could write a custom URLConf
> entry that overrides that URL (admin///) and presented
> them with the page you want to show them.

That could be a solution to my problem. If I understand you right
here, I should write a URLConf that in my case intercepts the URL /
admin/publications/publication/ and points to a view that redirects
the user to the page he started from before editing the record in the
admin interface. I guess the address of the starting point has to be
stored as a session parameter, if I want it to be dynamic.

I also believe that I have to find a clever URL capturer for my custom
view, since I also want to be able to point back to the original /
admin/publications/publication/ list, if the user did not start from
the custom list, but actually came from the /admin/publications/
publication/, but I don't want it to loop, of course. It looks as if
the admin list view accepts the URL both with or without an ending
slash, but the edit form always returns to the list with an ending
slash, so maybe that little difference in the URLs could do the trick.

I'll get back with a report, if I get it working.

Thanks for your help,
Ulf
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Counting and indexing objects

2008-01-03 Thread Tom Badran
In my template, i want to be able to print "Item X of Y" where items are got
from a QuerySet such as Picture.objects.filter(album='name')

Now Y is easy to get, its just the count() of the queryset, however i cant
seem to find a solution to find X. The objects do have an ordering set, so
they should be in the same order each time the query is run. I know its bad,
but i tried to just to a pictures.index(picture) just for testing, but
QuerySet doesnt provide that method (sensibly). Any pointers?

Thanks

Tom

-- 
Tom Badran
http://badrunner.net

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



Re: Printable article page URLs?

2008-01-03 Thread Mordy Ovits

On Wednesday 02 January 2008 06:15 pm, Alex Koshelev wrote:
> The second variant with GET query is the best. One resouce has one
> uri but with query you specify it's display properties.

I agree, and have modified my dev site to match that, using Ned 
Batchelder's tip of meta tags to solve the robots issue.  Template 
inheritance is so superb; it made implementing that both 
conditionally and universally a breeze.  I'm also considering adding 
Tim Chase's PDF option in a later version (no database changes!).

Thanks for all the suggestions,
Mordy

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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-admin: specify model level extra js files (the js admin option)

2008-01-03 Thread Michel Thadeu Sabchuk

Hi!

> The newforms.txt documentation in the newforms-admin branch contains a
> detailed discussion on the capabilities of the new Media class.

I will take a look on the newforms and modeladmin documentation. Very
thanks!
Best regards...

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



Foreignkey relationship trouble

2008-01-03 Thread hern42

Hello,
I have an issue (it might be a beginner issue, if so I am sorry...
please point to the chapter in the doc)

I have a class Photo and a class Category with a one to many
relationship (many pictures can be in one category, but each photo can
be in only one category)...
I want to do an app for mysite/photo/category/OneCategory/ and have
all picture in OneCategory... Nothing fancy.
So far I managed to do it with mysite/photo/category/1 or 2 or n, n
being the category.id but never with the actual name of the
category...

What am I missing?
I am pretty sure it is quite dumb but cannot find it...

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



WYSIWYG Editfor for the Admin Interface (Not TinyMCE or FCK)

2008-01-03 Thread FrostedDark

So I just can't get this going... but really, I have no idea what I
actually need to do to get it to work.  I need to use InnovaStudio
Editor for about 75% of the textareas in the Django admin site.  I am
running the newforms-admin branch updated a few hours ago.  Now with
some editors, it is as simple as just adding a javascript and you are
all set.  InnovaStudio doesn't have that feature... here is the code
it requires...

VALUE

  var oEditCOLUMN_NAME = new InnovaEditor("oEditCOLUMN_NAME");
  oEditCOLUMN_NAME.REPLACE("COLUMN_NAME");


Anywhere where I put COLUMN_NAME just signifies that it has to be
unique per textarea so I figured that using the column name would be
the easiest way to go.  And by column name I mean things like
'content' or 'article' or whatever.

If anyone could point me in the right direction / provide a working
script I would really appreciate it.  This is one of the few things
holding me back now from finishing up this project.

Thanks!
Eric
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Printable article page URLs?

2008-01-03 Thread Ned Batchelder
D'oh! Sorry.  I hate those kind of replies! (At least I also contributed 
answering the asked questions in another post...)

--Ned.

Tim Chase wrote:
>> You could try not serving a different page at all: CSS can 
>> apply a different stylesheet when printing than when on the
>> screen. See http://www.alistapart.com/stories/goingtoprint/
>> for an introduction.
>> 
>
> While I agree with Ned that CSS is an excellent if not the
> best way to go...The OP (Mordy) wrote
>
>   
 Please don't suggest CSS, I know about it and it's not
 really an option for me.
 
>
> :)
>
> Another option I've used is to put the content-form in the
> extension.  I can then serve the resource
>
> http://example.com/foo
>
> as
>
> HTML -> http://example.com/foo.html
> JSON -> http://example.com/foo.json
> XML -> http://example.com/foo.xml
> CSV -> http://example.com/foo.csv
> tab-delimited -> http://example.com/foo.tab
> plain-text -> http://example.com/foo.txt
> PDF -> http://example.com/foo.pdf
> SVG -> http://example.com/foo.svg
>
> (I usually only implement HTML and a serialized format such
> as JSON/XML/tab-delimited but the above shows the
> flexibility of the scheme)
>
> If the URI is a collection, then one can have /foos.
> for represenations of the collection in  format and
> then use /foos/my-foo-slug. for the contained
> resources in their own flavor of format.
>
> In the OP's case, printable versions can be URL'd as
> http://example.com/foo.prn or
> http://example.com/foo.prn.html or what have you.  Or maybe
> use .xhtml for XHTML content, and .htm for a pre-CSS version
> that would render nicely on printers and handhelds.  One
> could even use an extension like .mobi or .wap for those
> content types.
>
> -tim
>
>
>
> >
>
>   

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


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



Re: admin urls in my own admin view

2008-01-03 Thread Nianbig

I´ll post som code as well..

here´s the view:
from mysite.books.models import Book
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.contrib.admin.views.decorators import
staff_member_required


def report(request):
return render_to_response(
"admin/books/report.html",
{'book_list' : Book.objects.all()},
RequestContext(request, {}),
)
report = staff_member_required(report)

and here´s the template:
{% extends "admin/base_site.html" %}

{% block title %}List of books by publisher{% endblock %}

{% block content %}

  List of books by publisher:
  {% regroup book_list|dictsort:"publisher.name" by publisher as
books_by_publisher %}
  {% for publisher in books_by_publisher %}
{{ publisher.grouper }}

  {% for book in publisher.list|dictsort:"title" %}
{{ book }}
  {% endfor %}

  {% endfor %}

{% endblock %}


On Jan 3, 1:44 am, Nianbig <[EMAIL PROTECTED]> wrote:
> Hi
>
> I´m building my own admin view... I have followed this 
> tutorial:http://www.djangobook.com/en/1.0/chapter17/. Everything works fine
> except that all urls in the header, the "home" link, "change password"
> link, "logout" link doesn't work for some reasen.
>
> The home-link is linked to "/", not "/admin/".. and the others are
> linked to "/admin/myownview/change_password/" and so on...
>
> Any ideas? Thanks.
>
> /Niklas
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



SelectDateWidget

2008-01-03 Thread AniNair

Hi all...
I would like to know how to get SelectDateWidget to correctly display
a value retrieved from a database.
I saw a similar post but no answers have been posted...
http://groups.google.com.et/group/django-users/browse_thread/thread/5bf7348f9b13a880/1ccbde2bd4cc272a?#1ccbde2bd4cc272a

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



Re: Recommended tool for web load & stress testing

2008-01-03 Thread Christian Vest Hansen

Apache JMeter should be able to give you #1, #2 & #5 and can operate
in a distributed fashion.


On 1/2/08, Ryan K <[EMAIL PROTECTED]> wrote:
>
> For all your testing needs http://www.softwareqatest.com/qatweb1.html
>
> On Jan 2, 2:58 pm, mamcxyz <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I wonder what tool let me to do web load & stress testing with this
> > options:
> >
> > - Run on Windows, test target are windows & solaris
> > - Simulate diferent users, with separation of surfers vs content
> > uploaders (ej: send photos, links, etc)
> > - Tell me page size & maybe benefits on caching?
> > - Correlate the memory & cpu load to the page fetching?
> > - Maybe provide nice grpahs or at least csv files.
> >
> > Could by script based or a gui.
> >
>


-- 
Venlig hilsen / Kind regards,
Christian Vest Hansen.

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