Re: compressing uploaded file

2011-04-20 Thread Daniel Gerzo
On 20.4.2011 2:22, Julio Ona wrote: Hi Daniel, you should see: http://docs.python.org/library/bz2.html#module-bz2 or http://docs.python.org/library/gzip.html#module-gzip Hello Juliom, thanks for reply. I have of course seen both of these be

Bug with ModelForm ?

2011-04-20 Thread sebastien piquemal
Hi ! I have posted this question on SO : http://stackoverflow.com/questions/5718838/django-adding-new-form-fields-dynamically-in-admin As you can see I am not the only one to have this problem. I was wondering, could it be reported as a bug ? Or enhancement proposal ? -- You received this messa

Print a pdf file

2011-04-20 Thread pols
What will i do to print a pdf file in 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 django-users+unsubscr...@googlegroups

Re: A monthly Django session in Leicester with guest speakers on set topics - would this be of interest to you?

2011-04-20 Thread Matt_313
I'm in Birmingham, I would definitely attend. Cheers, Matt. On Apr 18, 3:29 pm, Leon wrote: > We are thinking of organising monthly Django sessions in Leicester > with guest speakers on set topics that would interest fellow > Djangonauts. > > Our plan is to organise a short 2 hour session each m

Print a pdf file

2011-04-20 Thread pols
How can i print a pdf file when i press a button/link in my html template. -- 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-

queries gone wild

2011-04-20 Thread Szabo, Patrick (LNG-VIE)
Hi, For developement i've used sqlite and now i want to transfer to mysql. The transfer itself worked fine but now a couple of queries don't work anymore. Example: Buchung.objects.filter(Mitarbeiter = request.user.id, Datum__startswith=str(tag).split('-')[0]) "tag" looks like 201

Re: Print a pdf file

2011-04-20 Thread Kenneth Gonsalves
On Wed, 2011-04-20 at 01:43 -0700, pols wrote: > What will i do to print a pdf file in django http://docs.djangoproject.com/en/1.3/howto/outputting-pdf/ -- regards KG http://lawgon.livejournal.com Coimbatore LUG rox http://ilugcbe.techstud.org/ -- You received this message because you are subsc

Re: Bug with ModelForm ?

2011-04-20 Thread Oleg Lomaka
When rendering your form in template, fields enumerating from fieldsets variable, not from fields. Sure you can redefine fieldsets in your AdminForm, but then validations will fail as original form class doesn't have such field. One workaround I can propose is to define this field in form definitio

Re: queries gone wild

2011-04-20 Thread Oleg Lomaka
Looks like you store dates as strings in sqlite and as dates in mysql. Try this queryset: Duchung.objeccts.filter(Mitarbeiter=request.user.id, Datum__year=str(tag).split('-')[0]) On Wed, Apr 20, 2011 at 11:51 AM, Szabo, Patrick (LNG-VIE) < patrick.sz...@lexisnexis.at> wrote: > > > For developeme

AW: queries gone wild

2011-04-20 Thread Szabo, Patrick (LNG-VIE)
Thanks, I'll give it a shot ! Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im Auftrag von Oleg Lomaka Gesendet: Mittwoch, 20. April 2011 11:24 An: django-users@googlegroups.com Betreff: Re: queries gone wild Looks like you store dates as strings in sqlite and as

validating file uploads

2011-04-20 Thread Daniel Gerzo
Hello, my form allows file uploads, and obviously I need to validate the received files. In order to validate the files, I need to read them. Is there a way to access request.FILES from form.clean() method? I'd like to detect the invalid files within the form validation, so that I can render

Re: A monthly Django session in Leicester with guest speakers on set topics - would this be of interest to you?

2011-04-20 Thread Cal Leeming [Simplicity Media Ltd]
Hey Leon, I'm on the outskirts of Leicester, and would attend if the numbers were good, and it was on a work friendly day (saturday / friday evening etc etc). Have also done lots of modifications and funky custom stuff in Django, so could be a speaker if needed. Cal On Mon, Apr 18, 2011 at 3:29

