Re: Translation problem
On Apr 11, 6:43 am, gcorneau <[EMAIL PROTECTED]> wrote: > # -*- coding: utf-8 -*- > from django import newforms as forms > from django.conf import settings > from django.utils.translation import ugettext_lazy as _ > from apparto.building import models > > class BuildingForm(forms.Form): > #~ contact = forms.ChoiceField() > > civic_number = forms.IntegerField(label=_('Numéro')) > # Other fields omitted... > > When I navigate to this form, I get the following: > > DjangoUnicodeDecodeError at /apparto/account/addbuilding/ > 'ascii' codec can't decode byte 0xe9 in position 3: ordinal not in > range(128). You passed in 0x0180D170> () > Request Method: GET > Request URL:http://127.0.0.1/apparto/account/addbuilding/ > Exception Type: DjangoUnicodeDecodeError > Exception Value:'ascii' codec can't decode byte 0xe9 in position 3: > ordinal not in range(128). You passed in > ( 'django.utils.functional.__proxy__'>) > Exception Location: C:\Python25\Lib\site-packages\django\django\utils > \encoding.py in force_unicode, line 60 > Python Executable: C:\Python25\python.exe > Python Version: 2.5.1 > > Unicode error hint > > The string that could not be encoded/decoded was: Num?ro > > I made sure all my templates had {% load i18n %} > > I tried to reverse the French and English strings in the .po file and > recompiled: no error when I switch languages. > > Did I simply forget something obvious? I am having the exact same problem but with Japanese text, any resolution? help?, tip? //mauro// --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Translation problem
Thank you Gaetan, I tried to add a BOM to the .po file but I got an error when compiling the messages. (kind of expected) Then I tried to add it at the beginning of my template file but keep getting the same DjangoUnicodeDecodeError . When you mention "save your source file with a BOM" which file do you refer to? I am using Linux BTW. Traceback: File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response 82. response = callback(request, *callback_args, **callback_kwargs) File "/home/mauro/qpe_site/main/engines/main_engine.py" in board_post 329. context_data={'form':form.as_table()} File "/usr/lib/python2.5/site-packages/django/newforms/forms.py" in as_table 169. return self._html_output(u'%(label)s% (errors)s%(field)s%(help_text)s', u'%s', '', u'%s', False) File "/usr/lib/python2.5/site-packages/django/newforms/forms.py" in _html_output 138. label = escape(force_unicode(bf.label)) File "/usr/lib/python2.5/site-packages/django/utils/encoding.py" in force_unicode 60. raise DjangoUnicodeDecodeError(s, *e.args) Exception Type: DjangoUnicodeDecodeError at /board/post Exception Value: 'ascii' codec can't decode byte 0xe8 in position 0: ordinal not in range(128). You passed in () Any other tip ? I've been stack for days here :( Thank you, //mauro// On Apr 30, 10:33 pm, gcorneau <[EMAIL PROTECTED]> wrote: > Yes: make sure you save your source file with a BOM. At least, that > worked for me (I develop under Windows). > > I hope this helps, > Gaetan > > On 30 avr, 10:06, Mauro <[EMAIL PROTECTED]> wrote: > > > On Apr 11, 6:43 am, gcorneau <[EMAIL PROTECTED]> wrote: > > > > # -*- coding: utf-8 -*- > > > from django import newforms as forms > > > from django.conf import settings > > > from django.utils.translation importugettext_lazyas _ > > > from apparto.building import models > > > > class BuildingForm(forms.Form): > > > #~ contact = forms.ChoiceField() > > > > civic_number = forms.IntegerField(label=_('Numéro')) > > > # Other fields omitted... > > > > When I navigate to this form, I get the following: > > > >DjangoUnicodeDecodeErrorat /apparto/account/addbuilding/ > > > 'ascii' codec can't decode byte 0xe9 in position 3: ordinal not in > > > range(128). You passed in > > 0x0180D170> () > > > Request Method: GET > > > Request URL:http://127.0.0.1/apparto/account/addbuilding/ > > > Exception Type:DjangoUnicodeDecodeError > > > Exception Value:'ascii' codec can't decode byte 0xe9 in position > > > 3: > > > ordinal not in range(128). You passed in > > > ( > > 'django.utils.functional.__proxy__'>) > > > Exception Location: C:\Python25\Lib\site-packages\django\django\utils > > > \encoding.py in force_unicode, line 60 > > > Python Executable: C:\Python25\python.exe > > > Python Version: 2.5.1 > > > > Unicode error hint > > > > The string that could not be encoded/decoded was: Num?ro > > > > I made sure all my templates had {% load i18n %} > > > > I tried to reverse the French and English strings in the .po file and > > > recompiled: no error when I switch languages. > > > > Did I simply forget something obvious? > > > I am having the exact same problem but with Japanese text, any > > resolution? help?, tip? > > > //mauro// --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Translation problem
On May 1, 4:36 pm, Mauro <[EMAIL PROTECTED]> wrote: > Thank you Gaetan, > > I tried to add a BOM to the .po file but I got an error when compiling > the messages. (kind of expected) > Then I tried to add it at the beginning of my template file but keep > getting the sameDjangoUnicodeDecodeError. > > When you mention "save your source file with a BOM" which file do you > refer to? > I am using Linux BTW. One interesting thing I forgot to mention. If I use ugettext instead of ugettext_lazy, it works fine. Translations shows perfectly, but I can not dynamically switch the language because the form gets translated only once when running django. so I *need* ugettext_lazy. It sounds like a bug .. but I am not sure.. //mauro// --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Error in running the django server
Hello, I'm trying to run the django server on my mac book pro 2011 with osx lion but I get an error. I'm using the mamp mysql database and I've already configured it inside the setting file. When I try to run the command: python manage.py runserver I got this error: Validating models... Unhandled exception in thread started by > Traceback (most recent call last): File "/Library/Python/2.7/site-packages/django/core/management/ commands/runserver.py", line 88, in inner_run self.validate(display_num_errors=True) File "/Library/Python/2.7/site-packages/django/core/management/ base.py", line 249, in validate num_errors = get_validation_errors(s, app) File "/Library/Python/2.7/site-packages/django/core/management/ validation.py", line 28, in get_validation_errors from django.db import models, connection File "/Library/Python/2.7/site-packages/django/db/__init__.py", line 78, in connection = connections[DEFAULT_DB_ALIAS] File "/Library/Python/2.7/site-packages/django/db/utils.py", line 93, in __getitem__ backend = load_backend(db['ENGINE']) File "/Library/Python/2.7/site-packages/django/db/utils.py", line 33, in load_backend return import_module('.base', backend_name) File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module __import__(name) File "/Library/Python/2.7/site-packages/django/db/backends/mysql/ base.py", line 14, in raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Users/maranomauro/.python-eggs/MySQL_python-1.2.3- py2.7-macosx-10.7-intel.egg-tmp/_mysql.so, 2): Library not loaded: / usr/local/lib/libmysqlclient.18.dylib Referenced from: /Users/maranomauro/.python-eggs/MySQL_python-1.2.3- py2.7-macosx-10.7-intel.egg-tmp/_mysql.so Reason: image not found I think the error is from the mysql-python requirments. But I've already installed it using easy_install. Maybe there is some problem with the mamp database? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
What's the django convention for templates?
Hello, I'm totally new in the django universe and I'm trying out to build a little project. There are many days who I'm following many tutorial on django framework. But it's not clear for me how the convention for templates is. Following the djangobook I've build a projects who has the following strurcture: projects | --- | __init__.py | manage.py | settings.py | urls.py | app folder | -- | many files | templates | | index.php As you can see the templates directory is stored inside the app directory. Reading the django documentation instead they says that the templates dir should live inside the root directory of the projects. I'm wondering, what's is the common convention about it? I thought to store the templates dir inside each apps, because in this way the apps are more pluggables...I'm going wrong? Thank you -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/UX6fBcCAaDkJ. To post to this group, send email to django-users@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: What's the django convention for templates?
Thank you :) -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/LCxQRS7kTnkJ. To post to this group, send email to django-users@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.
upload files via ajax
Hello, is it possible to upload files via ajax? I would like to upload multiple files in my application but i have the following exception: MultiPartParserError: Invalid boundary in multipart: None I'm using django 1.1. The ajax request has the content type header set as mulitpart/form- data -- 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: upload files via ajax
On 23 Dic 2010, 23:12, Paul Osman wrote: > On Thu, Dec 23, 2010 at 9:39 AM, Mauro wrote: > > Hello, > > is it possible to upload files via ajax? > > > I would like to upload multiple files in my application but i have the > > following exception: > > > MultiPartParserError: Invalid boundary in multipart: None > > > I'm using django 1.1. > > The ajax request has the content type header set as mulitpart/form- > > data > > This was recently posted to the Mozilla Webdev blog. Might help you: > > http://blog.mozilla.com/webdev/2010/09/17/django-and-ajax-image-uploads/ > > -Paul Hi, thanks for replying, but would like to choose the files at once and then upload them one by one (without flash, only html). Using an ajax request, django returns the MultiParseError. Moreover i try to user request._post_raw_data, but i would like to send also some other informations together with the files, and i do not to retrieve them from raw_data, Any other 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: upload files via ajax
On 11 Gen, 12:05, Łukasz Rekucki wrote: > On 11 January 2011 11:28, Jani Tiainen wrote: > > > > > > > On Monday 10 January 2011 16:05:13 Mauro wrote: > >> On 23 Dic 2010, 23:12, Paul Osman wrote: > >> > On Thu, Dec 23, 2010 at 9:39 AM, Mauro wrote: > >> > > Hello, > >> > > is it possible touploadfiles viaajax? > > >> > > I would like touploadmultiple files in my application but i have the > >> > > following exception: > > >> > > MultiPartParserError: Invalid boundary in multipart: None > > >> > > I'm using django 1.1. > >> > > Theajaxrequest has the content type header set as mulitpart/form- > >> > > data > > >> > This was recently posted to the Mozilla Webdev blog. Might help you: > > >> >http://blog.mozilla.com/webdev/2010/09/17/django-and-ajax-image-uploads/ > > >> > -Paul > > >> Hi, thanks for replying, but would like to choose the files at once > >> and thenuploadthem one by one (without flash, only html). Using an > >>ajaxrequest, django returns the MultiParseError. Moreover i try to > >> user request._post_raw_data, but i would like to send also some other > >> informations together with the files, and i do not to retrieve them > >> from raw_data, > >> Any other idea? > > > First at all this is not possible. It is not possible send files usingajax. > > Yes you can:http://www.w3.org/TR/XMLHttpRequest2/This only works > fully in Firefox 4 and Webkit browsers (last I tested). Firefox 3.6 > lacks the FormData object, but has an API to read files from > JavaScript, so you can form-encode the data yourself and use > xhr.send(). An almost complete implementation can be seen > here:http://code.google.com/p/jquery-html5-upload/. > > > > > But you can use ajaxy like approach. Common way is to create (invisible) > > iframe where you clone original form and just do normal post there. > > > When iframe loads you can post back response from server to your > > application. > > It's not fullyajaxbut as close as it can get without using flash. > > I call this HTML4 fallback. I have a whole jQuery plugin that > transparently uses an IFrame if the user's browser doesn't have any of > required HTML5 capabilities. It lets youuploadmultiply files with > additional POST data (e.g. file description, tags). Sadly, I can't > open-source it just yet. > > -- > Łukasz Rekucki Thanks a lot! It seems very interesting! -- 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.
Decimal separator
Hello. How can I establish the comma ',' as the decimal separator? Is there any config file where I should set it up? Thanks. Mauro. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to make such query with django ORM?
2007/11/30, RajeshD <[EMAIL PROTECTED]>: > > > As others have recommended, just use the extra() method. It's not so > bad :) > Hi. What about if I want to do the same thing but in the admin interface? Let's say for example, that in the Article form, I just want to show the Blogs that have certain title. Is it posible to do it? I should use the extra() method in some place? Thanks. Mauro. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Mod_Python Error - ImproperlyConfigured: Error loading psycopg module: No module named psycopg
2007/12/4, AY <[EMAIL PROTECTED]>: > > Hi! I am trying to configure Apache to use facbackopan directory as a > django project, and have the following mod_python error message. Help > would be very appreciated. Thanks in advance! > Hi. > > MOD_PYTHON ERROR > > ImproperlyConfigured: Error loading psycopg module: No module named > psycopg I think that you have an error in the psycopg module. Are you sure it is installed correctly? Can you use it outside django? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Admin filter and search parameters
Hi, how can I know the parameters that the admin interface is using when I apply a filter or I do a search? I want to use those parameters in a custom method. Is it possible to do it? Thanks.
Re: Admin filter and search parameters
2005/11/3, Adrian Holovaty <[EMAIL PROTECTED]>: > Take a look at the URL of an admin change-list page after you've > applied a filter or done a search. The query parameters are, > essentially, the same as keyword arguments that can be passed to > get_list(). > Ok, I get that. But, can I load those applied parameters in my code or in my models?
Keeping filters when adding in the admin interface
Hello, if I have the following Model: class A: name class B: name a = models.ForeignKey(A) class C: name b = models.ForeignKey(B) And let's suppose that in the Admin Site I have a Filter in the C list that refers to the A model. Is there a way to keep that filter when I am going to add a new C object and use it to filter the combobox of the b filed so that it will only show the b objects that are related to the A model in the filter? For example: If the filter I choose points to the id=1 in the A model, the combobox for the b field when I add a C object only has to show the B objects that has a = 1 Is there a way to do this? Thanks a lot for the help. Greetings. Mauro. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Keeping filters when adding in the admin interface
El día 29 de febrero de 2012 19:04, Marc Aymerich escribió: > On Wed, Feb 29, 2012 at 10:55 PM, Marc Aymerich wrote: >> On Wed, Feb 29, 2012 at 8:22 PM, Mauro Sánchez wrote: >>> Hello, if I have the following Model: >>> >>> class A: >>> name >>> >>> class B: >>> name >>> a = models.ForeignKey(A) >>> >>> class C: >>> name >>> b = models.ForeignKey(B) >>> >>> And let's suppose that in the Admin Site I have a Filter in the C list >>> that refers to the A model. Is there a way to keep that filter when I >>> am going to add a new C object and use it to filter the combobox of >>> the b filed so that it will only show the b objects that are related >>> to the A model in the filter? >>> For example: >>> If the filter I choose points to the id=1 in the A model, the combobox >>> for the b field when I add a C object only has to show the B objects >>> that has a = 1 >>> >> >> If I understand you righ, it's a bit triky stuff, you have to do two things: >> 1) Define a custom add_form and override their __init__ method with >> something like: >> self.fields['b'].queryset = self.fields['b'].queryset.filter(a=a_pk) >> 2) Provides the current value of your filter (a_pk) to the defined form on >> 1) >> I think this can be done overriding modeladmin.get_form() method >> since request is one of their args, so you can extract the value of >> the filter on the http referer url and provide it to the form that >> this method creates. >> > > More specifically: > > def get_form(self, request, *args **kwargs): > form = super(YourModelAdmin, self).get_form(request, *args, **kwargs) > a_pk = get_a_pk_from_http_referer(request) > form.a_pk = a_pk > return form > > def __init__(self, *args, **kwargs): > super(YourModelForm, self).__init__(*args, **kwargs) > self.fields['b'].queryset = self.fields['b'].queryset.filter(a=self.a_pk) > Hello Marc, the filter in the __init__ method works fine. I know this because I have set a value manually. But I have a problem when I try to pass the value self.a_pk to the filter in the queryset defined in the __init__ method. This is the error I get: 'CForm' object has no attribute 'a_pk' It's like the form never received this new variable. What can be the problem here? Thanks for the help. Mauro. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Keeping filters when adding in the admin interface
El día 2 de marzo de 2012 11:06, Marc Aymerich escribió: > On Fri, Mar 2, 2012 at 2:18 PM, Mauro Sánchez wrote: >> El día 29 de febrero de 2012 19:04, Marc Aymerich >> escribió: >>> On Wed, Feb 29, 2012 at 10:55 PM, Marc Aymerich wrote: >>>> On Wed, Feb 29, 2012 at 8:22 PM, Mauro Sánchez wrote: >>>>> Hello, if I have the following Model: >>>>> >>>>> class A: >>>>> name >>>>> >>>>> class B: >>>>> name >>>>> a = models.ForeignKey(A) >>>>> >>>>> class C: >>>>> name >>>>> b = models.ForeignKey(B) >>>>> >>>>> And let's suppose that in the Admin Site I have a Filter in the C list >>>>> that refers to the A model. Is there a way to keep that filter when I >>>>> am going to add a new C object and use it to filter the combobox of >>>>> the b filed so that it will only show the b objects that are related >>>>> to the A model in the filter? >>>>> For example: >>>>> If the filter I choose points to the id=1 in the A model, the combobox >>>>> for the b field when I add a C object only has to show the B objects >>>>> that has a = 1 >>>>> >>>> >>>> If I understand you righ, it's a bit triky stuff, you have to do two >>>> things: >>>> 1) Define a custom add_form and override their __init__ method with >>>> something like: >>>> self.fields['b'].queryset = self.fields['b'].queryset.filter(a=a_pk) >>>> 2) Provides the current value of your filter (a_pk) to the defined form >>>> on 1) >>>> I think this can be done overriding modeladmin.get_form() method >>>> since request is one of their args, so you can extract the value of >>>> the filter on the http referer url and provide it to the form that >>>> this method creates. >>>> >>> >>> More specifically: >>> >>> def get_form(self, request, *args **kwargs): >>> form = super(YourModelAdmin, self).get_form(request, *args, **kwargs) >>> a_pk = get_a_pk_from_http_referer(request) >>> form.a_pk = a_pk >>> return form >>> >>> def __init__(self, *args, **kwargs): >>> super(YourModelForm, self).__init__(*args, **kwargs) >>> self.fields['b'].queryset = self.fields['b'].queryset.filter(a=self.a_pk) >>> >> >> Hello Marc, >> the filter in the __init__ method works fine. I know this because I >> have set a value manually. >> But I have a problem when I try to pass the value self.a_pk to the >> filter in the queryset defined in the __init__ method. This is the >> error I get: >> >> 'CForm' object has no attribute 'a_pk' >> >> It's like the form never received this new variable. What can be the >> problem here? >> > > Mmm I never overrided get_form before, so I can not tell for sure what > is wrong. But something you can try with more chances of success is: > > def get_form(self, request, *args **kwargs): > self.form.a_pk = get_a_pk_from_http_referer(request) > return super(YourModelAdmin, self).get_form(request, *args, **kwargs) > > Or maybe... are you working with inlines? if it is the case, you must > override get_formset of the inline class. > Hello Marc, I has just realized that I was placing the get_form definition in the wrong place. The correct place to place it is in the CAdmin redefinition. The code you paste in the first place works great. Thanks a lot for the help. Greetings. Mauro. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Recover User by SESSIONID
Sultan, great ! Guess I'll do that too, it's very unsafe. Thanks for the tip! 2012/6/17 Sultan Imanhodjaev > Hey, > > In my case I use generated hash from *user.id* and *user.date_joined*passed > via > *formData* this is poor implementation and potentially insecure but for a > while it works. > > > Sultan, > Thanks > > On Sun, Jun 17, 2012 at 9:15 PM, upmauro wrote: > >> Hi ! Sorry my english. >> >> I using uploadfy in my website, this basically is one SWF to upload files. >> >> This works fine, but my question is "how recover logged user in post >> uploader request?" >> >> I have SESSIONID in form and my swf post this, but i don't know recover >> user by session id. >> >> Please help-me, thanks ! >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/django-users/-/oeYAADUGPGcJ. >> To post to this group, send email to django-users@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. >> > > > > -- > Kind regards, > Sultan Imanhodjaev > +996 559 06 76 06 > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Recover User by SESSIONID
I Solved ! in formData of uploadfy i add {{ request.COOKIES.sessionid }} and in my view i used : session = Session.objects.get(session_key=request.COOKIES['sessionid']) uid = session.get_decoded().get('_auth_user_id') user = User.objects.get(pk=uid) Works Fine ! Thanks :) 2012/6/17 Mauro Alexandre > Sultan, great ! > > Guess I'll do that too, it's very unsafe. > > Thanks for the tip! > > > 2012/6/17 Sultan Imanhodjaev > >> Hey, >> >> In my case I use generated hash from *user.id* and *user.date_joined*passed >> via >> *formData* this is poor implementation and potentially insecure but for >> a while it works. >> >> >> Sultan, >> Thanks >> >> On Sun, Jun 17, 2012 at 9:15 PM, upmauro wrote: >> >>> Hi ! Sorry my english. >>> >>> I using uploadfy in my website, this basically is one SWF to upload >>> files. >>> >>> This works fine, but my question is "how recover logged user in post >>> uploader request?" >>> >>> I have SESSIONID in form and my swf post this, but i don't know recover >>> user by session id. >>> >>> Please help-me, thanks ! >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django users" group. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msg/django-users/-/oeYAADUGPGcJ. >>> To post to this group, send email to django-users@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. >>> >> >> >> >> -- >> Kind regards, >> Sultan Imanhodjaev >> +996 559 06 76 06 >> >> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Execution time of a long process results in an Internal Server Error 500
Hello, I have a process that takes about 2 or 3 minutes to execute. The problem is that sometimes (not always) it results in an Internal Server Error 500 because of the time it takes. Is there a way to configure Apache or mod_wsgi to prevent this? Let's say, that even if the process takes 10 or 15 minutes it just keeps running until it finish? Thanks a lot for the help. Cheers, Mauro. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
New book: Instant Django 1.5 Application Development Starter
Hi everybody, I just wrote a book to get started with Django and I really hope that the book will drive more developers to use Django and increase the success that this great framework is already having. Thanks also to PacktPublishing that aims to help sustain the projects which it publishes books on by paying royalties to them. I just want to make clear that this book is for real beginners and for that doesn't touch any best practices and advanced topics. Due also to Packt rules this book was really restricted to the minimum useful content for let the reader start with Django. Here you found the book in different formats: http://www.packtpub.com/django-1-5-application-development-starter/book (Amazon,Safari) Thanks Mauro -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: New book: Instant Django 1.5 Application Development Starter
Thank you On Friday, April 5, 2013 8:27:34 PM UTC+2, megaBos wrote: > > good job -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Django 1.5 Tutorial Part 3, Test after Update of Polls/urls.py
Hi, The 34 is the id of the pool record in the database. This means that you don't have a pool with that ID in the database. If you already created some pool object you will probably see something if you navigate to this url /polls/1/results/. If also in this case you got 404 make sure you actually have some pool object in the db. Regards On Wednesday, August 21, 2013 6:02:16 AM UTC+2, Diek Kearney wrote: > > I am going through the Tutorial Django 1.5 Tutorial Part 3, and up to the > current point everything was running smoothly, then I hit a wall that I > cannot figure out. Maybe I am too focused on following, anyways I need some > help. > > After I updated Polls/urls.py: > > from django.conf.urls import patterns, include, url > > > from polls import views > > > urlpatterns = patterns('', > ># ex: /polls/ > >url(r'^$', views.index, name='index'), > ># ex: /polls/5/ > >url(r'^(?P\d+)/$', > >views.detail, name='detail'), > ># ex: /polls/5/results/ > >url(r'^(?P\d+)/results/$', > >views.results, name='results'), > ># ex: /polls/5/vote/ > >url(r'^(?P\d+)/vote/$', > >views.vote, name='vote'), > >) > > The next step is "Take a look in your browser, at “/polls/34/”. It’ll run > the detail() method and display whatever ID you provide in the URL. Try > “/polls/34/results/” and “/polls/34/vote/” too – these will display the > placeholder results and voting pages." I tried and nothing. It generates > a 404 error. Where exactly is the 34 coming from? I like to think things > through but as a beginner in django following a tutorial I need more when > it comes to this section. > > Thanks, > > Derrick > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Problem with translations
Hi, That's strange. To me looks like the server from time to time can not access this files as you said. What you use in production Apache/ModWSGI ? Regards On Wednesday, August 21, 2013 2:57:51 PM UTC+2, Andréas Kühne wrote: > > Hi, > > I am working on a website that is available in 10 different languages, and > we have the translations working. If you want to see our website in french, > you just add /fr to our url and it works fine. > > However we are getting a lot of : > > File "middleware.py", line 83, in process_request > translation.activate(request.locale_dict['language']) > > File > "env/lib/python2.6/site-packages/django/utils/translation/__init__.py", > line 90, in activate > return _trans.activate(language) > > File > "env/lib/python2.6/site-packages/django/utils/translation/trans_real.py", > line 183, in activate > _active.value = translation(language) > > File > "env/lib/python2.6/site-packages/django/utils/translation/trans_real.py", > line 173, in translation > current_translation = _fetch(language, fallback=default_translation) > > File > "env/lib/python2.6/site-packages/django/utils/translation/trans_real.py", > line 141, in _fetch > res._info = res._info.copy() > > AttributeError: 'NoneType' object has no attribute '_info' > > These errors mostly occur when the user requests an ajax enabled update. > As far as I can tell this error is related to the fact that django > tranlsations can't open the .mo files for the specific locale. What I don't > understand is that this happens maybe once every 2 days, so it doesn't > happen all the time. > > The only resources I have found on the subject are regarding to completely > missing .mo translation files (which is not the case here). I am leaning > towards an issue with apache not being able to open the file, because of > restrictions on the number of open files allowed, but I'm not sure. Has > anyone any ideas on how to correct this issue? I should also say that it > has never happened on our development machines. > > Regards, > > Andréas > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
sql query to annotation values e aggretate statements
Hi all. My name's Mauro and I start to work with Django 1.7.3 I work on my project which tracks my accounting. I need to translate a SQL query to annoteta values aggretate statements. The application is named accounting The models involved are: class Nominativo(models.Model): nome = models.CharField(max_length=100) class Impianto(models.Model): nome = models.CharField(max_length=100) class Capitolo(models.Model): nome = models.CharField(max_length=100) class Registrazione(models.Model): anno = models.PositiveIntegerField() impianto = models.ForeignKey('Impianto') nominativo = models.ForeignKey('Nominativo') capitolo = models.ForeignKey('Capitolo') dare = models.DecimalField(max_digits=10, decimal_places=2) avere = models.DecimalField(max_digita=10, decimal_places=2) I need to translate te following sql statement SELECT capitolo.nome, sum(dare) as uscite, sum(avere) as entrate FROM contabilita_registrazione INNER JOIN contabilita_capitolo as capitolo ON contabilita_registrazione.capitolo_id=capitolo.id WHERE anno=2014 GROUP BY capitolo.nome ORDER BYcapitolo.nome; How can obtain the same behavior using ORM? Thanks in advance MZ -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2b6998bf-741e-46c1-8721-e1870e5fe608%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Django 1.7 opening one database connection for each request
Please help, i have a problems in my production enviromet. After Django update when my database stopping by "Too many open connections". I use mariadb and, i tried set explict 'CONN_MAX_AGE' to 0, but now solved. I'm desperate, I do not know what to do with the production environment. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a0df287a-2bfe-4024-b467-ff825079f274%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
How to restrict Model.objects.all() to data pertaining to one organization
Hi everyone, I posted this question <https://stackoverflow.com/questions/47641181/how-to-restrict-model-objects-all-to-data-pertaining-to-one-organization> on Stackoverflow almost 4 months ago and asked a couple of times on #django IRC channel on Freenode, but none gave me a suggestion about the problem. Up to now I have no solution and no clue how to proceed. Maybe you can show me the right direction. Thanks for your time and support! Mauro -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a9647aa9-4743-4bf3-9202-72329e4c38af%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Django dependecies
Hi, Why does django include jquery? django/django/contrib/admin/static/admin/js/vendor/jquery/jquery.js What use does it make of it? I cant have that version of jquery in my app so I want to know that impacts of jquery on django. Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/542460bf-3dee-480a-b0ea-7716671a3fd7%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Ubuntu 16.04 Django 1.9.6 & MySql
I cannot install mysqlclient on this env many errors is there a right path ? thanks MM -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3afa7b2f-1eb1-45d3-8fcf-14284024788c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
How do you disable SECURE_SSL_REDIRECT for some views in Django?
Hello, I configured in my settings SECURE_SSL_REDIRECT=True, but now I want to disable it for some views. I have seen that there is an option SECURE_REDIRECT_EXEMPT where I can define a list of regular expressions for it. But for some reason I can't make it work. I've tried to use the same regular expressions that I use in my urls.py, for example: r'^index/$' But it doesn't do anything. It is still redirecting it to HTTPS. Does anyone has an example of how to use it? I am using Django 1.9 Thanks a lot. Cheers. Mauro. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2fc80c86-ff63-42d3-8a14-a8c88fa11d4b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
From SQL to Django Queryset API
Hi all. My name's Mauro and I working on a DB (SQLite3 now and Postgres in the future). I have a table Movimento with the fields anno integer,impianto integer,dare decimal(10,2),avere decimal(10,2) BY hands I can run SELECT anno,impianto, sum(dare), sum(avere) FROM movimento GROUP BY anno,impianto ORDER BY anno,impianto With django Api I write Movimento.objects.values('anno','impianto').annotate(dare=Sum('dare), avere=Sum('avere)) And I get the same beaviour. Now I need to translate the following SQL script SELECT anno,impianto, sum(dare), sum(avere), sum(dare-avere) FROM movimento GROUP BY anno,impianto ORDER BY anno,impianto into django API queryset. Is it possible todo this in one row? Cna you give me some idea to solve this translaion? Finally I'll render the results into a table. Best regards, MZ -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f9efbb30-9065-410d-b46b-55e2d8f1271c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Revoke celery task
Hello, I am trying to revoke a Pending task in celery without success. I have tried all this ways: app.control.revoke(task_id) revoke(campaign.state_task) async_result.revoke() AsyncResult(task_id).revoke() None of them work. I am using: celery==3.1.23 django-celery==3.1.17 Django==1.9.13 tenant-schemas-celery==0.1.5 Any idea why this is happening. I can't see any errors when I run those commands. Thanks for the help. Cheers -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4a3e73f4-5148-464d-93a1-c3d88190725c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Revoke celery task
Hello, I've found out my problem. It is that I am using Heroku, so when the worker is restarted, the revoked tasks list is lost. How can I persist this list in Heroku? Since I cannot write a file in the filesystem. Thanks a lot. El miércoles, 12 de abril de 2017, 1:09:08 (UTC-3), Mauro Sánchez escribió: > > Hello, I am trying to revoke a Pending task in celery without success. > I have tried all this ways: > app.control.revoke(task_id) > revoke(campaign.state_task) > async_result.revoke() > AsyncResult(task_id).revoke() > > None of them work. I am using: > celery==3.1.23 > django-celery==3.1.17 > Django==1.9.13 > tenant-schemas-celery==0.1.5 > > Any idea why this is happening. I can't see any errors when I run those > commands. > Thanks for the help. > Cheers > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1aa6e56f-667d-456d-bea5-d9818c4df3a3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Passing an ID through a Modal to delete a user in a View
Hello Im having some issues trying to pass an id through a modal. Basically I want to pass an id through a modal, via urls.py and to hit a function in the views to delete the user. This is my modal: Much appreciated for any help. Fairly new to Django. Really hope someone can come to my rescue :-) {% trans 'Delete My Account' %} × {% trans 'Are you sure you want to delete your account?' %} {% trans 'Cancel' %} {% trans 'Yes, delete me' %} {% block bottomjs %} $(function () { $('#delete-account').on('click', function () { $('#ms-preload, #status').show(); }); }); {% endblock %} URLS>PY from django.urls import path from .views import subscriptions, subscribe, unsubscribe,deleteme, get_discounted_value, plan_details, my_subscription, manage_account urlpatterns = [ path('my-subscription/', my_subscription, name='my_subscription'), path('manage-account/', manage_account, name='manage_account'), path('subscriptions/', subscriptions, name='subscriptions'), path('subscribe/', subscribe, name='subscribe'), path('unsubscribe/', unsubscribe, name='unsubscribe'), path('deleteme//', deleteme, name='deleteme'), path('discounted-value/', get_discounted_value, name='discounted-value'), path('plan-details/', plan_details, name='plan-details'), # re_path('discounted-value/(?P([^/]+))/(?P([0-9.]+))/', # get_discounted_value, name='assessment_question'), ] VIEWS @csrf_exempt def deleteme(request): request.user.deleteme(request.POST) return redirect('free_dashboard_index') -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b3aace83-d3f1-43a7-9f10-5a1a07442608%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: upload files via ajax
On Tue, Jan 11, 2011 at 1:12 PM, Jani Tiainen wrote: > > http://valums.com/ajax-upload/ > > There is one standalone version how to do it pretty much browser > independently. > > > > -- > > Jani Tiainen > It seems to be what i am looking for, 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. > > -- 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.