Re: Django and third party python apps, best practices for path locations?

2010-09-16 Thread werefr0g
Hello, I think you should use virtualenv for lot of reasons: * it is easy to use * you can even change you python interpreter according context without mixing accidentally libs from previous version, for example * you can test if upgrading a library, module, app doesn't break your project (yo

Re: Mudar Senha de um usuário

2010-09-17 Thread werefr0g
Hello, I don't accuratly understand what your asking for, sorry. Have you seen what's in http://docs.djangoproject.com/en/1.2/topics/auth/ ? I think that views.password_change already manages what your describing. If not, could you express what doesn't fit your expectations, please? Regards

Re: Relationship question: What do I do wrong?

2010-09-18 Thread werefr0g
Axel, You should use "related_name" attribute in your models.ForeignKey fields. Regards Le 18/09/2010 08:26, Axel Bock a écrit : Hello, I am currently experimenting with a little webapp, and I have the following problem. I want to assign two properties of the same type to a class. (Stupid)

Re: Relationship question: What do I do wrong?

2010-09-18 Thread werefr0g
Hello, I was quite laconic previously in order to spare you my "english". Sorry if you found this rude. Well, you describe the relashionship from one model perspective (Meal) while setting your field (side1).By setting Field side1 in Meal as models.ForeignKey, you state that a Meal has a re

Re: Universal form

2010-09-25 Thread werefr0g
Hello, You're assuming that form are called only from views. Some Form methods are mostly used inside templates like as_p for example. Another assumption you made is that all url point to html ressources. Images, javascripts can have their url. Generation of pdf, csv and AJAX mechanics are o

Re: Universal form

2010-09-25 Thread werefr0g
Le 25/09/2010 14:52, werefr0g a écrit : You're assuming that form are called only from views. Some Form methods are mostly used inside templates like as_p for example. Sorry for the double post but this statement is far from accurate (to be kind with myself). You can use form in a tem

Re: How do you set choices in your application?

2010-09-25 Thread werefr0g
Hello, I'm not legitimate to answer you but I'm adding other options that experienced people can comment. I'd rather use a ForeignKey in that context but I don't have to think to much to performances in my apps. You can easily add status, handle i18n this way. I must confess that writing "d

Re: SITE_ID

2010-09-25 Thread werefr0g
Hello, I searched the web for your error message and found that maybe you should see at INSTALLED_APPS level [1]. Regards, [1] http://www.pubbs.net/200908/django/40799-django-sites-framework.html -- You received this message because you are subscribed to the Google Groups "Django users" gr

Re: Where do you put your business logic in django? Organizing big projects in django.

2010-09-27 Thread werefr0g
Hello, The following is quite long but reflects a non developper point of view. I'll expose briefly that business analysis already splits logic and why I think you should follow previous recommandations. I'll finish "out of subject" commenting your documentation request. > Split business lo

Re: UnicodeEncodeError

2010-09-29 Thread werefr0g
Hi, You should check that your file is actually utf-8 encoded and add the folliwing right after shebang: # -*- coding: utf-8 -*- Le 29/09/2010 18:59, jean polo a écrit : Hi. I get an 'UnicodeEncodeError' if I upload a file (ImageField) with non- ascii chars in my application (django-1.2.1).

Re: UnicodeEncodeError

2010-09-29 Thread werefr0g
Isn't the filename a string? It may not be the solution but I think you should try them at least since they are very quick to apply. As I saw something implying os module I thought that before Django handles the string, it must encode by os module. I found that using previously written step

Re: UnicodeEncodeError

2010-09-29 Thread werefr0g
Jean, Sorry, the three points are: > # -*- coding: utf-8 -*- line > checking the module's file is actually utf-8 encoded > using codecs module for file like read/ write operations. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to t

Re: UnicodeEncodeError

2010-09-29 Thread werefr0g
Tu peux m'envoyer ton fichier ? je vérifie son encodage. Sinon, quel OS utilises-tu ? Le 29/09/2010 23:14, jean polo a écrit : On Sep 29, 10:38 pm, werefr0g wrote: Jean, Sorry, the three points are: ># -*- coding: utf-8 -*- line > checking the module's file i

