Image browsing in django

2013-10-10 Thread Harjot Mann
When I am browsing an image in my form it is giving me this error even after browsing the image. :( http://screencloud.net/v/ch9e -- Harjot Kaur Mann Blog: http://harjotmann.wordpress.com/ Daily Dairy: http://harjotmann.wordpress.com/daily-diary/ -- You received this message because you are sub

Edited objects in admin interface aren't saved

2013-10-10 Thread Nubrigol
I'm having this weird problem in my admin interface where deleting and creating objects works fine, but if I try to edit an object, the changes aren't saved. There are no errors and the save button appears to work, until you look back at the object you saved and it doesn't reflect the changes

Re: Retrieving json stored in TextField as json

2013-10-10 Thread Marc Aymerich
On Thu, Oct 10, 2013 at 6:02 PM, Daniel Roseman wrote: > On Thursday, 10 October 2013 10:08:18 UTC+1, Marc Aymerich wrote: >> >> Hi Rafael, thanks ! >> I forgot to mention that I was already using django-jsonfield >> https://github.com/bradjasper/django-jsonfield >> and now I've tried with django-

Re: Call method of the session template

2013-10-10 Thread Bill Freeman
No. You can't pass an argument to a model method from the template. I see two options for you: 1. Rework the method so that the argument is optional, and if the argument is not provided, the method uses a reasonable default (maybe item.product?). 2. Write a custom template filter that lets you

Re: Call method of the session template

2013-10-10 Thread Ricardo Kamada
I tried numerous times ... but if I put that way {% 'item.remove_single' item.product %} or {% 'item.remove_single' product= item.product %} blames this error " Invalid block tag: ''item.remove_single'', expected 'empty' ou 'endfor' " Ricardo 2013/10/10 Bill Freeman > The remove method require

Re: Call method of the session template

2013-10-10 Thread Bill Freeman
The remove method requires an argument. You're not supplying one (you can't in a template variable reference). On Thu, Oct 10, 2013 at 1:29 PM, Ricardo wrote: > Hi, I'm using django carton to shopping cart. > I am not able to call the method remove_single in my template. on line 15 > I tried s

Re: ALLOWED_HOSTS and dynamic dyn site

2013-10-10 Thread Xavier Ordoquy
Hi michael, I've also noticed a couple of issues with it. Thanks to raven and sentry I noticed those requests were missing the hostname in their headers and decided I didn't care more. You might want to use them and see if it's the same for you. Best regards, Xavier, Linovia. Le 10 oct. 2013 à

Call method of the session template

2013-10-10 Thread Ricardo
Hi, I'm using django carton to shopping cart. I am not able to call the method remove_single in my template. on line 15 I tried several ways but I can not. If you can help carton ---> http://pastebin.com/X4FtHRZU template ---> http://pastebin.com/0AJYFB1x thank you Ricardo -- You received

Re: Looking for a way to detect changes in database records with low storage footprint

2013-10-10 Thread Tom Evans
On Thu, Oct 10, 2013 at 2:55 PM, DJ-Tom wrote: > > Thanks, but *how* can I create a hash from a database object in Django - is > there a generic method to iterate over all (or only specific) fields and get > a hash value? > This is not a full solution, but you can select out extra fields (and the

ALLOWED_HOSTS and dynamic dyn site

2013-10-10 Thread R. Michael Herberger
Hello Django Users, I have upgraded to django 1.5 and am getting errors because of the ALLOWED_HOSTS, Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): The HTTP_HOST headers are the current IP address of my server depending on what has been allocated. Even with "*", I am getting

Re: Retrieving json stored in TextField as json

2013-10-10 Thread Daniel Roseman
On Thursday, 10 October 2013 10:08:18 UTC+1, Marc Aymerich wrote: > Hi Rafael, thanks ! > I forgot to mention that I was already using django-jsonfield > https://github.com/bradjasper/django-jsonfield > and now I've tried with django-json-field but with the same unfortunate > result: > > Time

Re: Extension to QuerySet.values()

2013-10-10 Thread Arnaud Delobelle
On Thursday, 10 October 2013 15:19:32 UTC+1, Ramiro Morales wrote: > > > On Oct 10, 2013 10:02 AM, "Arnaud Delobelle" > > wrote: > > > > Hi Russ, > > > > Thanks for the feedback. I agree that this could possibly be integrated > into the values() method. I just used a new method in order to mi

Re: readonly_fields depending on request

