Re: ordering inside regroup

2010-05-25 Thread maciekjbl
Thank you, for your answer.

I didn't have time to check this because of flood in my company.

I thought that 'regroup' can't be order by any other sorting beside
it's own.

So I have to order it right and then use 'regroup' or 'regroup' then
ordering, this is what I don't get.


On 17 Maj, 16:55, zinckiwi  wrote:
> > annotate(myorder=Max('product__datefield')).order_by('producer.id',
> > 'myorder')
>
> Sorry, flip the order_by arguments:
>
> .order_by('myorder', 'producer.id')
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

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



Re: rendering to template help

2010-05-25 Thread Daniel Roseman
On May 25, 6:09 am, Pirate Pete  wrote:
> I have been trying to get some kind of kind response from django for a
> few days now and it has been very unkind to me :P
>
> basically i need to create a page that has a video title (link) and an
> average rating with the amount of people that rated it in brackets.
>
> so it will look like ... Awesom video 5(3)  : where awesom video is
> the name 5 is the average rating and 3 people have rated the video.
>
> i can display the videos easily by using a for loop in the template
> however i am having much difficulty displaying the average ratings and
> count
>
> rating model:
>
> class RatingManager(models.Manager):
>         def average_rating(self,video):
>                 avg = 
> Rating.objects.filter(id=video.id).aggregate(Avg('rating'))
>                 return avg
>
>         def vote_count(self,video):
>                 num = 
> Rating.objects.filter(id=video.id).aggregate(Count('rating'))
>                 return num
>
> class Rating(models.Model):
>         user = models.ForeignKey(User, unique=False)
>         vid = models.ForeignKey(Video, unique=False)
>         rating = models.PositiveIntegerField(help_text="User rating of the
> video.")
>         objects = RatingManager()
>
>         def __str__(self):
>                 return str(self.user) + "'s rating: " + str(self.vid)
>
> View:
>
> def index(request):
>         videos = Video.objects.all()
>         dict= []
>         for vid in videos:
>                 ratec =
> (Rating.objects.vote_count(vid),Rating.objects.average_rating(vid))
>                 dict.append(ratec)
>
>         return render_to_response("index.html",
> {'videos':videos,'ratecount':dict})
>
> index.html: (please note ratecount is just trial and error this could
> potentially be by all means completely incorrect)
>
> TitleAverage Rating (Vote Count)
>         {% for video in videos %}
>         {{video.title}} td>{{ratecount.0.1}}({{ratecount.0.0}})
>         {% endfor %}
>
> thanks in advance
>

Firstly, please don't call a variable 'dict' - it shadows Python's
built-in dict type. Especially not if the variable is actually a list,
not a dict.

Secondly, you're just showing the same rate count - the first one - on
each and every video. I'm sure this isn't what you want.

I think what you actually want to do here is to annotate the count and
avg on the video, not calculate separate aggregations for each one.
You can do this directly in the view, something like:

 
Video.objects.all().annotate(rating_count=Count('rating')).annotate(rating_avg=Avg('rating__rating'))

Then in the template you can just do:

{% for video in videos %}
{{video.title}}{{video.rating_avg}}({{video.rating_count}})
{% endfor %}

--
DR.

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



A question about form inheritance and form media as a dynamic property

2010-05-25 Thread Vasil Vangelovski
I have a form class, call it MyBaseForm which defines some media as a
dynamic property (by providing a media property, not defining a Media
class). Then I have MyForm which inherits from MyBaseForm and
overrides some widgets on it's fields, these widgets have their own
media definitions. The problem is MyForm.media doesn't contain the
media for the widgets. If I change MyForm to inherit from ModelForm
everything works fine. Is there a way around this?

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



Re: rendering to template help

2010-05-25 Thread Pirate Pete
Thank you very very much for your reply.

There is still a few things i need to grasp.

Firstly, why did you do this :
annotate(rating_count=Count('rating')).annotate(rating_avg=Avg('rating__rating'))
as opposed to annotate(rating_count=Count('rating'),
rating_avg=Avg('rating__rating'))

Secondly, why is the average rating__rating and the count is only
rating ?

Unfortunately the code you provided doesn't seem to be working however
that could just be my own ignorance at work.

Does this annotation need to be assigned to some sort of variable and
passed into the render or just run like you stated above?

thanks again!



On May 25, 6:08 pm, Daniel Roseman  wrote:
> On May 25, 6:09 am, Pirate Pete  wrote:
>
>
>
> > I have been trying to get some kind of kind response from django for a
> > few days now and it has been very unkind to me :P
>
> > basically i need to create a page that has a video title (link) and an
> > average rating with the amount of people that rated it in brackets.
>
> > so it will look like ... Awesom video 5(3)  : where awesom video is
> > the name 5 is the average rating and 3 people have rated the video.
>
> > i can display the videos easily by using a for loop in the template
> > however i am having much difficulty displaying the average ratings and
> > count
>
> > rating model:
>
> > class RatingManager(models.Manager):
> >         def average_rating(self,video):
> >                 avg = 
> > Rating.objects.filter(id=video.id).aggregate(Avg('rating'))
> >                 return avg
>
> >         def vote_count(self,video):
> >                 num = 
> > Rating.objects.filter(id=video.id).aggregate(Count('rating'))
> >                 return num
>
> > class Rating(models.Model):
> >         user = models.ForeignKey(User, unique=False)
> >         vid = models.ForeignKey(Video, unique=False)
> >         rating = models.PositiveIntegerField(help_text="User rating of the
> > video.")
> >         objects = RatingManager()
>
> >         def __str__(self):
> >                 return str(self.user) + "'s rating: " + str(self.vid)
>
> > View:
>
> > def index(request):
> >         videos = Video.objects.all()
> >         dict= []
> >         for vid in videos:
> >                 ratec =
> > (Rating.objects.vote_count(vid),Rating.objects.average_rating(vid))
> >                 dict.append(ratec)
>
> >         return render_to_response("index.html",
> > {'videos':videos,'ratecount':dict})
>
> > index.html: (please note ratecount is just trial and error this could
> > potentially be by all means completely incorrect)
>
> > TitleAverage Rating (Vote Count)
> >         {% for video in videos %}
> >         {{video.title}} > td>{{ratecount.0.1}}({{ratecount.0.0}})
> >         {% endfor %}
>
> > thanks in advance
>
> Firstly, please don't call a variable 'dict' - it shadows Python's
> built-in dict type. Especially not if the variable is actually a list,
> not a dict.
>
> Secondly, you're just showing the same rate count - the first one - on
> each and every video. I'm sure this isn't what you want.
>
> I think what you actually want to do here is to annotate the count and
> avg on the video, not calculate separate aggregations for each one.
> You can do this directly in the view, something like:
>
> Video.objects.all().annotate(rating_count=Count('rating')).annotate(rating_avg=Avg('rating__rating'))
>
> Then in the template you can just do:
>
>         {% for video in videos %}
>         {{video.title}} td>{{video.rating_avg}}({{video.rating_count}})
>         {% endfor %}
>
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

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



Re: rendering to template help

2010-05-25 Thread Daniel Roseman
On May 25, 9:52 am, Pirate Pete  wrote:
> Thank you very very much for your reply.
>
> There is still a few things i need to grasp.
>
> Firstly, why did you do this :
> annotate(rating_count=Count('rating')).annotate(rating_avg=Avg('rating__rat 
> ing'))
> as opposed to annotate(rating_count=Count('rating'),
> rating_avg=Avg('rating__rating'))

No reason, these are equivalent.

> Secondly, why is the average rating__rating and the count is only
> rating ?

Because you're counting the individual rating objects, but you're
averaging the values of the 'rating' field on each rating object.

> Unfortunately the code you provided doesn't seem to be working however
> that could just be my own ignorance at work.
>
> Does this annotation need to be assigned to some sort of variable and
> passed into the render or just run like you stated above?

Yes, sorry, assign it to the 'videos' variable and pass it straight
into the template context - you can delete the rest of the view code.
--
DR.

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



Re: rendering to template help

2010-05-25 Thread Pirate Pete
You sir have saved me many a headache, i can't honestly thank you
enough

All the best!

On May 25, 7:10 pm, Daniel Roseman  wrote:
> On May 25, 9:52 am, Pirate Pete  wrote:
>
> > Thank you very very much for your reply.
>
> > There is still a few things i need to grasp.
>
> > Firstly, why did you do this :
> > annotate(rating_count=Count('rating')).annotate(rating_avg=Avg('rating__rat 
> > ing'))
> > as opposed to annotate(rating_count=Count('rating'),
> > rating_avg=Avg('rating__rating'))
>
> No reason, these are equivalent.
>
> > Secondly, why is the average rating__rating and the count is only
> > rating ?
>
> Because you're counting the individual rating objects, but you're
> averaging the values of the 'rating' field on each rating object.
>
> > Unfortunately the code you provided doesn't seem to be working however
> > that could just be my own ignorance at work.
>
> > Does this annotation need to be assigned to some sort of variable and
> > passed into the render or just run like you stated above?
>
> Yes, sorry, assign it to the 'videos' variable and pass it straight
> into the template context - you can delete the rest of the view code.
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

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



Re: rendering to template help

2010-05-25 Thread Pirate Pete
sorry for this one last question,

do you have any idea how i would go about rounding these values and
converting them from numbers to *'s ?

i tried using the round() function on the annotation however it kept
giving me a type error "a float is required."

cheers


On May 25, 7:10 pm, Daniel Roseman  wrote:
> On May 25, 9:52 am, Pirate Pete  wrote:
>
> > Thank you very very much for your reply.
>
> > There is still a few things i need to grasp.
>
> > Firstly, why did you do this :
> > annotate(rating_count=Count('rating')).annotate(rating_avg=Avg('rating__rat 
> > ing'))
> > as opposed to annotate(rating_count=Count('rating'),
> > rating_avg=Avg('rating__rating'))
>
> No reason, these are equivalent.
>
> > Secondly, why is the average rating__rating and the count is only
> > rating ?
>
> Because you're counting the individual rating objects, but you're
> averaging the values of the 'rating' field on each rating object.
>
> > Unfortunately the code you provided doesn't seem to be working however
> > that could just be my own ignorance at work.
>
> > Does this annotation need to be assigned to some sort of variable and
> > passed into the render or just run like you stated above?
>
> Yes, sorry, assign it to the 'videos' variable and pass it straight
> into the template context - you can delete the rest of the view code.
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

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



Post and Comment with the same Model.

2010-05-25 Thread nameless


I have created a simple project where everyone can create one or more
Blog. I want to use this models for Post and for Comment:

class Post_comment(models.Model):
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField(_('object ID'))
content_object = generic.GenericForeignKey()

# Hierarchy Field
parent = models.ForeignKey('self', null=True, blank=True,
default=None, related_name='children')

# User Field
user = models.ForeignKey(User)

# Date Fields
date_submitted = models.DateTimeField(_('date/time submitted'),
default = datetime.now)
date_modified = models.DateTimeField(_('date/time modified'),
default = datetime.now)

title = models.CharField(_('title'), max_length=60, blank=True,
null=True)
post_comment = models.TextField(_('post_comment'))

if it is a comment the parent is not null. So in most case the text
field will contain a little bit of text. Can I use this model for both
Post and Comment ? Is it a good solution ?

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



Re: rendering to template help

2010-05-25 Thread Daniel Roseman
On May 25, 10:30 am, Pirate Pete  wrote:
> sorry for this one last question,
>
> do you have any idea how i would go about rounding these values and
> converting them from numbers to *'s ?
>
> i tried using the round() function on the annotation however it kept
> giving me a type error "a float is required."
>
> cheers

I'd probably do a custom template filter:

@register filter
def stars(value):
return '*' * int(round(value))

(you need both int and round, as int always rounds down, so you need
to do the rounding before converting to int).

Then use it like this (after loading the library in the template):
{{ video.rating_avg|stars }}
--
DR.

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



Re: Post and Comment with the same Model.

2010-05-25 Thread Scott Gould
Presumably you want the same object to be able to be a comment on
someone else's post as well as a post in it's own right, that others
could comment on? Looks straightforward enough, though I can't see why
you'd need the generic fields in the model.

Regards
Scott

On May 25, 5:54 am, nameless  wrote:
> I have created a simple project where everyone can create one or more
> Blog. I want to use this models for Post and for Comment:
>
> class Post_comment(models.Model):
>     content_type = models.ForeignKey(ContentType)
>     object_id = models.PositiveIntegerField(_('object ID'))
>     content_object = generic.GenericForeignKey()
>
>     # Hierarchy Field
>     parent = models.ForeignKey('self', null=True, blank=True,
> default=None, related_name='children')
>
>     # User Field
>     user = models.ForeignKey(User)
>
>     # Date Fields
>     date_submitted = models.DateTimeField(_('date/time submitted'),
> default = datetime.now)
>     date_modified = models.DateTimeField(_('date/time modified'),
> default = datetime.now)
>
>     title = models.CharField(_('title'), max_length=60, blank=True,
> null=True)
>     post_comment = models.TextField(_('post_comment'))
>
> if it is a comment the parent is not null. So in most case the text
> field will contain a little bit of text. Can I use this model for both
> Post and Comment ? Is it a good solution ?

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



MongoDB backend for Django-nonrel

2010-05-25 Thread Waldemar Kornewald
Hi everyone,
now there's a MongoDB backend for Django-nonrel. With that backend you
can write your DB code with Django's model layer (from django.db
import models). A more detailed explanation can be found here:
http://www.allbuttonspressed.com/blog/django/2010/05/MongoDB-backend-for-Django-nonrel-released

BTW, the website above is open-source and the code works with the
MongoDB backend, our App Engine backend, and Django's SQL backends. No
modifications needed (apart from specifying your database backend in
settings.py)!

Bye,
Waldemar Kornewald

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



Re: Post and Comment with the same Model.

2010-05-25 Thread nameless
Generic field because on my project you can post and comment in Blogs,
Gallery pages, Foto pages, video pages, ecc.
So I want to use my Post_comment models for post and comment
anythings.
Is this a wrong solution ?
Are there problems with the performances ?

Thanks ;)


On 25 Mag, 12:19, Scott Gould  wrote:
> Presumably you want the same object to be able to be a comment on
> someone else's post as well as a post in it's own right, that others
> could comment on? Looks straightforward enough, though I can't see why
> you'd need the generic fields in the model.
>
> Regards
> Scott
>
> On May 25, 5:54 am, nameless  wrote:
>
>
>
>
>
> > I have created a simple project where everyone can create one or more
> > Blog. I want to use this models for Post and for Comment:
>
> > class Post_comment(models.Model):
> >     content_type = models.ForeignKey(ContentType)
> >     object_id = models.PositiveIntegerField(_('object ID'))
> >     content_object = generic.GenericForeignKey()
>
> >     # Hierarchy Field
> >     parent = models.ForeignKey('self', null=True, blank=True,
> > default=None, related_name='children')
>
> >     # User Field
> >     user = models.ForeignKey(User)
>
> >     # Date Fields
> >     date_submitted = models.DateTimeField(_('date/time submitted'),
> > default = datetime.now)
> >     date_modified = models.DateTimeField(_('date/time modified'),
> > default = datetime.now)
>
> >     title = models.CharField(_('title'), max_length=60, blank=True,
> > null=True)
> >     post_comment = models.TextField(_('post_comment'))
>
> > if it is a comment the parent is not null. So in most case the text
> > field will contain a little bit of text. Can I use this model for both
> > Post and Comment ? Is it a good solution ?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

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



An unhandled exception was thrown by the application.

2010-05-25 Thread mohammadmonther
 0


Hello I've created my new site using DjANGO

AT FIRST Everything is okay startapp,syncdb..Etc

but the problems its this massage

Unhandled Exception An unhandled exception was thrown by the
application.

you can see http://www.daqiqten.com/

this is my index.fsgi and .htacces

index.fcgi
#!/usr/bin/python
import sys, os

# Add a custom Python path. (optional)
sys.path.insert(0, "/home/daq")

# Switch to the directory of your project.
os.chdir("/home/daq/newproject")

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "newproject.settings"

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")


___

.htacces
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.fcgi/$1 [QSA,L]

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



Re: Post and Comment with the same Model.

2010-05-25 Thread Tom Evans
On Tue, May 25, 2010 at 12:20 PM, nameless  wrote:
> Generic field because on my project you can post and comment in Blogs,
> Gallery pages, Foto pages, video pages, ecc.
> So I want to use my Post_comment models for post and comment
> anythings.
> Is this a wrong solution ?
> Are there problems with the performances ?
>
> Thanks ;)

Well, GFKs aren't cheap (or rather, can be expensive).

It depends whether you think that galleries/photos/videos have
posts/comments (m2m from gallery/photo to post/comment), or that
posts/comments are associated with any object (GFK).

The GFK allows you to easily find the object associated with a
post/comment. The m2m approach allows you to easily find the comments
associated with a particular object.

Cheers

Tom

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



Re: ordering inside regroup

2010-05-25 Thread Scott Gould
On May 25, 3:57 am, maciekjbl  wrote:
> Thank you, for your answer.
>
> I didn't have time to check this because of flood in my company.
>
> I thought that 'regroup' can't be order by any other sorting beside
> it's own.
>
> So I have to order it right and then use 'regroup' or 'regroup' then
> ordering, this is what I don't get.

It's not quite appropriate to say that regroup has a sort order of
"its own". It simply pulls one of the parameters out, and unless all
the objects that share that parameter are together, you probably won't
get the result you're after. See the docs, especially the last part
where it demonstrates a set that isn't ordered properly:

http://docs.djangoproject.com/en/1.2/ref/templates/builtins/#regroup

Regards
Scott

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



Re: view permission on django admin

2010-05-25 Thread Alex Robbins
If you want something like the admin, that lets users view objects
from the database but not edit them, you could check out the
databrowse contrib app. It is kind of a read-only admin.

http://docs.djangoproject.com/en/dev/ref/contrib/databrowse/

Hope that helps,
Alex

On May 24, 3:49 pm, rahul jain  wrote:
> Hi Django,
>
> I know this has been discussed lot of times but not implemented on
> admin because django developers think that django admin will not be
> just used for viewing.
>
> Anyways, I need it for my model.
>
> I went through the path but was not able to solve this problem.
>
> http://code.djangoproject.com/ticket/7150
>
> I think this patch is for some old code
>
> Here what its missing
>
> a/django/contrib/admin/sites.py
> old     new    
> 281     281                         'add': 
> model_admin.has_add_permission(request),
> 282     282                         'change':
> model_admin.has_change_permission(request),
> 283     283                         'delete':
> model_admin.has_delete_permission(request),
>         284                         'view': 
> model_admin.has_view_permission(request),
> 284     285                     }
> 285     286    
> 286     287                     # Check whether user has any perm for this 
> module.
>
> I checked sites.py but none of the above exists now.
>
> Anyone know the recent patch for this.
>
> Thanks.
>
> --RJ
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

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



QuerySet for view from RawQuerySet (lacks _clone), or select_related with M2M?

2010-05-25 Thread Jeff Kowalczyk
I am trying to use a raw sql query in a model manager method.
RawQuerySet lacks method _clone, is there a recommended way to return
a normal QuerySet for views to consume?

The models are included below. If there is a way to get the Django ORM
to make the M2M join via select_related and extra, I'd much rather use
that method, but I wasn't able to make it work.

Thanks,
Jeff

# models.py:

class Catalog(models.Model):
title = models.CharField(max_length=50)
slug = models.SlugField()
users = models.ManyToManyField(User, blank=True,
   related_name='catalog_users')


class Facility(models.Model):
catalog = models.ForeignKey(Catalog)
title = models.CharField(max_length=50)
slug = models.SlugField()
address = models.CharField(max_length=255)


class Product(models.Model):
sku = models.CharField(max_length=10)
sku_internal = models.CharField(max_length=10)
catalog = models.ForeignKey(Catalog)
title = models.CharField(max_length=50)
slug = models.SlugField()
price_unit = models.DecimalField(max_digits=8,
 decimal_places=4)
qty_increment = models.IntegerField()
qty_allow_custom = models.BooleanField()
description = models.CharField(max_length=255)
image = models.ImageField(upload_to='images/',
  blank=True)


class ProductManager(models.Manager):

def products_for_username(self, username=None):
sql = """SELECT myapp_product.id, myapp_product.sku,
 myapp_product.sku_internal, myapp_product.catalog_id,
 myapp_product.title, myapp_product.price_unit,
 myapp_product.qty_increment,
 myapp_product.qty_allow_custom,
 myapp_product.description, myapp_product.image
 FROM myapp_product
 INNER JOIN myapp_catalog
 ON myapp_product.catalog_id = myapp_catalog.id
 INNER JOIN myapp_catalog_users
 ON myapp_catalog.id = myapp_catalog_users.catalog_id
 INNER JOIN auth_user
 ON myapp_catalog_users.user_id = auth_user.id
 WHERE auth_user.username = %s ORDER BY
myapp_product.sku"""
return Product.objects.raw(sql, [username,])

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



Re: Security Question...

2010-05-25 Thread Alex Robbins
It might be worth a try to see if the self-signed cert gets you into
trouble or not. Some url libraries might complain about it, but I
don't think that the behavior is universal. As I think about it, I
think it is normally browsers that whine about self-signed certs.
Maybe the other server wouldn't even mention it? Anyway, it'd be a lot
easier to setup an ssl cert than roll your own app level solution.

Good luck!
Alex

On May 24, 10:57 am, ringemup  wrote:
> Not a bad idea, actually, but the other site is on shared hosting, so
> I don't expect the host to be willing to add a self-signed cert as
> trusted.
>
> On May 24, 10:07 am, Alex Robbins 
> wrote:
>
>
>
> > Just a thought, but if you are the only person using the url, you
> > could make your own self-signed security cert. It would be free and
> > protect your data. It won't show up as trusted to users, but your
> > other server can be set to accept it. (Assuming the lack of ssl is a
> > budget issue, that wouldn't fix a technical issue.)
>
> > Alex
>
> > On May 23, 10:10 am, ringemup  wrote:
>
> > > Hi folks --
>
> > > I'm putting together a simple API to allow a separately-hosted but
> > > trusted site to perform a very limited set of actions on my site.  I'm
> > > wondering whether the design I've come up with is reasonably secure:
>
> > > - Other site gets an API key, which is actually in two parts, public
> > > key and private key, each of which is a uuid generated by Python's
> > > uuid module.
>
> > > - The API key object in the DB references a User object, whose
> > > permissions determine what actions the API key owner may take
>
> > > - Other site submits a POST request to a special URL on my site.  POST
> > > request contains 3 vars: public_key, data (as JSON), hash.
>
> > > - Hash is a SHA1 of the data concatenated with the private key
>
> > > - I use the public key to search the database for the API key and
> > > permissions.
>
> > > - I generate the SHA1 of the data concatenated with the private key
> > > from the DB, and check it against the submitted hash; only if they
> > > match do I decode the data dict and take the actions specified within
>
> > > - I then return an HTTP response containing a JSON object of the
> > > format:
>
> > > {
> > >     return_data: [object containing success / failure codes, messages,
> > > any other data],
> > >     hash: [SHA1 of return_data concatenated with private key]
>
> > > }
>
> > > - All data will be transmitted in the clear (no SSL currently
> > > available -- *sigh*), but there will be no sensitive data in the
> > > incoming data dict.  return_data may contain values that aren't meant
> > > to be broadcasted, but aren't really sensitive (along the lines of
> > > activation keys for a game)
>
> > > Do you see any major potential flaws in this plan?
>
> > > 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-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/django-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

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



Re: Security Question...

2010-05-25 Thread ringemup

By app-level solution you mean some sort of custom encryption /
decryption scheme for the data dictionaries?

I'm still not convinced the data needs encryption -- I mean, it
wouldn't hurt and in an ideal world I'd just push everything over SSL,
but the worst thing that happens if someone gets hold of the data
we're exchanging is a customer who has to call support because their
activation key registers as already in-use, not any sort of identity
theft or loss of financial credentials.

Mostly with this I'm just trying to make sure that I can prevent
unauthorized users from using the API to make themselves free
activation keys.


On May 25, 10:02 am, Alex Robbins 
wrote:
> It might be worth a try to see if the self-signed cert gets you into
> trouble or not. Some url libraries might complain about it, but I
> don't think that the behavior is universal. As I think about it, I
> think it is normally browsers that whine about self-signed certs.
> Maybe the other server wouldn't even mention it? Anyway, it'd be a lot
> easier to setup an ssl cert than roll your own app level solution.
>
> Good luck!
> Alex
>
> On May 24, 10:57 am, ringemup  wrote:
>
>
>
> > Not a bad idea, actually, but the other site is on shared hosting, so
> > I don't expect the host to be willing to add a self-signed cert as
> > trusted.
>
> > On May 24, 10:07 am, Alex Robbins 
> > wrote:
>
> > > Just a thought, but if you are the only person using the url, you
> > > could make your own self-signed security cert. It would be free and
> > > protect your data. It won't show up as trusted to users, but your
> > > other server can be set to accept it. (Assuming the lack of ssl is a
> > > budget issue, that wouldn't fix a technical issue.)
>
> > > Alex
>
> > > On May 23, 10:10 am, ringemup  wrote:
>
> > > > Hi folks --
>
> > > > I'm putting together a simple API to allow a separately-hosted but
> > > > trusted site to perform a very limited set of actions on my site.  I'm
> > > > wondering whether the design I've come up with is reasonably secure:
>
> > > > - Other site gets an API key, which is actually in two parts, public
> > > > key and private key, each of which is a uuid generated by Python's
> > > > uuid module.
>
> > > > - The API key object in the DB references a User object, whose
> > > > permissions determine what actions the API key owner may take
>
> > > > - Other site submits a POST request to a special URL on my site.  POST
> > > > request contains 3 vars: public_key, data (as JSON), hash.
>
> > > > - Hash is a SHA1 of the data concatenated with the private key
>
> > > > - I use the public key to search the database for the API key and
> > > > permissions.
>
> > > > - I generate the SHA1 of the data concatenated with the private key
> > > > from the DB, and check it against the submitted hash; only if they
> > > > match do I decode the data dict and take the actions specified within
>
> > > > - I then return an HTTP response containing a JSON object of the
> > > > format:
>
> > > > {
> > > >     return_data: [object containing success / failure codes, messages,
> > > > any other data],
> > > >     hash: [SHA1 of return_data concatenated with private key]
>
> > > > }
>
> > > > - All data will be transmitted in the clear (no SSL currently
> > > > available -- *sigh*), but there will be no sensitive data in the
> > > > incoming data dict.  return_data may contain values that aren't meant
> > > > to be broadcasted, but aren't really sensitive (along the lines of
> > > > activation keys for a game)
>
> > > > Do you see any major potential flaws in this plan?
>
> > > > 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-us...@googlegroups.com.
> > > > To unsubscribe from this group, send email to 
> > > > django-users+unsubscr...@googlegroups.com.
> > > > For more options, visit this group 
> > > > athttp://groups.google.com/group/django-users?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "Django users" group.
> > > To post to this group, send email to django-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/django-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe 

Re: Security Question...

2010-05-25 Thread Alex Robbins
Yeah, I understand that the data doesn't need to be encrypted. I just
agree with you that SSL would be ideal.

If you had SSL, then I don't think you'd need to work as hard with the
public/private key hashing stuff. If all the transmitted data was
encrypted (SSL) you could just send a clear-text password in the post
data. No hashing, no public/private key, just easy.

Alex



On Tue, May 25, 2010 at 9:17 AM, ringemup  wrote:
>
> By app-level solution you mean some sort of custom encryption /
> decryption scheme for the data dictionaries?
>
> I'm still not convinced the data needs encryption -- I mean, it
> wouldn't hurt and in an ideal world I'd just push everything over SSL,
> but the worst thing that happens if someone gets hold of the data
> we're exchanging is a customer who has to call support because their
> activation key registers as already in-use, not any sort of identity
> theft or loss of financial credentials.
>
> Mostly with this I'm just trying to make sure that I can prevent
> unauthorized users from using the API to make themselves free
> activation keys.
>
>
> On May 25, 10:02 am, Alex Robbins 
> wrote:
>> It might be worth a try to see if the self-signed cert gets you into
>> trouble or not. Some url libraries might complain about it, but I
>> don't think that the behavior is universal. As I think about it, I
>> think it is normally browsers that whine about self-signed certs.
>> Maybe the other server wouldn't even mention it? Anyway, it'd be a lot
>> easier to setup an ssl cert than roll your own app level solution.
>>
>> Good luck!
>> Alex
>>
>> On May 24, 10:57 am, ringemup  wrote:
>>
>>
>>
>> > Not a bad idea, actually, but the other site is on shared hosting, so
>> > I don't expect the host to be willing to add a self-signed cert as
>> > trusted.
>>
>> > On May 24, 10:07 am, Alex Robbins 
>> > wrote:
>>
>> > > Just a thought, but if you are the only person using the url, you
>> > > could make your own self-signed security cert. It would be free and
>> > > protect your data. It won't show up as trusted to users, but your
>> > > other server can be set to accept it. (Assuming the lack of ssl is a
>> > > budget issue, that wouldn't fix a technical issue.)
>>
>> > > Alex
>>
>> > > On May 23, 10:10 am, ringemup  wrote:
>>
>> > > > Hi folks --
>>
>> > > > I'm putting together a simple API to allow a separately-hosted but
>> > > > trusted site to perform a very limited set of actions on my site.  I'm
>> > > > wondering whether the design I've come up with is reasonably secure:
>>
>> > > > - Other site gets an API key, which is actually in two parts, public
>> > > > key and private key, each of which is a uuid generated by Python's
>> > > > uuid module.
>>
>> > > > - The API key object in the DB references a User object, whose
>> > > > permissions determine what actions the API key owner may take
>>
>> > > > - Other site submits a POST request to a special URL on my site.  POST
>> > > > request contains 3 vars: public_key, data (as JSON), hash.
>>
>> > > > - Hash is a SHA1 of the data concatenated with the private key
>>
>> > > > - I use the public key to search the database for the API key and
>> > > > permissions.
>>
>> > > > - I generate the SHA1 of the data concatenated with the private key
>> > > > from the DB, and check it against the submitted hash; only if they
>> > > > match do I decode the data dict and take the actions specified within
>>
>> > > > - I then return an HTTP response containing a JSON object of the
>> > > > format:
>>
>> > > > {
>> > > >     return_data: [object containing success / failure codes, messages,
>> > > > any other data],
>> > > >     hash: [SHA1 of return_data concatenated with private key]
>>
>> > > > }
>>
>> > > > - All data will be transmitted in the clear (no SSL currently
>> > > > available -- *sigh*), but there will be no sensitive data in the
>> > > > incoming data dict.  return_data may contain values that aren't meant
>> > > > to be broadcasted, but aren't really sensitive (along the lines of
>> > > > activation keys for a game)
>>
>> > > > Do you see any major potential flaws in this plan?
>>
>> > > > 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-us...@googlegroups.com.
>> > > > To unsubscribe from this group, send email to 
>> > > > django-users+unsubscr...@googlegroups.com.
>> > > > For more options, visit this group 
>> > > > athttp://groups.google.com/group/django-users?hl=en.
>>
>> > > --
>> > > You received this message because you are subscribed to the Google 
>> > > Groups "Django users" group.
>> > > To post to this group, send email to django-us...@googlegroups.com.
>> > > To unsubscribe from this group, send email to 
>> > > django-users+unsubscr...@googlegroups.com.
>> > > For more options, visit this group 
>> > > athttp://groups.google.com/group/django-users?hl=en.
>>
>> > --
>> > You rec

Re: Unicode Error when Saving Django Model

2010-05-25 Thread vjimw
Thanks. It was actually a combination of issues. The database was
UTF8, I should have added to my original post that I could manually
insert and retrieve UTF8 data.

The data we are pulling (migrating one system to a new one, built on
django) is a bit of a nest of encoding issues. So things that may look
like UTF8 may not be, etc.  So I think my attempts to encode this data
as UTF8 started the problem.

Thanks for the help and the general heads up on encoding and unicode
with django. I have read about it, but I understand it better each
time I encounter a problem with it.

--Jim

On May 24, 8:30 am, Karen Tracey  wrote:
> On Sun, May 23, 2010 at 10:10 PM, vjimw  wrote:
> > I have been reading up on Unicode with Python and Django and I think I
> > have my code set to use UTF8 data when saving or updating an object
> > but I get an error on model.save()
>
> > My database and all of its tables are UTF8 encoded with UTF8 collation
> > (DEFAULT CHARSET=utf8;)
> > The data I am inputting is unicode
> > (u'Save up to 25% on your online order of select HP LaserJet\x92s')
> > 
>
> > But when I try to save this data I get an error
> > Incorrect string value: '\\xC2\\x92s' for column 'title' at row 1
>
> This error implies that your MySQL table is not set up the say you think it
> is, with a charset of utf8. Given a table that actually has a utf8 charset:
>
> k...@lbox:~/software/web/playground$ mysql -p Play2
> Enter password:
> Reading table information for completion of table and column names
> You can turn off this feature to get a quicker startup with -A
>
> Welcome to the MySQL monitor.  Commands end with ; or \g.
> Your MySQL connection id is 5852
> Server version: 5.0.67-0ubuntu6.1 (Ubuntu)
>
> Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
>
> mysql> show create table ttt_tag;
> +-+ 
> --- 
> --+
> | Table   | Create
> Table
> |
> +-+ 
> --- 
> --+
> | ttt_tag | CREATE TABLE `ttt_tag` (
>   `id` int(11) NOT NULL auto_increment,
>   `name` varchar(88) NOT NULL,
>   PRIMARY KEY  (`id`)
> ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 |
> +-+ 
> --- 
> --+
> 1 row in set (0.00 sec)
>
> I can create an object in Django using the odd unicode character your
> string  includes (though I'm not sure what it is supposed to be -- based on
> its placement I'd guess it is supposed to be a registered trademark symbol
> but that's not what you actually have):
>
> k...@lbox:~/software/web/playground$ python manage.py shell
> Python 2.5.2 (r252:60911, Jan 20 2010, 23:16:55)
> [GCC 4.3.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
>
> >>> from ttt.models import Tag
> >>> t = Tag.objects.create(name=u'HP LaserJet\x92s')
> >>> print t
> HP LaserJet s
> >>> quit()
>
> So that works, though the character does not print as anything useful.
>
> If I change the table to have a charset of latin1 (MySQL's default):
>
> mysql> drop table ttt_tag;
> Query OK, 0 rows affected (0.00 sec)
> mysql> create table ttt_tag (id int(11) not null auto_increment, name
> varchar(88) not null, primary key (id)) engine=myisam default charset
> latin1;
> Query OK, 0 rows affected (0.01 sec)
>
> I can then recreate the error you report:
>
> >>> t = Tag.objects.create(name=u'HP LaserJet\x92s')
>
> Traceback (most recent call last):
>   File "", line 1, in 
> [snipped]
>   File "/usr/lib/python2.5/warnings.py", line 102, in warn_explicit
>     raise message
> Warning: Incorrect string value: '\xC2\x92s' for column 'name' at row 1
>
> So I think one problem is that your table is not actually set up the way you
> think it is.
>
> Another may be that you data is not really correct either. What you are
> showing that you have in your data is this character:
>
> http://www.fileformat.info/info/unicode/char/0092/index.htm
>
> and I suspect what you really want is either of these:
>
> http://www.fileformat.info/info/unicode/char/2122/index.htmhttp://www.fileformat.info/info/unicode/char/00ae/index.htm
>
> Either of these would display better than what you have:
>
> >>> u1 = u'LaserJet\u2122'
> >>> print u1
> LaserJet(tm)
> >>> u2 = u'LaserJet\xae'
> >>> print u2
>
> LaserJet(R)
>
> Karen
> --http://tracey.org/kmt/
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr.

Running all the tests of a clean Django 1.1.1 installation on my machine shows many internal django errors

2010-05-25 Thread Sebastian
Hello, running all the tests of a clean Django 1.1.1 installation on
my machine shows many internal django errors. You can see the complete
output and stacktraces here: http://gist.github.com/411942
Any idea?

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



Re: Running all the tests of a clean Django 1.1.1 installation on my machine shows many internal django errors

2010-05-25 Thread Sebastian Sanitz
I am sorry - this problem was already adressed:
http://code.djangoproject.com/changeset/11821

I upgraded to Django 1.1.2 and everything is fine!

On Tue, May 25, 2010 at 4:29 PM, Sebastian  wrote:
> Hello, running all the tests of a clean Django 1.1.1 installation on
> my machine shows many internal django errors. You can see the complete
> output and stacktraces here: http://gist.github.com/411942
> Any idea?

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



Grouping of applications in admin

2010-05-25 Thread Dejan Noveski
Hello,

Is there a way i can group admin models from different applications to show
in one container in admin initial page?

Thanks,
Dejan

-- 
--
Dejan Noveski
Web Developer
dr.m...@gmail.com
Twitter: http://twitter.com/dekomote | LinkedIn:
http://mk.linkedin.com/in/dejannoveski

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



Re: Security Question...

2010-05-25 Thread ringemup
Ah, I see what you mean about sending things in plaintext over SSL.
You're right, that would be a lot simpler.

That said, I think I can handle the API keys with one model plus less
than a dozen lines of verification code, so it's not a huge burden.  I
just don't have a whole lot of experience devising security schemes,
so wanted to make sure the concept was fundamentally sound.  ;-)

Thanks  for all your help!


On May 25, 10:26 am, Alex Robbins 
wrote:
> Yeah, I understand that the data doesn't need to be encrypted. I just
> agree with you that SSL would be ideal.
>
> If you had SSL, then I don't think you'd need to work as hard with the
> public/private key hashing stuff. If all the transmitted data was
> encrypted (SSL) you could just send a clear-text password in the post
> data. No hashing, no public/private key, just easy.
>
> Alex
>
>
>
> On Tue, May 25, 2010 at 9:17 AM, ringemup  wrote:
>
> > By app-level solution you mean some sort of custom encryption /
> > decryption scheme for the data dictionaries?
>
> > I'm still not convinced the data needs encryption -- I mean, it
> > wouldn't hurt and in an ideal world I'd just push everything over SSL,
> > but the worst thing that happens if someone gets hold of the data
> > we're exchanging is a customer who has to call support because their
> > activation key registers as already in-use, not any sort of identity
> > theft or loss of financial credentials.
>
> > Mostly with this I'm just trying to make sure that I can prevent
> > unauthorized users from using the API to make themselves free
> > activation keys.
>
> > On May 25, 10:02 am, Alex Robbins 
> > wrote:
> >> It might be worth a try to see if the self-signed cert gets you into
> >> trouble or not. Some url libraries might complain about it, but I
> >> don't think that the behavior is universal. As I think about it, I
> >> think it is normally browsers that whine about self-signed certs.
> >> Maybe the other server wouldn't even mention it? Anyway, it'd be a lot
> >> easier to setup an ssl cert than roll your own app level solution.
>
> >> Good luck!
> >> Alex
>
> >> On May 24, 10:57 am, ringemup  wrote:
>
> >> > Not a bad idea, actually, but the other site is on shared hosting, so
> >> > I don't expect the host to be willing to add a self-signed cert as
> >> > trusted.
>
> >> > On May 24, 10:07 am, Alex Robbins 
> >> > wrote:
>
> >> > > Just a thought, but if you are the only person using the url, you
> >> > > could make your own self-signed security cert. It would be free and
> >> > > protect your data. It won't show up as trusted to users, but your
> >> > > other server can be set to accept it. (Assuming the lack of ssl is a
> >> > > budget issue, that wouldn't fix a technical issue.)
>
> >> > > Alex
>
> >> > > On May 23, 10:10 am, ringemup  wrote:
>
> >> > > > Hi folks --
>
> >> > > > I'm putting together a simple API to allow a separately-hosted but
> >> > > > trusted site to perform a very limited set of actions on my site.  
> >> > > > I'm
> >> > > > wondering whether the design I've come up with is reasonably secure:
>
> >> > > > - Other site gets an API key, which is actually in two parts, public
> >> > > > key and private key, each of which is a uuid generated by Python's
> >> > > > uuid module.
>
> >> > > > - The API key object in the DB references a User object, whose
> >> > > > permissions determine what actions the API key owner may take
>
> >> > > > - Other site submits a POST request to a special URL on my site.  
> >> > > > POST
> >> > > > request contains 3 vars: public_key, data (as JSON), hash.
>
> >> > > > - Hash is a SHA1 of the data concatenated with the private key
>
> >> > > > - I use the public key to search the database for the API key and
> >> > > > permissions.
>
> >> > > > - I generate the SHA1 of the data concatenated with the private key
> >> > > > from the DB, and check it against the submitted hash; only if they
> >> > > > match do I decode the data dict and take the actions specified within
>
> >> > > > - I then return an HTTP response containing a JSON object of the
> >> > > > format:
>
> >> > > > {
> >> > > >     return_data: [object containing success / failure codes, 
> >> > > > messages,
> >> > > > any other data],
> >> > > >     hash: [SHA1 of return_data concatenated with private key]
>
> >> > > > }
>
> >> > > > - All data will be transmitted in the clear (no SSL currently
> >> > > > available -- *sigh*), but there will be no sensitive data in the
> >> > > > incoming data dict.  return_data may contain values that aren't meant
> >> > > > to be broadcasted, but aren't really sensitive (along the lines of
> >> > > > activation keys for a game)
>
> >> > > > Do you see any major potential flaws in this plan?
>
> >> > > > 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-us...@googlegroups.com.
> >> > > > To unsubs

Re: ordering inside regroup

2010-05-25 Thread maciekjbl
I just refer to : "Regroup can't do that alone" by zinckiwi.

Maybe regroup in this situation is useless I don't know this.

If not regroup then what ? Any ideas ?

On 25 Maj, 14:30, Scott Gould  wrote:
> On May 25, 3:57 am, maciekjbl  wrote:
>
> > Thank you, for your answer.
>
> > I didn't have time to check this because of flood in my company.
>
> > I thought that 'regroup' can't be order by any other sorting beside
> > it's own.
>
> > So I have to order it right and then use 'regroup' or 'regroup' then
> > ordering, this is what I don't get.
>
> It's not quite appropriate to say that regroup has a sort order of
> "its own". It simply pulls one of the parameters out, and unless all
> the objects that share that parameter are together, you probably won't
> get the result you're after. See the docs, especially the last part
> where it demonstrates a set that isn't ordered properly:
>
> http://docs.djangoproject.com/en/1.2/ref/templates/builtins/#regroup
>
> Regards
> Scott
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

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



testing the comment framework using the test client

2010-05-25 Thread Thierry
How do you guys test implementations of the django comment framework?
A regular post doesnt seem to work because it depends on data from a
previous get.
An thoughts?

def test_comment(self):
item_url = reverse('item', args=['4558'])
self.client.login(username=self.username,
password=self.password)
import datetime
test_message = 'test at %s' % datetime.datetime.today()
item_view = self.client.get(item_url)
comment_submit = self.client.post(item_url, {'comment':
test_message})
test = open('test.html', 'w')
import os
print dir(test)
print test.name
print os.path.abspath(test.name)

test.write(unicode(comment_submit))
item_view = self.client.get(item_url)
self.assertContains(item_view, test_message)

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



Re: Post and Comment with the same Model.

2010-05-25 Thread nameless
mmm so I could use Post model with a foreign key to blog and a Comment
model with a generic foreign key ( because I could comment post,
images, videos, ecc ). Is this a wrong ? What is the better solution
in your opinion ? Thanks ^_^


-

On 25 Mag, 13:32, Tom Evans  wrote:
> On Tue, May 25, 2010 at 12:20 PM, nameless  wrote:
> > Generic field because on my project you can post and comment in Blogs,
> > Gallery pages, Foto pages, video pages, ecc.
> > So I want to use my Post_comment models for post and comment
> > anythings.
> > Is this a wrong solution ?
> > Are there problems with the performances ?
>
> > Thanks ;)
>
> Well, GFKs aren't cheap (or rather, can be expensive).
>
> It depends whether you think that galleries/photos/videos have
> posts/comments (m2m from gallery/photo to post/comment), or that
> posts/comments are associated with any object (GFK).
>
> The GFK allows you to easily find the object associated with a
> post/comment. The m2m approach allows you to easily find the comments
> associated with a particular object.
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

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



Re: Post and Comment with the same Model.

2010-05-25 Thread Scott Gould
>From your description thus far I'd probably try to use
django.contrib.comments and be done with it. Build the specific models
you need for your app, but don't reinvent the wheel when there's a
perfectly good generic commenting app out there already.

On May 25, 12:01 pm, nameless  wrote:
> mmm so I could use Post model with a foreign key to blog and a Comment
> model with a generic foreign key ( because I could comment post,
> images, videos, ecc ). Is this a wrong ? What is the better solution
> in your opinion ? 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



XML serialize - sql cursor

2010-05-25 Thread Bruno Galindro da Costa
Hi all,

  I need to serialize in XML, through django.core.serializers class, the
result of the function bellow. Is it possible? If not, how can I execute the
query bellow through Django´s API?

*MY FUNCTION:*

def select_site_sql():
cursor = connection.cursor()
cursor.execute("""select site.nm_site, site.vr_site, site.us_site,
site.ps_site, site.dt_deploy_site, serv.nm_servico
  from sitemanager_site site,
sitemanager_site_servico site_serv, sitemanager_servico serv
   where site.cd_site = site_serv.site_id
  and site_serv.servico_id =
serv.cd_servico;
""")
return cursor.fetchall()


*MODELS:*

class Operadora(models.Model):
cd_operadora = models.AutoField(primary_key=True)
nm_operadora = models.CharField('operadora',max_length=200)

def __unicode__(self):
return self.nm_operadora

class Servico(models.Model):
cd_servico = models.AutoField(primary_key=True)
nm_servico = models.CharField('serviço',max_length=50)
vr_servico = models.CharField('versão',max_length=15)
st_servico = models.CharField('status',max_length=15,blank=True)

def __unicode__(self):
return '%s %s %s' % (self.nm_servico, self.vr_servico,
self.st_servico)

class Site(models.Model):
cd_site = models.AutoField(primary_key=True)
nm_site = models.CharField('nome',max_length=50)
vr_site = models.CharField('versão',max_length=15,blank=True)
us_site = models.CharField('usuário',max_length=100)
ps_site = models.CharField('senha',max_length=100)
dt_deploy_site = models.DateTimeField(blank=True,auto_now=True)
operadora = models.ForeignKey(Operadora,db_column='cd_operadora')
servico = models.ManyToManyField(Servico,db_column='cd_servico')

def __unicode__(self):
return '%s %s' % (self.nm_site, self.operadora)

-- 
Att.
Bruno Galindro da Costa
bruno.galin...@gmail.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Email Backend setting needed, a potential bug

2010-05-25 Thread Lakshman Prasad
Hi,

Since I upgraded to 1.1.2, I am unable to send mails as django seems
expecting a EMAIL_BACKEND.

I tried to simply downgrade back to 1.1.1 not having to bother, but the
error continues.

I seems like a bug, but I don't know how it can be one, because, I cant see
how sending email can go untested.

Any pointers to what I am doing wrong, or if something is wrong in django,
appreciated. Thanks.

Following is the trraceback:

File "/usr/local/lib/python2.6/dist-packages/django/core/mail/__init__.py"
in send_mail
  59. fail_silently=fail_silently)
File "/usr/local/lib/python2.6/dist-packages/django/core/mail/__init__.py"
in get_connection
  29. path = backend or settings.EMAIL_BACKEND
File "/usr/local/lib/python2.6/dist-packages/django/utils/functional.py" in
__getattr__
  273. return getattr(self._wrapped, name)
Exception Type: AttributeError at /home/
Exception Value: 'Settings' object has no attribute 'EMAIL_BACKEND'

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



Turning "DEPUG=False" results in missing CSS

2010-05-25 Thread tom
Hi,

I have currently built a website with Django. After developing
everything locally with "python manage.py runserver", I have switched
for testing to Apache and mod_python.

Everything worked fine there as well. All pages are rendered correctly
(PS: For the layouting, I use 3 CSS files).


Now, I want to go into production mode. The only thing I did so far:
turning DEPUG to False in my settings.py.

RESULT:  All my pages seems to have lost the CSS files. The text parts
are there, but the layouting doesn't work.

When I turn DEPUG back to True in my "settings.py", the layouting of
the pages works again.

???


What happens when DEPUG is set to False - any changes to the path or
security settings?

Thanks in advance for any help.

Kind regards,
Tom

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



ModelForm gives invalid option.

2010-05-25 Thread Joshua Frankenstein Lutes
I have a Model that looks something like this:

==
class Turtle(models.Model):
turtle_type = models.IntegerField(null=False, blank=False,
choices=TURTLE_TYPES)
==

I use it to create a ModelForm:

==
class TurtleForm(forms.ModelForm):
class Meta:
model = Turtle

widgets = {
'turtle_type': forms.RadioSelect,
}
==

The problem is that when I display the TurtleForm, it shows a radio
select for "-", which correlates to a null option. This
doesn't validate when the form is submitted and I don't want it to be
a selectable option. How can I prevent this from being displayed?
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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: multi table inheritance ordering bug in postgreSQL backend?

2010-05-25 Thread gentlestone
seems to be there was no problem with postrgeSQL backend

the reason was multiple model inheritance - first ancestor with
ordering, second whitout ... was interpreted randomly in model query

maybe helps to someone ...

On May 24, 9:08 pm, gentlestone  wrote:
> class Dokument(Model):
>     ...
>     class Meta:
>         abstract = True
>         ordering = ['id']
>
> class SupisMajetku(Dokument):
>     ...
>
> class Pozemok(SupisMajetku):
>     ...
>
> --
>
> is producing this SQL:
>
> --
>
> SELECT "supisy_supismajetku"."id", ... FROM "supisy_pozemok" INNER
> JOIN "supisy_supismajetku" ON ("supisy_pozemok"."supismajetku_ptr_id"
> = "supisy_supismajetku"."id") WHERE ...
>
> --
>
> whitout any ORDERING clause. Seems to be the backend for postgreSQL is
> bad. Any suggestions or experience ?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

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



EmailField etc. and VARCHAR / TEXT

2010-05-25 Thread Jonathan Hayward
For CharField, EmailField, URLField, etc., is VARCHAR implementation
(meaning a fixed limit on length) absolutely non-negotiable, or there a way
to make e.g. a CharField that won't truncate if you cross some arbitrary
length?

(If you don't specify a length, does it assign a default length, or use TEXT
instead of VARCHAR so that a field of indefinite length is accommodated,
resources permitting?)

-- 
→ Jonathan Hayward, christos.jonathan.hayw...@gmail.com
→ An Orthodox Christian author: theology, literature, et cetera.
→ My award-winning collection is available for free reading online:
☩ I invite you to visit my main site at http://JonathansCorner.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Resize uploaded file file with PIL

2010-05-25 Thread Igor Rubinovich
Hi,

I want to resize the uploaded file before saving a form. I'd like to
do something like

img = request.FILES['image']
img.thumbnail( (200,200), Image.ANTIALIAS)
img.save(request.FILES['image'], "JPG")

photo_form = forms.PhotoEditForm(request.POST, request.FILES,
instance=photo)
photo_form.save()

i.e. I'd like to put it into the form resized, and preferably without
a temporary file.

What I don't know is what FILES object really is so it's hard to
figure out what's the right way to achieve this.

Any ideas?

Thanks,
Igor

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



Re: Resize uploaded file file with PIL

2010-05-25 Thread Gonzalo Delgado
El 25/05/10 19:12, Igor Rubinovich escribió:
> I want to resize the uploaded file before saving a form. I'd like to
> do something like
>
> img = request.FILES['image']
> img.thumbnail( (200,200), Image.ANTIALIAS)
> img.save(request.FILES['image'], "JPG")
>
> photo_form = forms.PhotoEditForm(request.POST, request.FILES,
> instance=photo)
> photo_form.save()
>
> i.e. I'd like to put it into the form resized, and preferably without
> a temporary file.
>
> What I don't know is what FILES object really is so it's hard to
> figure out what's the right way to achieve this.
>
> Any ideas?
>   

You want to take a look at easy-thumbnail:
http://github.com/SmileyChris/easy-thumbnails

-- 
Gonzalo Delgado 

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



mod_wsgi can't find app to import..but I added path to wsgi file?!

2010-05-25 Thread Chris Seberino
I can successfully run a toy WSGI app with my Apache/mod_wsgi set up.

When I try to run my Django app with mod_wsgi it can't ever find the
modules to load and Apache's error.log gives ImportError's.

I tried adding paths to sys.path in the wsgi file.

Not what else to try.

cs

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



templatetag processing order

2010-05-25 Thread Jason Persampieri
(cross-posted to StackOverflow)

I am trying to write a set of template tags that allow you to easily
specify js and css files from within the template files themselves.
Something along the lines of {% requires global.css %}, and later in
the request, {% get_required_css %}.

I have this mostly working, but there are a couple of issues. We'll
start with the 'timing' issues.

Each template tag is made up of two steps, call/init and render. Every
call/init of every tag used in the request (excluding tags used within
templates loaded via inclusion tags... but that's another story)
happens before any render procedure is called.  Hence, in order to
guarantee that all of the files are queued before the {%
get_required_css %} is rendered, I need to build my list of required
files in the call/init procedures themselves.

So, I need to collect all of the files into one bundle per request.
The context dict is obviously the place for this, but unfortunately,
the call/init doesn't have access to the context variable.

Is this making sense? Anyone see a way around this (without resorting
to a hack-y global request object)?

Another possibility to store these in a local dict but they would
still need to be tied to the request somehow... possibly some sort of
{% start_requires %} tag? But I have no clue how to make that work
either.

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



Re: Turning "DEPUG=False" results in missing CSS

2010-05-25 Thread Brian Neal
On May 25, 2:51 pm, tom  wrote:
> Hi,
>
> I have currently built a website with Django. After developing
> everything locally with "python manage.py runserver", I have switched
> for testing to Apache and mod_python.
>
> Everything worked fine there as well. All pages are rendered correctly
> (PS: For the layouting, I use 3 CSS files).
>
> Now, I want to go into production mode. The only thing I did so far:
> turning DEPUG to False in my settings.py.
>
> RESULT:  All my pages seems to have lost the CSS files. The text parts
> are there, but the layouting doesn't work.
>
> When I turn DEPUG back to True in my "settings.py", the layouting of
> the pages works again.
>
> ???

I'm assuming you mean DEBUG, not DEPUG.

Anyway, you probably have configured the dev server to server static
files for you when DEBUG is on. Look in your urls.py for DEBUG.

You'll need to configure Apache to server the static files when you
deploy in that configuration:

http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#id1

Best,
BN

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



Re: mod_wsgi can't find app to import..but I added path to wsgi file?!

2010-05-25 Thread Kenneth Gonsalves
On Wednesday 26 May 2010 03:52:16 Chris Seberino wrote:
> I tried adding paths to sys.path in the wsgi file.
> 

you need to add the path to the *parent* directory of your project, and your 
project should have __init__.py in every folder where there are python files
-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

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



Re: mod_wsgi can't find app to import..but I added path to wsgi file?!

2010-05-25 Thread Graham Dumpleton


On May 26, 12:03 pm, Kenneth Gonsalves  wrote:
> On Wednesday 26 May 2010 03:52:16 Chris Seberino wrote:
>
> > I tried adding paths to sys.path in the wsgi file.
>
> you need to add the path to the *parent* directory of your project, and your
> project should have __init__.py in every folder where there are python files

And the directories/files must be readable by the user that Apache is
running the application as, ie., the Apache user, if you haven't used
daemon mode and run it as a different user.

Graham

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



Re: Resize uploaded file file with PIL

2010-05-25 Thread Igor Rubinovich
Thanks a lot for this :)

But I really want to do what I said I want to do.

Does anyone has a suggestion?

On May 26, 12:23 am, Gonzalo Delgado  wrote:
> El 25/05/10 19:12, Igor Rubinovich escribi :
>
>
>
>
>
> > I want to resize the uploaded file before saving a form. I'd like to
> > do something like
>
> > img = request.FILES['image']
> > img.thumbnail( (200,200), Image.ANTIALIAS)
> > img.save(request.FILES['image'], "JPG")
>
> > photo_form = forms.PhotoEditForm(request.POST, request.FILES,
> > instance=photo)
> > photo_form.save()
>
> > i.e. I'd like to put it into the form resized, and preferably without
> > a temporary file.
>
> > What I don't know is what FILES object really is so it's hard to
> > figure out what's the right way to achieve this.
>
> > Any ideas?
>
> You want to take a look at 
> easy-thumbnail:http://github.com/SmileyChris/easy-thumbnails
>
> --
> Gonzalo Delgado 

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



Just one action on all the objects

2010-05-25 Thread rahul jain
Hi Django,

Can i run an action without any need to select all. It should by
default select everything, basically all the objects. No separate
checkbox for every object, no select all.
Also, possibly no choices, just a single button which say "action"
which should perform that action on all the objects.

for ex:

HTML Button say "Delete" on the top of change list page. When I hit it
performs delete operation on all the objects.

I need it because I want to perform just one action on all the objects.

--RJ

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



disabling dashboard 'recent actions'

2010-05-25 Thread rahul jain
Hi Django,

How to disable the dashboard ('recent actions') on django admin main page ?

--RJ

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



Re: Resize uploaded file file with PIL

2010-05-25 Thread Kenneth Gonsalves
On Wednesday 26 May 2010 12:12:39 Igor Rubinovich wrote:
> But I really want to do what I said I want to do.
> 
> Does anyone has a suggestion?
> 
http://docs.djangoproject.com/en/dev/ref/request-response/#httprequest-objects
http://docs.djangoproject.com/en/dev/topics/files/#topics-files

basically django stores the filename in the db and the actual file on the 
filesystem, so to manipulate, all you need to do is find the file on the 
filesystem and modify it using standard python.

-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

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