Re: A monthly Django session in Leicester with guest speakers on set topics - would this be of interest to you?

2011-04-20 Thread Leon
Brilliant, thanks Cal. Have you got anything I can see? Leon. On Apr 20, 11:02 am, "Cal Leeming [Simplicity Media Ltd]" wrote: > Hey Leon, > > I'm on the outskirts of Leicester, and would attend if the numbers were > good, and it was on a work friendly day (saturday / friday evening etc etc).

Re: A monthly Django session in Leicester with guest speakers on set topics - would this be of interest to you?

2011-04-20 Thread Leon
Super, cheers for replying Matt. Spread the word if you think this would be of interest to anyone you know. We're trying to drum up as much interest as possible now to see if there's enough developers around. On Apr 20, 9:49 am, Matt_313 wrote: > I'm in Birmingham, I would definitely attend. >

Re: validating file uploads

2011-04-20 Thread Daniel Gerzo
On 20.4.2011 11:36, Daniel Gerzo wrote: Is there a way to access request.FILES from form.clean() method? I'd like to detect the invalid files within the form validation, so that I can render the errors should there be some. I guess I have solved it by accessing self.files.values() in the form'

Re: website path

2011-04-20 Thread Ján Vorčák
Hi, Thank you for your answer Here's my httpd.conf SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE settings PythonOption django.root /django-application PythonDebug On PythonPath "['/root/xvorcak_dir/django/mysite/'] +

extend an existing model (not the user profile)

2011-04-20 Thread Simone Orsi
Hi, first of all I'm sorry if this argument has been discussed somewhere but I cannot find any real example except the one for the user profile. I'm trying to extend an existing model adding some fields. It seems there's no "clean way" to this but creating a related model for it (as per the user

Re: A monthly Django session in Leicester with guest speakers on set topics - would this be of interest to you?

2011-04-20 Thread Cal Leeming [Simplicity Media Ltd]
Sadly, I haven't had chance to put all our recent activity into posterous, due to working 16 hours a day (lol). However, here's a list of the things we have successfully done, and plan on writing up full articles about: - Django's get_or_create() is NOT atomic and can cause race conditions,

Re: extend an existing model (not the user profile)

2011-04-20 Thread Daniel Roseman
On Wednesday, April 20, 2011 12:22:15 PM UTC+1, Simone Orsi wrote: > > Hi, > > first of all I'm sorry if this argument has been discussed somewhere but > I cannot find any real example except the one for the user profile. > > I'm trying to extend an existing model adding some fields. > > It seems t

Additional data to user and User admin breaks.

2011-04-20 Thread JDaniel
Hello, I'm new to Django and wonder how to solve this problem. I am trying to add some additional data to the User standard model. I follow the instructions here: http://digitaldreamer.net/blog/2010/12/8/custom-user-profile-and-extend-user-admin-django/ That I believe they're pretty the same as i

Re: extend an existing model (not the user profile)

2011-04-20 Thread Simone Orsi
Hi Daniel, thanks for your answer. On 04/20/2011 02:23 PM, Daniel Roseman wrote: > On Wednesday, April 20, 2011 12:22:15 PM UTC+1, Simone Orsi wrote: > > Hi, > > first of all I'm sorry if this argument has been discussed somewhere but > I cannot find any real example except the one

change the displayed name of the app in the Django admin?

2011-04-20 Thread rahul jain
Can you change the displayed name of the app in the Django admin? for ex: Select "app_name" to change Thanks. Rahul -- 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 unsubsc

Re: change the displayed name of the app in the Django admin?

2011-04-20 Thread David Markey
As i remember the only way is to override the template. On 20 April 2011 15:06, rahul jain wrote: > Can you change the displayed name of the app in the Django admin? > > for ex: Select "app_name" to change > > Thanks. > > Rahul > > -- > You received this message because you are subscribed to the

Custom form field

2011-04-20 Thread Daniel Gagnon
I'm trying to create a custom form field and I'm not succeeding at it so far. I want to create an autocomplete field with jquery. It would be used on models that refer another model via a foreign key where the linked model have an id and a name (unique). I would like to render the name of the link

