Change Language while using Django-ModelTranslation package

2011-11-10 Thread Gokul G
How can we change language settings when Inserting data so that the data is stored in the corresponding field (fieldname_en for english etc..). I ve tried using activate(language_code), but it doesnt seem to work for insert statements. -- You received this message because you are subscribed to th

Re: best practice

2011-11-10 Thread mirco fini
fantastic, that was exactly what I was looking for thanks a lot Mirco On 9 Nov, 22:35, Marc Aymerich wrote: > On Wed, Nov 9, 2011 at 10:32 PM, Marc Aymerich wrote: > > On Wed, Nov 9, 2011 at 10:18 PM, mirco fini wrote: > >> hello, > > >> I would like to ask you if anyone knows some best pract

memcached - Errors and Solution - please provide comments!

2011-11-10 Thread ionic drive
Hello django friends, Problems: 1) MemcachedKeyCharacterError: Control characters not allowed 2) MemcachedKeyLengthError: Key length is > 250 We where conflicted with problem number one, but the solution should also work for the second error which did not happen on our system. System-In

django-shortcuts

2011-11-10 Thread Ganesh Kumar
Ho to install django-shortcuts module Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import django.shortcut Traceback (most recent call last): File "", line 1, in ImportError: No module named short

Choicefield in django

2011-11-10 Thread Asif Jamadar
Suppose I have choicefield in my django model which consist of several choices. Now in future if I changed the existing choice (option) with some other name (choice), then whether the existing records in model with that choice(option) will also change? Or In admin page I need to set that new op

Re: memcached - Errors and Solution - please provide comments!

2011-11-10 Thread Malcolm Box
On 10 November 2011 08:54, ionic drive wrote: > Hello django friends, > > Problems: > > 1) MemcachedKeyCharacterError: Control characters not allowed > 2) MemcachedKeyLengthError: Key length is > 250 > > The obvious solution is not to generate keys with these properties. >def _smar

Re: best practice

2011-11-10 Thread Marc Aymerich
On Thu, Nov 10, 2011 at 7:24 AM, mirco fini wrote: > fantastic, that was exactly what I was looking for Sure you find interesting this references: DjangoCon 2008: Reusable Apps http://youtu.be/A-S0tqpPga4 Other djangocon talks http://blip.tv/djangocon This stackoverflow question has a good boo

Re: Yup!

2011-11-10 Thread Paul Msegeya
oh hell yeah...thanx On Thu, Aug 25, 2011 at 3:12 PM, Firian wrote: > Definitely in! > > -- > 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,

Re: memcached - Errors and Solution - please provide comments!

2011-11-10 Thread ionic drive
Yes Malcolm, thanks for the great and smart answer! You are totally right, this was the reason why I was asking for, I already knew their could be coming up new troubles. two more questions: -- We don't have troubles with > 255 keys. as we do not have such long keys. But we have t

from django.shortcuts import render_to_response

2011-11-10 Thread Ganesh Kumar
Hi How to install render_to_response module. please guide me. In [10]: from django.shortcuts import render_to_response --- ImportError Traceback (most recent call last) /root/django-shortcuts/ i

Re: memcached - Errors and Solution - please provide comments!

2011-11-10 Thread Tom Evans
On Thu, Nov 10, 2011 at 11:25 AM, ionic drive wrote: > Yes Malcolm, > > thanks for the great and smart answer! > You are totally right, this was the reason why I was asking for, I > already knew their could be coming up new troubles. > > two more questions: > -- > We don't have tro

Re: from django.shortcuts import render_to_response

2011-11-10 Thread Tom Evans
On Thu, Nov 10, 2011 at 11:26 AM, Ganesh Kumar wrote: > Hi > How to install  render_to_response module. > please guide me. > > In [10]: from django.shortcuts import render_to_response > --- > ImportError                      

Re: django-shortcuts