2013-10-10 Thread Roberto López López
Hi, It was something like that: def get_form(self, request, obj=None, **kwargs): if not request.user.groups.filter(name__exact='administration') and not request.user.is_superuser: import itertools self.readonly_fields = itertools.chain(self.readonly_fields, ('i

Re: readonly_fields depending on request

2013-10-10 Thread Timothy W. Cook
On Thu, Oct 10, 2013 at 10:04 AM, Roberto López López wrote: > This is, for example, my code overriding get_readonly_fields(): > > def get_readonly_fields(self, request, obj=None): > readonly = super(NewsAdmin, self).get_readonly_fields(request, obj) > if request.user.groups.fi

Re: Looking for a way to detect changes in database records with low storage footprint

2013-10-10 Thread C. Kirby
You could grab the __dict__ of the instance and use that. import hashlib hash = hashlib.md5() hash.update(str(MyModel.objects.get(pk = 1).__dict__)) hash.digest() On Thursday, October 10, 2013 8:55:27 AM UTC-5, DJ-Tom wrote: > > > Thanks, but *how* can I create a hash from a database object in D

Re: Extension to QuerySet.values()

2013-10-10 Thread Ramiro Morales
On Oct 10, 2013 10:02 AM, "Arnaud Delobelle" wrote: > > Hi Russ, > > Thanks for the feedback. I agree that this could possibly be integrated into the values() method. I just used a new method in order to minimise interference with our existing code. I'll read the 'contributing' document then se

Re: Looking for a way to detect changes in database records with low storage footprint

2013-10-10 Thread DJ-Tom
Thanks, but *how* can I create a hash from a database object in Django - is there a generic method to iterate over all (or only specific) fields and get a hash value? Am Mittwoch, 9. Oktober 2013 19:07:54 UTC+2 schrieb Nikolas Stevenson-Molnar: > > A hash should work fine. Alternatively, you c

Re: readonly_fields depending on request

2013-10-10 Thread Roberto López López
This is, for example, my code overriding get_readonly_fields(): def get_readonly_fields(self, request, obj=None): readonly = super(NewsAdmin, self).get_readonly_fields(request, obj) if request.user.groups.filter(name__exact='administration') or request.user.is_superuser:

Re: Extension to QuerySet.values()

2013-10-10 Thread Arnaud Delobelle
Hi Russ, Thanks for the feedback. I agree that this could possibly be integrated into the values() method. I just used a new method in order to minimise interference with our existing code. I'll read the 'contributing' document then see if I can find a bit of spare time to do this properly!

Re: readonly_fields depending on request

2013-10-10 Thread Timothy W. Cook
Can you post the code you tried with get_form()? It should be the solution. On Thu, Oct 10, 2013 at 9:45 AM, Roberto López López wrote: > Hi, > > In my project I make use of django-admin. I need to have different > readonly_fields depending on the user is connected, thus administrators > will

readonly_fields depending on request

2013-10-10 Thread Roberto López López
Hi, In my project I make use of django-admin. I need to have different readonly_fields depending on the user is connected, thus administrators will be able to modify all fields, and other users less fields. Which method do I have to override? I have already tried ModelAdmin.get_readonly_fields() a

Combining example Polls app with django-registration

2013-10-10 Thread Alex Koudrin
I'm learning Django (Ubuntu 13.04, Python 2.7, Django 1.5, Postgres 9.2, Bootstrap 3.0). As my first effort I got the Polls app going from the Django 1.5 tutorial . I then installed django-registration 1.0

Re: Advanced Tutorial (how to write reusable app), last step does not work

2013-10-10 Thread Sebastian Wade
hi,guys u should read this content: https://docs.djangoproject.com/en/1.0/intro/tutorial04/ > We’re using two generic views here: object_list() and object_detail(). > Respectively, those two views abstract the concepts of “display a list of > objects” and “display a detail page for a particul

Re: Advanced Tutorial (how to write reusable app), last step does not work

2013-10-10 Thread Sebastian Wade
hi, guys hoped this may help you. https://docs.djangoproject.com/en/1.0/intro/tutorial04/ > We’re using two generic views here: object_list() and object_detail(). > Respectively, those two views abstract the concepts of “display a list of > objects” and “display a detail page for a particular ty

Re: Table in models.py not being created during syncdb

2013-10-10 Thread Sergiy Khohlov
Have you added schedule to installed application list ? Many thanks, Serge +380 636150445 skype: skhohlov On Wed, Oct 9, 2013 at 4:11 PM, Edward Lazarenko wrote: > Can you tell what did you exactly do, to make it work? > > On Wednesday, March 31, 2010 10:16:11 PM UTC+5, wchildsuk wrote: >> >

Re: Retrieving json stored in TextField as json

2013-10-10 Thread Marc Aymerich
Hi Rafael, thanks ! I forgot to mention that I was already using django-jsonfield https://github.com/bradjasper/django-jsonfield and now I've tried with django-json-field but with the same unfortunate result: TimeSerie.objects.filter(type='cpu').values('value') [{'value': '{"scheduled":2,"total":8