Re: UnicodeEncodeError

2010-09-30 Thread werefr0g
Sorry, sorry I proposed Jean to send me the actual file to check its encoding. I asked for his OS too in order to see what editor are available and how it allows to "transcode" the text. -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: Problems displaying image objects in a Django template using a custom template tag? (coding included)

2010-10-20 Thread werefr0g
Hello, I think you should use something like alt="{{ object.title }}" /> in your template: you want to output images' url in your template, not the "object" itself. You'll find explanations in [1] and [2]. Regards [1] http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.

Re: The same table in 2 apps

2010-10-23 Thread werefr0g
Hello, You have defined "MyClass" for "foo" application in its models.py, and you want to use that class in your application "bar"? You'll find how to use models from another app in Django documentation [1]. A widly spread example is the import of User in your app from django.contrib.auth [2

Re: Forms: set required value at runtime

2010-10-23 Thread werefr0g
Bence, I think your problem is related to the second case described in documentation about validation fields that depend on each other [1]. Just an observation about your design, if I may: I believe you should explicitly set and store both addresses. You will ease user task by providing a wi

Re: Form Functionality

2010-11-14 Thread werefr0g
Hi Matt, I think your form should use GET method, not POST method: there is no modification implied when submitting it. Now, I'm perfectly fine using parameters in the url as it is meaningful: your accessing the search ressource and passing it a parameter. It's different for a ressource that

Re: Form/view for ManyToMany relationship

2011-03-03 Thread werefr0g
Hello, Sorry if I misunderstand, but what is wrong about using a ModelForm on your Film bounded to the film instance? Regards -- 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.

Re: Creating one model row from another model save method

2011-03-03 Thread werefr0g
Hello, You should substitute 'subgallery_set' to 'subGallery_set' (different in case) or specify a related_name [1] . Regards [1] http://docs.djangoproject.com/en/dev/topics/db/queries/#many-to-many-relationships -- You received this message because you are subscribed to the Google Groups

Re: Form/view for ManyToMany relationship

2011-03-04 Thread werefr0g
On Thu, Mar 3, 2011 at 11:50 AM, werefr0g wrote: Hello, Sorry if I misunderstand, but what is wrong about using a ModelForm on your Film bounded to the film instance? My bad... how did I missed the intermediary model involved in the ManyToMany relashionship. Sorry. When I tried that I kept

Re: Form/view for ManyToMany relationship

2011-03-04 Thread werefr0g
sorry, I failed to pass the request to the view's function,.. Le 04/03/2011 22:08, werefr0g a écrit : On Thu, Mar 3, 2011 at 11:50 AM, werefr0g wrote: Hello, Sorry if I misunderstand, but what is wrong about using a ModelForm on your Film bounded to the film instance? My bad... how

Re: Form/view for ManyToMany relationship

