Re: ANN: PyMySQL 0.3

2010-09-29 Thread Bo Shi
The following patch to your application's manage.py will allow you to use pymysql without patching Django. #!/usr/bin/env python +try: +import pymysql +pymysql.install_as_MySQLdb() +except ImportError: +pass + On Sep 10, 12:25 pm, Andy wrote: > On Sep 10,

Re: passing request.META from view to form

2010-09-29 Thread Shawn Milochik
You can just add another keyword argument to your constructor. If you override the __init__ of your form then just pop that item off before passing it on to the __init__ in super() and nobody gets hurt. ;o) Shawn On Sep 29, 2010, at 6:03 PM, Oivvio Polite wrote: > I'm creating new

Re: UnicodeEncodeError

2010-09-29 Thread jean polo
On Sep 29, 11:24 pm, werefr0g wrote: >   Tu peux m'envoyer ton fichier ? je v�rifie son encodage. ca y est > Sinon, quel OS utilises-tu ? I use ubuntu 9.10 (but problem is the same with osx or windows) > > Le 29/09/2010 23:14, jean polo a �crit : > > > On Sep 29, 10:38

passing request.META from view to form

2010-09-29 Thread Oivvio Polite
I'm creating new users+profiles from a form class. The form gets instantiated by a view. I'd like to save the request.META header along with the profile so I need to pass it from the view to the form. The form constructor takes the keyword argument data. Is there anyway I can pass along my

Re: Suppressing field in template for ChoiceField with only one option.

2010-09-29 Thread Shawn Milochik
On Sep 29, 2010, at 5:08 PM, aa56280 wrote: > Can't you specify the value using the initial argument? > http://docs.djangoproject.com/en/dev/ref/forms/fields/#initial > > I did that originally, but it doesn't show up when the HiddenInput renders. That's why I stopped changing the widget.

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

Re: UnicodeEncodeError

2010-09-29 Thread jean polo
On Sep 29, 10:38 pm, werefr0g wrote: >   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. Well, not sure I have the skills to

Re: Suppressing field in template for ChoiceField with only one option.

2010-09-29 Thread aa56280
Can't you specify the value using the initial argument? http://docs.djangoproject.com/en/dev/ref/forms/fields/#initial On Sep 29, 3:33 pm, Shawn Milochik wrote: > Actually, I spoke too soon on this one. My original solution doesn't work > because the hidden input on the

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

Re: Suppressing field in template for ChoiceField with only one option.

2010-09-29 Thread Shawn Milochik
Actually, I spoke too soon on this one. My original solution doesn't work because the hidden input on the form doesn't have a value, so the form won't validate. I fixed this by just adding display: none to the widget attrs in the __init__ instead of changing the widget to a HiddenInput. Now

Re: Checkbox registration from

2010-09-29 Thread aa56280
You'll have to use the RegistrationFormTermsOfService class instead of RegistrationForm. -- 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

Re: UnicodeEncodeError

2010-09-29 Thread jean polo
On Sep 29, 9:42 pm, werefr0g wrote: >   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

Re: Suppressing field in template for ChoiceField with only one option.

2010-09-29 Thread aa56280
That seems pretty straightforward me. You want to customize the form based on the user and so you're doing it when the form is initialized. Makes perfect sense. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

bizarre __iexact behavior

2010-09-29 Thread felix
class KeywordPage(models.Model): url = models.CharField(blank=False, max_length=100,unique=True) ipdb> KeywordPage.objects.filter(url__iexact='/path/to/something/') *** IndexError: list index out of range ipdb> KeywordPage.objects.filter(url__iexact='/path/to/something') *** ValueError:

Re: Something breaking if tag

2010-09-29 Thread aa56280
Thanks for that. I figured it was something along those lines. I didn't think Django did a check on the type as well when evaluating the expression, but apparently it does. Very interesting. Thanks again. On Sep 29, 2:46 pm, Yo-Yo Ma wrote: >

Re: Subclassing User class or User class "profiles" recommended for extra attributes?

2010-09-29 Thread Oli Warner
+1 It's been a while since I've seen anything on this and would really like to know if profiles are really here to stay. I do understand the technical issues but I can't see any that can't be circumvented. Something as integral as membership should be more flexible without the need for spanning

Re: Why Django Apps Suck

2010-09-29 Thread Carles Barrobés
> Given this control flow let's try to do some of the typical > modifications mentioned above: > Authorization: > Django has a beautiful mechanism for authorization, which is using > decorators (@may_do_a_b_or_c) directly in the views.py. > Tempting, but will not be modifyable in any way once you

Suppressing field in template for ChoiceField with only one option.

