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, 11:18 am, Andy Dustman wro

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 users+pr

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 pm, werefr0g  wrote:

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 entire

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. Sh

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 is actually utf-8 e

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 check these (except the

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 form doesn't have a valu

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: 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 the

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 ema

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 encode > by os module.

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 to

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: li

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: > request.GET.get('subtopic') is returning a string,

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 pe

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 l

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 users

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 automatic

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: 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 all > > > the actual fields, and set them on the dup

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: > dojoType="dijit.form.Form" >{% csrf_token %} >

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 = request.GET.get('subtopic',

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 least two years ahead,

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 "/usr/local

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 where

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?" http://p

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 wrote: > It sounds

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 unsubsc

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 a

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 tried

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 t

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&feel. This means that for two projects (sites) re-using the

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: http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#if-

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" : ObjectId("4ca1397c06391121743320

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 database operations on models in >  

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 t

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 keyword, and the default, which c

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 django-us

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 Groups

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 import * > from django.cont

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(): > >         setattr(spam, get

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 = session.get_decoded().get('

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 suc

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 = Post.active_objects.extra(select=select_fields).va

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 django-users+unsubscr

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! crap

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 model and copies it to the

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 some extra meta informatio

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 has 2 > extra fields. The

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 the

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