Re: Failed to build documentation (solved)

2011-04-20 Thread xeelee
You don't have to update python-sphinx package. Use virtualenv instead. $ mkdir my_env $ virtualenv my_env/bin/activate $ easy_install -U Sphinx Then build package. Now you can exit virtual environment. $ deactivate On 24 Mar, 22:37, Łukasz Rekucki wrote: > On 24 March 2011 20:15, Lic. José M

readonly field ordering issue

2011-04-20 Thread Bobby Roberts
hi all... i have certain fields in my model such as this: field1 field2 field3 field4 field5 field6 field7 field8 field9 field10 I have the even fields set to readonly fields. The issue i'm having is that when I go into edit this record in admin, i see the odd numbered fields at the top (which y

Re: Custom form field

2011-04-20 Thread Shawn Milochik
Maybe just save your time and re-use some tasty open-source. Examples: http://code.google.com/p/django-ajax-selects/ http://code.google.com/p/django-autocomplete/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: readonly field ordering issue

2011-04-20 Thread Shawn Milochik
I think you can just specify a 'fields' attribute in your admin model to fix this. It should retain the order in which they're entered. http://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contrib.admin.ModelAdmin.fields -- You received this message because you are subscribed to the Go

Re: Custom form field

2011-04-20 Thread Daniel Gagnon
The first one uses a jquery plugin that's discontinued and the second one works only in the admin. Also, I feel I'm missing something that's not so complex... On Wed, Apr 20, 2011 at 10:48 AM, Shawn Milochik wrote: > Maybe just save your time and re-use some tasty open-source. > > Examples: > >

Re: Custom form field

2011-04-20 Thread Shawn Milochik
http://docs.djangoproject.com/en/1.3/howto/custom-model-fields/ What specific problems/errors are you experiencing? -- 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 unsubscri

Re: readonly field ordering issue

2011-04-20 Thread Bobby Roberts
thanks! That is exactly what i used. would be great if the docs actually said that would solve the issue. On Apr 20, 10:52 am, Shawn Milochik wrote: > I think you can just specify a 'fields' attribute in your admin model > to fix this. It should retain the order in which they're entered. > >

Re: readonly field ordering issue

2011-04-20 Thread Shawn Milochik
On Wed, Apr 20, 2011 at 11:13 AM, Bobby Roberts wrote: > thanks!  That is exactly what i used.  would be great if the docs > actually said that would solve the issue. > You're allowed to open a ticket and submit a patch. ;o) -- You received this message because you are subscribed to the Google

how to call user-defined database functions through the Django query syntax?

2011-04-20 Thread Andrew Dalke
I'm using MySQL and sometimes SQLite as the backend database. Both databases let me add user-defined functions. I've made a set of UDFs specific to my problem domain, which is chemsitry. How do I call them from a database query? Currently I'm using a raw() call, which made for some rather ugly SQL

Re: Custom form field

2011-04-20 Thread Daniel Gagnon
I'm trying to create a Form Field, not a Model Field. The doc about creating a custom one is a tiny paragraph at the end of this page: http://docs.djangoproject.com/en/1.3/ref/forms/fields/ I read the source code of django but I'm having trouble even finding where exactly is the value stored in t

Re: Unidirectional relations

2011-04-20 Thread Ian Clelland
On Tue, Apr 19, 2011 at 7:28 PM, Jacob Kaplan-Moss wrote: > 2011/4/19 Juan Pablo Romero Méndez : > > Is it possible to create unidirectional relations within django's orm? > > > > What I mean is a situation where a parent has a children_set of > > references to children, but the children don't hav

Re: Custom form field

2011-04-20 Thread Daniel Roseman
On Wednesday, April 20, 2011 4:20:04 PM UTC+1, Dan wrote: > > I'm trying to create a Form Field, not a Model Field. > > The doc about creating a custom one is a tiny paragraph at the end of this > page: http://docs.djangoproject.com/en/1.3/ref/forms/fields/ > > I read the source code of django but