2011-03-05 Thread werefr0g
Le 05/03/2011 00:01, kgardenia42 a écrit : Thanks. This is pretty close to what I'm doing. However, I'd like to not have to write all the associated boiler-plate (i.e. I have to figure out if any film/actor relationships have been deleted since the last save and explicitly write code to remo

Re: How to limit a ManyToManyField to three choices?

2011-03-11 Thread werefr0g
Hello, Can Model.clean() method help you? [1] You'll still have to pay attention to validation before trying to save your instances.[2] Regards, [1] http://docs.djangoproject.com/en/dev/ref/models/instances/#django.db.models.Model.clean [2] http://docs.djangoproject.com/en/dev/releases/1.2/

Re: test cannot find assertContains

2011-03-12 Thread werefr0g
Hi, As far I can tell from the documentation, to use Django's extended TestCase, you should use django.test.TestCase [1]. Using django.utils.unittest allows you to benefit from python 2.7 unittest2 library, [2] Regards, [1] http://docs.djangoproject.com/en/dev/topics/testing/#django.test.T

Re: How to limit a ManyToManyField to three choices?

2011-03-12 Thread werefr0g
Well, MAX_CUISINES = 3 def clean(self): # three cuisines max. allowed if self.pk is None: # That's the case that raise the error # you're inserting a new Restaurant pass else: # Here, you're editing an existing Restaurant

Re: Initial save()

2011-03-12 Thread werefr0g
Hello, I'd rather check for self.pk as you can use primary_key argument on a field whatever is its name. Regards, -- 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 unsubscr

Re: How to format the "value" attribute of an option in a Select List using the template language for loop

2011-03-15 Thread werefr0g
Hello, If you use a paginator [1], you'll prepare the "index number" in the view but this will provide all the context you need in your template. Regards, [1] http://docs.djangoproject.com/en/dev/topics/pagination/ -- You received this message because you are subscribed to the Google Groups

Re: How to format the "value" attribute of an option in a Select List using the template language for loop

2011-03-16 Thread werefr0g
Check this link. http://www.djangobook.com/en/2.0/chapter19/ I think this is an example about what you are looking for: __ _{% for lang in LANGUAGES %} {{ lang.1 }} {% endfor %}_ __ On Tue, Mar 15, 2011 at 3:04 PM, werefr0g <mailto:weref...@yahoo.fr>> wrote:

Re: How to format the "value" attribute of an option in a Select List using the template language for loop

2011-03-16 Thread werefr0g
Sorry again, Actually, the doc tell us the way [1]. Simply use {{ forloop.counter }} or {{ forloop.counter0 }}. Regards, -- 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 u

Re: How to format the "value" attribute of an option in a Select List using the template language for loop

2011-03-16 Thread werefr0g
Well... here is the lin (right into the relevant section) : http://docs.djangoproject.com/en/dev/ref/templates/builtins/#for -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To u

Re: /admin weirdness

2011-03-17 Thread werefr0g
Hi Bobby, Maybe some mistake on your url.py, for example if you have an app named "app" and a model named "model", you'll try to get this url to add a new "model" /admin/app/model/add/ Usually, you'll write your urls.py like this: (r'^app/', include('app.urls')), (r'^admin/', includ

Re: Model with several ManyToManyFields - related_name problem

2011-03-17 Thread werefr0g
Hello, I believe you need related_name, for disambiguation at least. Maybe by setting a db_table you can bypass the related_name but I'm not convinced. Actually, I'm "parasiting" your post to ask when "[we]'d prefer Django didn't create a backwards relation"? Regards, -- You received this

Re: Django templates: accessing list element attributes throws error

2011-03-17 Thread werefr0g
Hi, you can try {{ list.0.title }} Regards, -- 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...@googlegroup

Re: Defining global names

2011-03-18 Thread werefr0g
Hi, After seeing this [1], I use a "conf" package inside all my apps, with a 'settings.py' file. Done properly, this enables you to provide defaults with your apps while allowing to define custom settings at project level if iinside you apps.conf.settings you check first if this value is set

Re: Posted Screen Text Field Manipulation

2011-03-18 Thread werefr0g
Hank, Would you mind posting the link on the list? I may be wrong, but I believe that sending a message directly to someone is not in the "etiquette". You'll also help keeping this list stalker friendly. Regards, -- You received this message because you are subscribed to the Google Groups "D

Re: Auto import files into database

2011-03-20 Thread werefr0g
IMHO, while dealing with database data modifications from a csv file, you should not let default commit on each save(). This will help you preserve data from accidents (if something is wrong inside the serie, maybe the serie shouldn't be processed) and you'll have better speed processing these

Re: Uso de subconsultas

2011-04-10 Thread werefr0g
Hello, Maybe you mean: >>> result = A.objects.select_related().annotate(num_b=Count('b')).aggregate(max_num_b=Max(num_b)) >>> result['max_num_b'] In that case, you take each A value, count for each its related B occurences, then retain the highest count. Regards, Le 06/04/2011 16:25, be

Re: how to Generate a 5 character unique alpha-numeric string

2011-04-11 Thread werefr0g
Well, I don't think it is safe but you can first retrive Max('pk') then, you can increment its base 36 related number then use the result's string equivalent. Le 11/04/2011 08:48, GKR a écrit : I meant to say not random. serial eg: .. .. 2A00A 2A00B .. .. .. 2A00Z 2A010 2A011 .. ... 2

Re: New to Django-Installation problem

2011-04-13 Thread werefr0g
Are you using python 3? -- 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 option