2011-11-10 Thread Nikhil Verma
Hi, You just need to 1) Download the zip or tar file of that module.(type in google django shortcut various links) 2) There must be a setup.py file. 3) Go to terminal or cmd (windows) . 4) Go to that directory. 5) Type python setup.py install /sudo python setup.py install On Thu, Nov 10, 2011 at

Re: memcached - Errors and Solution - please provide comments!

2011-11-10 Thread ionic drive
ok, so removing the invalid keys is the best solution. great thank you guys! ionic On Thu, 2011-11-10 at 11:36 +, Tom Evans wrote: > On Thu, Nov 10, 2011 at 11:25 AM, ionic drive wrote: > > Yes Malcolm, > > > > thanks for the great and smart answer! > > You are totally right, this was the

RE: [] Re: memcached - Errors and Solution - please provide comments!

2011-11-10 Thread Henrik Genssen
Hi inonc, >Why am I the only one who seems to be faced with such issues? >I thought millions out there do use memcached as their backend...? >Wouldn't be MD5 a great solution to all of us? The guys with small >sites, don't have issues with scaling, and the guys with big sites are >in the need of a

Re: delete a field( many to many)

2011-11-10 Thread Aleksandar Ristić
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10. 11. 11 8:50, jose osuna perez wrote: > Sorry xD > Hi, i wrote the same text in a Spanish blog xD, well I explain my > problem, I have a table that has the following model: > > class Proyectos(models.Model): > titulo=models.CharField(max_length

Re: delete a field( many to many)

2011-11-10 Thread Tom Evans
2011/11/10 Aleksandar Ristić : > If I understood correctly, you need to remove a user from a project. You > can do it like this: > > datos.usarios.remove(User.objects.get(id=user_id)) > datos.save() > You don't need to save() the model instance after removing an item from an M2M link - you haven't

minimum best practices examples

2011-11-10 Thread czam
Hello all, just started with django. I did the 4 parts of the tutorial. Now I am stuck with getting password_reset functionality on the log-in form. That's kind of difficult for a noob and I think it shouldn't be. Could anyone be so kind to point me to a minimum django 1.3 example application that

Re: ImportError: No module named profiles

2011-11-10 Thread Alfredo Alessandrini
Hi, in crontab I put this: DJANGO_SETTINGS_MODULE=mysite.settings 0 4 * * * python /path/to/maintenance/script.py The script is like this: #!/usr/bin/env(path to virtualenv folder) python some standard query Thanks, Alfredo 2011/11/10 nicolas HERSOG : > Can you show us your scrip

How to iterate over a formset?

2011-11-10 Thread Satyajit Sarangi
This is my forms.py: from django import forms from django.forms.formsets import formset_factory class CodeForm(forms.Form): code = forms.CharField(widget = forms.Textarea) CodeFormSet = formset_factory(CodeForm, extra = 5) How do I iterate over the data? I tried this: if requ

Re: delete a field( many to many)

2011-11-10 Thread jose osuna perez
Thank very much, but I don't know what's happen. I execute the next code and it's doing nothing : if request.POST.get('usuariosDelete','')!='': for i in request.POST.getlist('usuarios'): usuario=User.objects.get(id=i) datos.usuarios.remove(usuario) --

Re: Choicefield in django

2011-11-10 Thread Michael P. Soulier
On 10/11/11 Asif Jamadar said: > Suppose I have choicefield in my django model which consist of several > choices. Now in future if I changed the existing choice (option) with some > other name (choice), then whether the existing records in model with that > choice(option) will also change? Or In

render only 1 radioselect field

2011-11-10 Thread jay K.
Hello, does anyone know how to render only 1 radioselect in a django template? for now I have {{ form.options }} but it renders the whole list. I'd like to have more control on which ones I want to render thanks in advance -- You received this message because you are subscribed to the Google

Re: models.FileField versus forms.FileField

2011-11-10 Thread Elliott Brun
Ah that makes sense a little, so just for html. But to clarify it seems like the forms.fileField can be used in a model in place of models.filefield, as in the code below. I have gotten models.FileField(uploadTo = /somedir) to work just fine in development. Is there some advantage to the formsHand

Re: Get the current url in django template

2011-11-10 Thread Martin Pajuste
If you need something like "http://example.com/music/bands/the_beatles/?print=true"; try {{request.build_absolute_uri}} https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.build_absolute_uri -- You received this message because you are subscribed to the Google Gr

Re: Get the current url in django template

2011-11-10 Thread Andres Reyes
To use the request object in a template you need django.core.context_processors.request in your TEMPLATE_CONTEXT_PROCESSORS 2011/11/10 Martin Pajuste > If you need something like " > http://example.com/music/bands/the_beatles/?print=true"; try > {{request.build_absolute_uri}} > > https://docs.d

Re: initial data to Formset causing problem

2011-11-10 Thread Bill Freeman
Have you called form.is_valid() somewhere that you're not showing? On Wed, Nov 9, 2011 at 7:15 AM, Asif Jamadar wrote: > I’m assigning initial data to the field of each formset dynamically. But > when I’m trying to save that initial data it’s throwing “Key Error” in > cleaned data. Any solution?

Re: Serializing a model with a pickefield field

2011-11-10 Thread Bill Freeman
Since I don't see PickleField in the 1.3 Model Field docs, you probably have to supply more information in order to get an answer. If it has to do with python's pickle serialization, note that they are not generally promised to be compatible from on python version to the next, so you need to have

Splendid issue with the login view, TransactionMiddleware, and DEBUG mode

2011-11-10 Thread Tobia Conforto
Phew! I just finished wrestling with a TransactionMiddleware ordering issue. Basically, if TransactionMiddleware is after SessionMiddleware (as suggested by the docs*) then a login operation, as done by the default login view, is only committed to the session when Django is running in debug mode.

How to download a file

2011-11-10 Thread Virginia
Good day everyone, I'm trying to allow a user to dowload to his machine an excel file from the server. This is my code: wrapper = FileWrapper(open(path_to_file)) content_type = mimetypes.guess_type(path_to_file)[0] response = HttpResponse(wrapper,content_type=content_type)

Re: How to download a file

2011-11-10 Thread Andre Terra
You should serve your files directly through the server (preferably not the built-in django development server), instead of writing a django view. Use nginx[1], apache[2] or any other server, then place the excel file in a directory outside of your django app, and write an alias to that location.

Re: How to download a file

2011-11-10 Thread Phanounou
Hello AT, Thanks for your suggestion but I cannot do it this way because I can only developpe with the built-in server. So that's why I was trying to to send it through response. Do you have a suggestion for that? Thanks again, VB 2011/11/10 Andre Terra > You should serve your files directly t

Re: How to download a file

2011-11-10 Thread Nikolas Stevenson-Molnar
This document describes how to serve static files in development mode: https://docs.djangoproject.com/en/1.2/howto/static-files/ _Nik On 11/10/2011 11:22 AM, Phanounou wrote: Hello AT, Thanks for your suggestion but I cannot do it this way because I can only developpe with the built-in server

Re: models.FileField versus forms.FileField

2011-11-10 Thread Ivo Brodien
Hi, > But to clarify it seems like the forms.fileField can be used in a model in > place of models.filefield, as in the code below. > class UploadFileForm(forms.Form): >title = forms.CharField(max_length=50) >file = forms.FileField() In your code you are using only forms, no models inv

Need help upgrading old view/url to new syntax...

2011-11-10 Thread Micky Hulse
Hello, I am in the process of upgrading this "old" functional code: urls_old.py: views_old.py: Here's what I have so far: urls.py: views.py:

How to set up a Flash-based file upload form?

2011-11-10 Thread zak
All the cool websites have abandoned the HTML input type="file" tag, they are using a little Flash thing that can take multiple files at once. 1. Where do I find the Flash code? 2. How do I add this Flash code to a Django template? 3. How can the Django view function handle the uploaded files? A

Re: Need help upgrading old view/url to new syntax...

2011-11-10 Thread Andres Reyes
See https://gist.github.com/1356199/bd1af5e81d51ef32a3f4aa29a7a9120c9a8ffe85 The problem is that you're overriding get_queryset when you should be overriding get_object 2011/11/10 Micky Hulse > Hello, > > I am in the process of upgrading this "old" functional code: > > urls_old.py: >

Re: ImportError: No module named profiles

2011-11-10 Thread Alfredo Alessandrini
#!/home/alfredo/mysite_env/bin/python import sys, os import imaplib from django.contrib.auth.models import User popserver = 'pop.gmail.com' user = 'u...@gmail.com' password = '---' def CheckEmail(email): try: p = User.objects.get(email = email) if p.email == email:

Remote working job opportunity for Python/Django programmers

2011-11-10 Thread Gordon Mac
Hello Python/Django techies, One our client is in need of Python/Django programmer for developing web based casino gaming software using Python,Django,HTML5,Flash, mySQL. Job Requirements: Expert level experience in gathering casino games software requirements, normalization of data,design & imp

Re: Need help upgrading old view/url to new syntax...

2011-11-10 Thread Micky Hulse
Hi Andres, thanks so much for the quick reply, I really appreciate it. On Thu, Nov 10, 2011 at 1:00 PM, Andres Reyes wrote: > See https://gist.github.com/1356199/bd1af5e81d51ef32a3f4aa29a7a9120c9a8ffe85 > The problem is that you're overriding get_queryset when you should be > overriding get_objec

Re: Need help upgrading old view/url to new syntax...

2011-11-10 Thread Micky Hulse
On Thu, Nov 10, 2011 at 3:47 PM, Micky Hulse wrote: > Whoa! That works perfectly! Ack! I spoke too soon. My context variable name of "user" conflicted with the current logged-in user (looks like there's already a "user" variable floating around at the template level... I assume this variable com

Re: Need help upgrading old view/url to new syntax...

2011-11-10 Thread Andres Reyes
Glad to be able to help 2011/11/10 Micky Hulse > On Thu, Nov 10, 2011 at 3:47 PM, Micky Hulse wrote: > > Whoa! That works perfectly! > > Ack! I spoke too soon. > > My context variable name of "user" conflicted with the current > logged-in user (looks like there's already a "user" variable float

Re: maultiple .js files for debug and one minimized .js for production

2011-11-10 Thread Gelonida N
On 11/08/2011 07:37 PM, Fabian Ezequiel Gallina wrote: > 2011/11/8 Andres Reyes mailto:armo...@gmail.com>> > > I've been using django-compressor and totally recommend it > > > https://github.com/mintchaos/django_compressor > > > > I second that, works like charm and I really like the

Adding a user/accounts table to Postgres in Django View

2011-11-10 Thread Tyre
Calling the following adduser function in views.py. I save the user first because it's id (automatically created by Django upon INSERT) is the primary/foreign key for accounts and passwords. Adding a user seems to be working fine, but then when it gets to the `Accounts(user=u)`, the following error

runserver namespace problem?

2011-11-10 Thread Ken
hi all I have a django website dir tree like this: mysite - app1 - tasks.py - tests.py - views.py - models.py there is a function *outprint* in tasks.py In shell one, I use command "python manage.py celeryd -B -l info" to run ce

Re: How to set up a Flash-based file upload form?

2011-11-10 Thread Martin Ostrovsky
Hey Zak, Take a look at uploadify (www.uploadify.com). It relies on jQuery, but it's probably the plugin you've seen around the net, it's quite popular and easy to setup / modify. On Nov 10, 3:44 pm, zak wrote: > All the cool websites have abandoned the HTML input type="file" tag, > they are usi

Re: Get the current url in django template

2011-11-10 Thread Sultan Imanhodjaev
Hello, Once I used request.META["PATH_INFO"] On Nov 10, 2011 10:54 PM, "Andres Reyes" wrote: > To use the request object in a template you need > django.core.context_processors.request in your TEMPLATE_CONTEXT_PROCESSORS > > > 2011/11/10 Martin Pajuste > >> If you need something like " >> http