Re: how to call user-defined database functions through the Django query syntax?

2011-04-20 Thread Ian Clelland
On Wed, Apr 20, 2011 at 8:18 AM, Andrew Dalke wrote: > I'm using MySQL and sometimes SQLite as the backend database. Both > databases let me add user-defined functions. I've made a set of UDFs > specific to my problem domain, which is chemsitry. > > How do I call them from a database query? Curre

Re: Debugging a unittest

2011-04-20 Thread Ian Clelland
On Tue, Apr 19, 2011 at 3:44 PM, Thomas Weholt wrote: > I'm wondering if anybody has a hint on how to debug a unittest, or any > other piece of code in django, for that matter, using a debugger like > winpdb? > I'm trying to to a winpdb manage.py test photo, which runs my unittest > for my photo a

Re: Custom form field

2011-04-20 Thread Daniel Gagnon
So far, I have the following code: from django.forms.widgets import TextInput from django.forms.fields import Field class AutoCompleteWidget(TextInput): def render(self, name, value, attrs=None): if hasattr(value, 'name'): v = value.name else: v = Non

Re: compressing uploaded file

2011-04-20 Thread Ian Clelland
On Wed, Apr 20, 2011 at 1:02 AM, Daniel Gerzo wrote: > On 20.4.2011 2:22, Julio Ona wrote: > >> Hi Daniel, >> >> you should see: >> http://docs.python.org/library/bz2.html#module-bz2 >> >> or >> http://docs.python.org/library/gzip.html#module-gz

Re: Custom form field