2010-09-29 Thread Shawn Milochik
I ran into an interesting forms issue today which I came up with a solution for. Now I'm wondering if there's a better way. Situation: I have a forms.Form with several fields in it, including a ChoiceField. The values in this ChoiceField are dependent on what the user has access to. Many

Re: Something breaking if tag

2010-09-29 Thread Yo-Yo Ma
request.GET.get('subtopic') is returning a string, so your if statement is roughly equivalent to: >>> 1 == '1' False The sub_topic = int(request.GET.get('subtopic')) is the correct way to do that. At first glance it seems like a lot of work, but if Django tried to deserialize URL params

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

Re: What is the correct way to copy an object from one model to a similar model?

2010-09-29 Thread Yo-Yo Ma
Thanks guys. I appreciate the help. On Sep 29, 6:43 am, bruno desthuilliers wrote: > On 29 sep, 12:31, Steve Holden wrote: > > > On 9/29/2010 5:25 AM, Daniel Roseman wrote: > > > You can use the get_all_field_names method in model._meta to get

Re: LOGIN FORM

2010-09-29 Thread aa56280
Do you have 'django.middleware.csrf.CsrfViewMiddleware' specified in your settings? On Sep 28, 2:55 pm, Saad Sharif wrote: > Hi all, >            I want to create  a simple login form in django..Please > help I am a complete beginner > > My Code: >

Something breaking if tag

2010-09-29 Thread aa56280
I have in my template the following: {% if subtopic.id == selected_id %}...{% endif %} subtopic.id is being pulled from a list of subtopics that I'm looping over. selected_id is being sent to the template by the view after some form processing: #views.py selected_id =

Re: DjangoCon 2011

2010-09-29 Thread Siraaj Khandkar
On Sep 27, 10:51 pm, Steve Holden wrote: > > Sadly, New York is out for2011. Those (very few) venues whose costs are > low enough are already booked up. Those with space are *much* too > expensive. If we want to look at a New YorkDjangoConUS we should > probably plan at

Re: UnicodeEncodeError

2010-09-29 Thread jean polo
ok, here is the Traceback (and my DB encoding is utf8-general-ci): Traceback (most recent call last): File "/usr/local/alwaysdata/python/django/1.2.1/django/core/handlers/ base.py", line 100, in get_response response = callback(request, *callback_args, **callback_kwargs) File

Re: UnicodeEncodeError

2010-09-29 Thread Steve Holden
It might be helpful to provide rather more of the traceback information. Also, check your database encoding. Somehow you are requiring Django to convert a Unicode string in to an ASCII string. regards Steve On 9/29/2010 2:01 PM, jean polo wrote: > hi Steve > > do you have any advices for

Re: UnicodeEncodeError

2010-09-29 Thread Petite Abeille
On Sep 29, 2010, at 8:01 PM, jean polo wrote: > I have a basic 'Bien' class and a *very basic* 'Image' class (with a > ForeignKey to Bien). > BienAdmin has a ImageInline and that's all. Not even tangentially related, but... "Do people in non-English-speaking countries code in English?"

Re: UnicodeEncodeError

2010-09-29 Thread jean polo
hi Steve do you have any advices for where to look for this to happen ? I have a basic 'Bien' class and a *very basic* 'Image' class (with a ForeignKey to Bien). BienAdmin has a ImageInline and that's all. I am a bit confused.. cheers, _y On Sep 29, 7:39 pm, Steve Holden

Upload above apache web root?

2010-09-29 Thread Federico Capoano
Hi everyone, is it possible to write a custom model filefield that upload files somewhere above the public directory? -- 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

Re: UnicodeEncodeError

2010-09-29 Thread jean polo
sorry if I was not clear but I don't get you. this happens only in the admin when uploading a file (say 'file_é.jpg') for an object. saving the modifications gives the UnicodeEncodeError.. Modifying the same object (still in the admin) and uploading a standard imagefile (which name contains only

Re: UnicodeEncodeError

2010-09-29 Thread Steve Holden
It sounds to me as though the image is being transmitted with the wrong MIME Type. Image files are binary data, but something in your application is treating is as a string. regards Steve On 9/29/2010 1:05 PM, werefr0g wrote: > Hi, > > You should check that your file is actually utf-8 encoded

Re: Django feed templates and how do I use them with images?

2010-09-29 Thread Lisa B
Not exactly what you want, but if you are trying to publish images in your RSS feed with each item: I did this by putting an tag inside the description. Look at the way they did the feed here: http://ciclops.org/rssfeed.php this feed w3c validates and seems to work as desired everywhere I've

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: Django feed templates and how do I use them with images?

2010-09-29 Thread Lisa B
I did this without feed templates by putting an tag inside the description. Look at the way they did it here: http://ciclops.org/rssfeed.php this feed w3c validates and seems to work as expected everywhere I've tried it (feedly, Ning, firefox's display of the feed) Code is just the ordinary from