2011-04-20 Thread DrBloodmoney
On Wed, Apr 20, 2011 at 11:48 AM, Daniel Gagnon wrote: > So far, I have the following code: > from django.forms.widgets import TextInput > from django.forms.fields import Field > class AutoCompleteWidget(TextInput): >     def render(self, name, value, attrs=None): >         if hasattr(value, 'name

Re: Custom form field

2011-04-20 Thread Daniel Gagnon
Thanks It still doesn't work though. I found out through logging that value that is receive is an int (the id) instead of being the object itself. How can I make my widget pass the object itself to the widget instead of passing object.id ? On Wed, Apr 20, 2011 at 12:17 PM, DrBloodmoney wrote: >

Re: Custom form field

2011-04-20 Thread DrBloodmoney
On Wed, Apr 20, 2011 at 12:30 PM, Daniel Gagnon wrote: > Thanks > It still doesn't work though. I found out through logging that value that is > receive is an int (the id) instead of being the object itself. How can I > make my widget pass the object itself to the widget instead of passing > objec

Re: Custom form field

2011-04-20 Thread Daniel Gagnon
Sure, here's a minimal version of them (I skipped fields that aren't too relevant to the problem at hand because there's many, including tons of foreign keys): class Target(Model): name = CharField("Target Name", max_length=255, unique=True) created = DateTimeField(auto_now_add=True, edita

Re: website path

2011-04-20 Thread Jacob Kaplan-Moss
2011/4/20 Ján Vorčák : >    PythonHandler django.core.handlers.modpython You really, really, really should upgrade to mod_wsgi. mod_python is a dead project, and support for it be removed from Django in the future. More importantly, you're not going to find a whole lot of people who can help you

Re: Admin: Model ordering and relationship conditional __unicode__ return values?

2011-04-20 Thread Micky Hulse
Hello, On Tue, Apr 19, 2011 at 1:28 PM, Micky Hulse wrote: > 1. > Is it possible to order the models of my app manually (vs. > alphabetically) when viewing the app page? > 2. > Relationship models: How can I return different __unicode__ values > based on the relationship that I am viewing. I thi

Re: Custom form field

2011-04-20 Thread DrBloodmoney
On Wed, Apr 20, 2011 at 12:45 PM, Daniel Gagnon wrote: > Sure, here's a minimal version of them (I skipped fields that aren't too > relevant to the problem at hand because there's many, including tons of > foreign keys): > class Target(Model): >     name = CharField("Target Name", max_length=255,

Re: Custom form field

2011-04-20 Thread Daniel Gagnon
New code: from django.forms.widgets import Select from django.forms.models import ModelChoiceField from Server_Automation.target_mgmt.models import Target class AutoCompleteWidget(Select): def render(self, name, value, attrs=None, choices=()): logger.debug(value) # Logs 1 (the i

Re: Custom form field

2011-04-20 Thread Daniel Gagnon
> > > It probably is related to the this being a foreign key field and in > order for it to produce a valid object instance from the Target model, > it needs a queryset. Try to subclass from ModelChoiceField[1] and see > if that works. > > [1] > http://code.djangoproject.com/browser/django/trunk/dj

i18n strategy/experiences

2011-04-20 Thread Jjdelc
Are there any best practices or experiences dealing with internationalized sites? Most importantly with URL structure and crawling effects (The DB i18n is not an issue at the moment). In some sites I've worked I've added a switch language button which changes the language but the URLs remain the s

What happens to DB data when I change my models?

2011-04-20 Thread Dug_the_Math_Guy
Hi I'm new to Django, I've read the tutorial and some more. I've been writing some models and trying to get them to work. I've noticed that when I change my models, it changes the SQL tables under the covers but it tries to preserve data that I've put into my DB through the admin or through python

Re: What happens to DB data when I change my models?

2011-04-20 Thread Shawn Milochik
Django has nothing built in at this time to handle data migrations. You need to use South (or manual SQL commands) to do this. http://south.aeracode.org/ When you make changes to your model, doing syncdb again will _not_ change the database. Depending on the changes made it's possible you could g

Re: how to call user-defined database functions through the Django query syntax?

2011-04-20 Thread Andrew Dalke
Hi Ian, On Apr 20, 5:33 pm, Ian Clelland wrote: > It sounds like you could do this with a QuerySet.extra() call > (http://docs.djangoproject.com/en/1.3/ref/models/querysets/#extra) > > You could do something like: > myModel.objects.filter(title__icontains="test").extra( > where='oe_matches(str

Re: compressing uploaded file

2011-04-20 Thread Daniel Gerzo
On 20.4.2011 17:56, Ian Clelland wrote: Well, an InMemoryUploadedFile isn't a real file, so I'm not surprised that that doesn't work. You'll have to pull the data out of it, and compress that. Try something like this: def handle_uploaded_subtitles(self, files): for uploaded_file in files:

How to build a social network

2011-04-20 Thread Rodrigo Ruiz
Hi, I'm a new programmer and I want to make a social network like facebook or orkut. I only know the basics of C and a bit of Objective-C (OOP). I know nothing about web programming. My question is, where should I start learning how to make my social network with python (django)? Any particular b

Re: How to build a social network

2011-04-20 Thread Matías Aguirre
Excerpts from Rodrigo Ruiz's message of Wed Apr 20 20:23:37 -0300 2011: > Hi, I'm a new programmer and I want to make a social network like > facebook or orkut. Hi Rodrigo, > I only know the basics of C and a bit of Objective-C (OOP). I know > nothing about web programming. I hope you don't do

Re: How to build a social network

2011-04-20 Thread Ruturaj Dhekane
Hi Rodrigo, I feel Social network is a hype term that has come into picture in recent few years. However such instances already existed many many years back. Social Network is a word of two parts, Social - which needs users/people and their interactions with the system, and the word Network- which

Re: How to build a social network

2011-04-20 Thread Rodrigo Ruiz
Can I learn how to make a socicial network website like facebook just with those Django tutorials? On Wed, Apr 20, 2011 at 9:02 PM, Ruturaj Dhekane wrote: > Hi Rodrigo, > > I feel Social network is a hype term that has come into picture in recent > few years. However such instances already existe

Re: How to build a social network

2011-04-20 Thread Rodrigo Ruiz
Another thing I still haven't decided is between python with Django or ruby on rails. I know it's a Django group, so I know i must expect the good aspects on Django, but why should I use Django instead of ruby on rails? I don't know any, so I can't defend any, but one thing I had trouble with pyth

Re: how to call user-defined database functions through the Django query syntax?

2011-04-20 Thread Riccardo Vianello
Hi Andrew, On Wed, Apr 20, 2011 at 5:18 PM, Andrew Dalke wrote: > I'm using MySQL and sometimes SQLite as the backend database. Both > databases let me add user-defined functions. I've made a set of UDFs > specific to my problem domain, which is chemsitry. > > How do I call them from a database q

Re: How to build a social network

2011-04-20 Thread George Silva
Your question is sorta of naive. With Django or Ruby you can build any kind of websites. Your software must provide it to be "a social network". First of all, as others recommended, learn webprogramming. CSS, HTML are a must. Now for the "social" aspect of the thing, it will depend on your modelli

Banners managment

2011-04-20 Thread Alex s
Hi people Have anyone some experience to explain about use a django app for Banners managment ? Thanks Alex -- 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

Re: How to build a social network

2011-04-20 Thread Kenny Meyer
On Wed, Apr 20, 2011 at 8:09 PM, Rodrigo Ruiz wrote: > Another thing I still haven't decided is between python with Django or ruby > on rails. > I know it's a Django group, so I know i must expect the good aspects on > Django, but why should I use Django instead of ruby on rails? I think you will

Re: How to build a social network

2011-04-20 Thread Rodrigo Ruiz
What about things like being able to make a profire and show user content on your website (like a social network does), or making groups that people can sign up and that others can see? Aren't does things specifically to social network? It probably is a naive question, but i thought making a social

Re: How to build a social network

2011-04-20 Thread Rodrigo Ruiz
I get what you mean, problem is i searched google a lot, and no clear answer on what is the best. But that is not the most important, I can always try both, the biggest problem is that I couldn't find any easy book or tutorial or anything complete for python with django. All I found were pieces in

Re: How to build a social network

2011-04-20 Thread Dug_the_Math_Guy
Hi Rodrigo, I'm new to Django too. I started with the tutorial, then bought a book called "Practical Django Projects 2nd edition" Its probably a comfortable level for someone who knows some programming, and it shows how to write some basic Django apps and includes a few chapters about a social code

Re: How to build a social network

2011-04-20 Thread Rodrigo Ruiz
Thank you very much, haven't looked up on your links yet, but it was very enlightening. On Thu, Apr 21, 2011 at 12:06 AM, Dug_the_Math_Guy wrote: > Hi Rodrigo, > I'm new to Django too. I started with the tutorial, then bought a book > called "Practical Django Projects 2nd edition" > Its probably

Re: How to build a social network

2011-04-20 Thread Dug_the_Math_Guy
Rodrigo, here is a page with some free python learning material. http://www.onlinecomputerbooks.com/free-python-books.php The first one "Dive into Python" is a classic I think It may be good since you have some c & OOP background If you look on the left you'll see some other categories of free mate

Re: How to build a social network

2011-04-20 Thread Kenneth Gonsalves
On Thu, 2011-04-21 at 00:02 -0300, Rodrigo Ruiz wrote: > What about things like being able to make a profire and show user > content on > your website (like a social network does), or making groups that > people can > sign up and that others can see? Aren't does things specifically to > social > ne

Re: how to call user-defined database functions through the Django query syntax?

2011-04-20 Thread Andrew Dalke
Hi Riccardo, > I recently put some spare time on the same problem, trying to extend > the django database API to support the management of chemical > information. Sweet! I must say that I looked at the code with some dismay. Not because of the code, but because it looks like it's a *lot* of work

Re: how to call user-defined database functions through the Django query syntax?

2011-04-20 Thread Riccardo Vianello
Hi Andrew, On Thu, Apr 21, 2011 at 7:59 AM, Andrew Dalke wrote: > I must say that I looked at the code with some dismay. Not because of > the code, but because it looks like it's a *lot* of work to handle > UDFs. I had hoped it would be much easier. I'm sure the code could be simplified and poli