Re: Separating application media from project media

2010-09-29 Thread Carles Barrobés
At some point I also thought this was a good idea. This way I can reuse the app and all its visual stuff as well. But the problem is that for most cases you will want your templates and media to be consistent with a site's design and look This means that for two projects (sites) re-using the same

UnicodeEncodeError

2010-09-29 Thread jean polo
Hi. I get an 'UnicodeEncodeError' if I upload a file (ImageField) with non- ascii chars in my application (django-1.2.1). I added: export LANG='en_US.UTF-8' export LC_ALL='en_US.UTF-8' in my /etc/apache2/envvars as stated here:

Strategies for larger site development

2010-09-29 Thread felix
Once django projects get large and sites have many features, many models, modules and apps then dev server restart time becomes a huge problem. Compile/Run cycle with C++ or Objective C is significantly faster than just correcting one typo in Django source and trying to get the server to restart.

insert into middle of embedded document?

2010-09-29 Thread Bill Seitz
I'm treating a task hierarchy as a tree. I want to add a subtask to a top-level task. But I don't want to append at the end of the existing list, I want to put it at a specific position in the list. Here's my existing record: > db.master_projects.find() { "_id" :

Re: Sharding Scalability

2010-09-29 Thread Sudhakar
I think the solution is to work with "using" and to call db_for_read router function in that. On Sep 22, 4:06 pm, Sudhakar wrote: > My router.py file is as below:- > > class shard_data: >     id = 0 > > class AppRouter(object): >     """A router to control all

Re: No caching if request.GET not empty

2010-09-29 Thread Thomas Guettler
Hi, there is already a ticket: http://code.djangoproject.com/ticket/4992 Thomas Guettler wrote: > Hi, > > requests with a query string (http://example.com?foo=bar) are not cached in > Django: > > http://code.djangoproject.com/svn/django/trunk/django/middleware/cache.py > {{{ > if not

ERP application on Django

2010-09-29 Thread The invisible man............
hi all, Has anyone come across an ERP application implemented on top of Django-ORM? We are running a metadata framework based erp application (http:// code.google.com/p/wnframework/) and are considering migrating to django. How does the caching and pagination of django scale, when it comes

Re: User.get_profile() not working

2010-09-29 Thread Daniel Roseman
On Sep 29, 4:34 am, Skylar Saveland wrote: > Using *args and **kwargs might work > > then maybe > > self.website = kwargs.get('website', 'default.com') But the point is, there's no need to do that. That is built-in functionality: both the setting of 'website' via

Re: User.get_profile() not working

2010-09-29 Thread adj7388
Still learning. Always learning. I guess I learn best when I break stuff and do dumb things. Thanks to all who replied for the great advice and tips. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

format date in javascript use i18n

2010-09-29 Thread Flytwokites
In i18n javascript_catalog view, there has a get_format() function, but how to format date use these formats? The returned format by get_format() is in php date() style, but no such a js format function can deal with it. -- You received this message because you are subscribed to the Google

Re: .dates() bug or feature?

2010-09-29 Thread dPeS
> Order matters when it comes to annotation.  Read this section very > carefully:http://docs.djangoproject.com/en/dev/topics/db/aggregation/#order-of-... Off course order matters, but in this case annotate adds some extra field to each Rezerwacja object which is irrelevant to dates grouping - the

Re: Fixing Missing Template Error

2010-09-29 Thread octopusgrabbus
Thanks. That worked. On Sep 28, 7:35 pm, octopusgrabbus wrote: > I am getting a Missing Template exception > > Exception Type:         TemplateDoesNotExist > Exception Value: > > registration/login.html > > My urls.py looks like this: > > from django.conf.urls.defaults

Re: What is the correct way to copy an object from one model to a similar model?

2010-09-29 Thread bruno desthuilliers
On 29 sep, 12:31, Steve Holden wrote: > On 9/29/2010 5:25 AM, Daniel Roseman wrote: > > You can use the get_all_field_names method in model._meta to get all > > the actual fields, and set them on the duplicate: > > >     for field in foo._meta.get_all_field_names(): > >    

Re: iPhone talking to Django server (matching session)

2010-09-29 Thread Danny Bos
Thanks Skylar, One more semi-related question for anyone keen, if the iPhone is sending me a cookie with the session id in it, would I get it in a similar way? Eg: session_key = request.COOKIES['session_id'] session = Session.objects.get(session_key=session_key) uid =

Re: Separating application media from project media

2010-09-29 Thread Benedict Verheyen
On 29/09/2010 13:13, David De La Harpe Golden wrote: > On 29/09/10 09:34, Benedict Verheyen wrote: > >> In my template i add this: >> > href="{{MEDIA_URL_CALLTRACKING}}/style/login.css" /> >> > > (I'd favour prefix rather than suffix if you're going to pseudo-namespace) > > Did you introduce

Columns from queryset.extra(...) appears in GROUP BY

2010-09-29 Thread Secator
Hi, i'm trying to aggregate rows using year and month and it's quite challanging in Django. Finally i managed to achive that with a code like that: select_fields = {'year_month':"EXTRACT(YEAR_MONTH FROM `blog_post`.`publication_date`)"} archive =

Re: Checkbox registration from

2010-09-29 Thread craphunter
Sorry! HOW do I implement this in my registration_form.html -- 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

Re: Separating application media from project media

2010-09-29 Thread David De La Harpe Golden
On 29/09/10 09:34, Benedict Verheyen wrote: > In my template i add this: > href="{{MEDIA_URL_CALLTRACKING}}/style/login.css" /> > (I'd favour prefix rather than suffix if you're going to pseudo-namespace) Did you introduce such a MEDIA_URL_CALLTRACKING variable into the template context by any

Checkbox registration from

2010-09-29 Thread craphunter
Hi, I am using this code for registration http://code.google.com/p/django-registration/. It is working fine properly. But I don't get one thing to run. How do I run the checkbox with the term of service. I do I implement this in my registration_form.html? Thanks in advance!!! I appreciate!

Re: What is the correct way to copy an object from one model to a similar model?

2010-09-29 Thread Steve Holden
On 9/29/2010 5:25 AM, Daniel Roseman wrote: > On Sep 29, 6:06 am, Yo-Yo Ma wrote: >> I have two models that are identical in structure except one has 2 >> extra fields. The second one is used for record keeping and is never >> edited by users. The system takes the first

Re: What is the correct way to copy an object from one model to a similar model?

2010-09-29 Thread Daniel Roseman
On Sep 29, 6:06 am, Yo-Yo Ma wrote: > I have two models that are identical in structure except one has 2 > extra fields. The second one is used for record keeping and is never > edited by users. The system takes the first model and copies it to the > second model, adding

Re: What is the correct way to copy an object from one model to a similar model?

2010-09-29 Thread Antoni Aloy
You can use also introspection if the number of attributes is high. http://stackoverflow.com/questions/3818825/python-what-is-the-correct-way-to-copy-an-objects-attributes-over-to-another 2010/9/29 Yo-Yo Ma : > I have two models that are identical in structure except one

Video Chat for Django web application

2010-09-29 Thread Awais Qureshi
hi , I m looking for a video solution which i can integrate in my web application. I have simple requirement where user can do text , video chat with friends. I m looking for a solution which i can integrate with my code. Thanks aq -- You received this message because you are subscribed to

Separating application media from project media

2010-09-29 Thread Benedict Verheyen
Hi, I want to further split my application from the project. I've already put the templates inside the application directory. Now I'm thinking of doing the same with media. I think it's clearer if the media of the application is separate from the project. I'm not sure however if the application

Re: Import Error

2010-09-29 Thread Saad Sharif
Thanks Russell :) Now, no error pops up but when i press the login button the same page reloads..by the way, Django is awesome :) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Import Error

2010-09-29 Thread Russell Keith-Magee
On Wed, Sep 29, 2010 at 2:20 PM, Saad Sharif wrote: > Thanks for your help :) Yup, I already did that, added {% csrf_token %} just > after tag..still the same error comes up :( The error page that comes up comes with a list of three possible sources of error. Have

Re: Import Error

2010-09-29 Thread Saad Sharif
Thanks for your help :) Yup, I already did that, added {% csrf_token %} just after tag..still the same error comes up :( On Wed, Sep 29, 2010 at 11:44 AM, Yo-Yo Ma wrote: > User logs into your site (SaadsDjangoSite.com). User goes to > CriminalCSRFSite.com while

Re: Import Error

2010-09-29 Thread Yo-Yo Ma
User logs into your site (SaadsDjangoSite.com). User goes to CriminalCSRFSite.com while logged into yours. They put a script tag in their page that has a post-back to ttp://saadsdjangosite.com/delete-everything-and-kill-kittens/. This causes the user's logged in browser to make a request to your

Re: IDE for Python/django

2010-09-29 Thread Eric Elinow
While I wouldn't say Pycharm is 'terribly slow' (on my dual-quad xeon Mac Pro w/8 gigs of ram running OSX 10.6.4), I will say that it is noticeably slower than my current Python IDE of choice, Netbeans 6.9.1 which is relatively snappy though YMMV. On 28 Sep, 2010, at 20:46 , pixelcowboy