Re: wondering how to do something similar to save_model for inline.

2009-01-07 Thread Timboy
Good call on the ModelAdmin spot. (user contacted me by email to see if I had a solution yet.) I got the formset.save() from here: http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-save-method saying: "If your formset contains a ManyToManyField, you'll also need to call formset.sa

Re: autodiscover not being called? why?

2009-01-07 Thread Valts Mazurs
Check the output of: import sys print sys.modules['admin'] -- Valts On Tue, Jan 6, 2009 at 20:06, bongo wrote: > > > > In your application directory, the one created by manage.py startapp, > same > > as where models.py is. > > Thanks. > > Thats what I thought I should put it. This is getting

Re: Import models from CSV files?

2009-01-07 Thread Valts Mazurs
Hello, If the file handling job is not too hard I would put the functionality in model. Actually it depends on complexity, use cases and taste. You can try writing the sample code by yourself :) -- Valts On Wed, Jan 7, 2009 at 02:55, Victor Hooi wrote: > > heya, > > Valts, thanks for the reply

Re: strip_tags in django admin issues

2009-01-07 Thread ChrisL
Alex - you are a legend. That's functioning perfectly. I've moved the import line to the start of the file, but other than that used your code and it's working a treat. Thanks for the swift help Alex, and also Karen: together you've clarified Django very clearly for me. On Jan 6, 6:01 pm, "Alex

Re: Access records from two tables

2009-01-07 Thread bruno desthuilliers
On 7 jan, 08:02, Praveen wrote: > Models.py > > class Listing(models.Model): > name = models.CharField(max_length=20) > description = models.TextField(max_length = 100) > website = models.URLField() > category = models.ForeignKey(Category) > > class Category(models.Model): > category_co

Re: Newbie: Help to understand string handling

2009-01-07 Thread bruno desthuilliers
On 6 jan, 22:46, phoebebright wrote: > Thanks for your response. Do you think a working knowledge of python > is essential for django then? Obviously, yes !-) That's just like asking if a working knowledge of Java is essential for Strut, or if a working knowledge of PHP is essential for the Zen

Re: Newbie: Help to understand string handling

2009-01-07 Thread bruno desthuilliers
On 7 jan, 00:03, phoebebright wrote: > Thanks for that clarification. I am finding that a lot of assumptions > are made in the documentation about previous knowledge. Indeed. It is assumed that the reader knows at least a couple things about the web, programming, HTML, and the HTTP protocol !-)

Re: How to populate a form field with a Select widget

2009-01-07 Thread phoebebright
Finally got it working - and I'm sure there is a much clear way of doing it... used_fuels= Car.objects.all().values('fuel_type').distinct() fuel_choices=[('Any','Any Fuel')] for f in used_fuels: for key,value in f.items(): fuel_choices.append((value,value))

Re: ManyToMany problem

2009-01-07 Thread mksoft
Hi Alex, On Jan 4, 12:27 pm, knight wrote: > Hi, > > I have the following problem: > I have models.py with the following class: > > class Section(Feed): >     parent = models.ManyToManyField('self', blank=True, null=True) >     depth = models.IntegerField(editable=False) >     def save(self): >

Django internal tests and url reverse lookup

2009-01-07 Thread aeby
Hi all, If I run manage.py test form my project, Django internal test are executed as well. If such a internal test uses a RequestContext, all template context processors defined in settings.TEMPLATE_CONTEXT_PROCESSORS are loaded by django.template.context.get_standard_processors(). If one of th

Re: Your IDE of choice

2009-01-07 Thread Oscar Carlsson
Have you been able to make omnicomplete work with Django? I haven't been able to figure it out myself, and gave up after a few tries. It would be really sweet to have, since vim otherwise is a really good editor. Oscar On Wed, Jan 07, 2009 at 12:15:22PM +1930, Santiago wrote: > > i recently swi

Re: How to populate a form field with a Select widget

2009-01-07 Thread bruno desthuilliers
On 7 jan, 11:38, phoebebright wrote: > Finally got it working - and I'm sure there is a much clear way of > doing it... > > used_fuels= Car.objects.all().values('fuel_type').distinct() > fuel_choices=[('Any','Any Fuel')] > for f in used_fuels: > for key,value in f.items(): >

Re: Shouldn't blank=True imply null=True?

2009-01-07 Thread tofergus
On 07.01-09:47, Malcolm Tredinnick wrote: [ ... ] > This thread is about whether blank=True, null=False (the fourth > possibility) ever makes sense for non-text fields. answer is yes for any field type that accepts an empty string as having a meaning. i currently use this for a couple of custom

Re: Import models from CSV files?

2009-01-07 Thread tofergus
On 06.01-16:55, Victor Hooi wrote: [ ... ] > Valts, thanks for the reply - that looks interesting, and is similar > in some ways to what I want - definitely going to check out the code. > Basically, I just wanted a simple file-upload form, for the user to > upload the two .CSV files. Then, there's

Drop down list not seeing newly added record

2009-01-07 Thread jeffhg58
I have a 2 forms. One to add a new author and then another form for Articles which has a drop down list to reference the authors. The behavior I am seeing is that when I add a new author and then go to the New Article form which references the author it does not display the new record. Also, I put

Re: How to populate a form field with a Select widget

2009-01-07 Thread phoebebright
Ahh yes, much more elegant. Thanks. On Jan 7, 11:32 am, bruno desthuilliers wrote: > On 7 jan, 11:38, phoebebright wrote: > > > Finally got it working - and I'm sure there is a much clear way of > > doing it... > > >     used_fuels= Car.objects.all().values('fuel_type').distinct() > >     fuel

Re: Your IDE of choice

2009-01-07 Thread Adam Stein
I have omnicomplete working (haven't used it too much yet). I have this in my $HOME/.vimrc file: --.vimrc-- if has("autocmd") autocmd BufRead *.py set smartindent \ cinwords=if,elif,else,for,while,try,except,finally,def,class autocmd FileType python set omnifunc=pythoncomplete#C

Process file after upload

2009-01-07 Thread dmishe
Hey. I have FielField in my model for user to upload ZIP-archives. I want to unpack that zip, place some files in some dirs and delete it just after user uploaded it in admin. How can i do this? Model's save won't work because it gets called everytime model is saved regardless of were the file u

Re: Process file after upload

2009-01-07 Thread Brian Neal
On Jan 7, 7:32 am, dmishe wrote: > Hey. > > I have FielField in my model for user to upload ZIP-archives. I want > to unpack that zip, place some files in some dirs and delete it just > after user uploaded it in admin. > > How can i do this? Model's save won't work because it gets called > everyt

I just tried GEdit and failed

2009-01-07 Thread Alex
I just tried GEdit on the basis of this thread to replace a very good but slow Komodo. GEdit is not good, or should I say, the plugins that let it be a python dev environment are not good. Perhaps I've selected and incompatible set of plugins, because they started off working somewhat decently,

Re: Process file after upload

2009-01-07 Thread Eric Abrahamsen
On Jan 7, 2009, at 9:32 PM, dmishe wrote: > > Hey. > > I have FielField in my model for user to upload ZIP-archives. I want > to unpack that zip, place some files in some dirs and delete it just > after user uploaded it in admin. > > How can i do this? Model's save won't work because it gets cal

Re: I just tried GEdit and failed

2009-01-07 Thread alex.gay...@gmail.com
Right now I use Gedit as my text editor(I don't use the terminal plugin, I just keep a seperate terminal up), that being said here are the plugins I use: * class browser * code comment * file browser pane * indent lines * Python indentation * smart spaces * snippets depending on what you

Problems with locale of dates queryset

2009-01-07 Thread Stefan Tunsch
Hi! I'm trying to display a list of possible months in a queryset. I do so like this: premonths = MyModel.objects.dates('date_published', 'month') months = [m.strftime('%B') for m in premonths] The problem is that months get displayed in english instead of spanish, which is what I want. I ha

lighttpd + django on windows

2009-01-07 Thread Eric Simorre
Does anybody know a tutorial about deploying django with lighttpd on windows ? it does not work , and I don't find what to do Thanks, Eric --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To pos

Re: Your IDE of choice

2009-01-07 Thread Bernard
this add-on does it : http://community.activestate.com/xpi/morekomodo On Jan 6, 3:19 pm, "Vitaly Babiy" wrote: > Bernard does komodo have a open files function (open file in project based > on file name search) like there is text mate or gedit with plugin > (gedit-openfiles). > > Vitaly Babiy >

Re: Import models from CSV files?

2009-01-07 Thread Keyton Weissinger
Hey Victor, I did the django-batchimport mentioned earlier. I think it will address your need but is definitely aimed at XLS. However, it does already handle duplicates (it will either update them or ignore them based on setting). You can also specify a subset of model fields to use to determine

Re: Your IDE of choice

2009-01-07 Thread don ilicis
2009/1/7 Kenneth Gonsalves > > On Tuesday 06 Jan 2009 5:18:57 pm HB wrote: > > What is your favorite IDE for coding Django projects? > > geany > > -- > regards > KG > http://lawgon.livejournal.com > > > > me too and also gedit / vim --~--~-~--~~~---~--~~ You recei

Re: Django: creating formset is very slow

2009-01-07 Thread Kottiyath
Hi, I was able to solve it. The issue was not with formsets, nor database. It was slow because request.POST was getting delayed - ranging from 3.5 seconds to 3+ minutes. I even tried having an assignment as follows: x = request.POST and even that was taking 3seconds to 3 minutes.

Re: Drop down list not seeing newly added record

2009-01-07 Thread Karen Tracey
On Wed, Jan 7, 2009 at 7:47 AM, jeffhg58 wrote: > > I have a 2 forms. One to add a new author and then another form for > Articles which has a drop down list to reference the authors. The > behavior I am seeing is that when I add a new author and then go to > the New Article form which references

Specified key was too long; max key length is 767 bytes

2009-01-07 Thread Rama
i have a model as below (please follow the red color lines) class NewsEntry(models.Model) : url = models.URLField(max_length=1024,db_index=True) title = models.CharField(max_length=1024) - thereafter i ran python manage.py syncdb i am getting the following err

Re: Shouldn't blank=True imply null=True?

2009-01-07 Thread varikin
On Jan 7, 5:51 am, tofer...@gmail.com wrote: > On 07.01-09:47, Malcolm Tredinnick wrote: > [ ... ] > > > This thread is about whether blank=True, null=False (the fourth > > possibility) ever makes sense for non-text fields. > > answer is yes for any field type that accepts an empty string as hav

Using a model method in ModelAdmin fieldsets

2009-01-07 Thread EagerToUnderstand
I am referencing a self defined model method in list_display option of ModelAdmin. I would like to do the same in the fiedsets option of ModelAdmin, but I get an error saying my method is missing from the form when the page is rendered. It seems to me I can only render model methods with list_di

Re: Drop down list not seeing newly added record

2009-01-07 Thread Daniel Roseman
On Jan 7, 7:47 am, jeffhg58 wrote: > I have a 2 forms. One to add a new author and then another form for > Articles which has a drop down list to reference the authors. The > behavior I am seeing is that when I add a new author and then go to > the New Article form which references the author it

Re: Using a model method in ModelAdmin fieldsets

2009-01-07 Thread Daniel Roseman
On Jan 7, 10:35 am, EagerToUnderstand wrote: > I am referencing a self defined model method in list_display option of > ModelAdmin. I would like to do the same in the fiedsets option of > ModelAdmin, but I get an error saying my method is missing from the > form when the page is rendered. It se

Re: Shouldn't blank=True imply null=True?

2009-01-07 Thread Jeff Anderson
varikin wrote: > I agree with this. I use null=False, blank=True for some ImageFields > and integers. I'm interested in how a blank integer looks in a MySQL database. Can you provide an example? signature.asc Description: OpenPGP digital signature

Re: lighttpd + django on windows

2009-01-07 Thread Jeff Anderson
Eric Simorre wrote: > it does not work , and I don't find what to do > Well, there's your problem. You should just make it work. :) signature.asc Description: OpenPGP digital signature

Re: Drop down list not seeing newly added record

2009-01-07 Thread jeffhg58
Thanks for your feedback. I will implement the changes that were suggested. -- Original message -- From: Daniel Roseman > > On Jan 7, 7:47 am, jeffhg58 wrote: > > I have a 2 forms. One to add a new author and then another form for > > Articles which has a drop d

Adding link to Django book Search code

2009-01-07 Thread Bob
Hello, I would like to change the view so that the link retrieves more of the detailed information from the same model publication, but I haven't figured out how to change the view to respond either to a new search and/or to more detailed information about the item found. The link can go to a ne

Re: Using a model method in ModelAdmin fieldsets

2009-01-07 Thread EagerToUnderstand
What I try to achieve: I have a couple of model methods that exposes real time information. (Retrieved when method is called.) This is information I want to display not only in the list_display, but also within the change view. (Where the fieldsets come into play). Since the list_display option

Upcoming on-line Spanish translation sprint: Friday, Jan. 9, 2009

2009-01-07 Thread A Melé
>From Friday, Jan. 9 to Sunday, Jan. 11, 2009 the Spanish Django community is going to hold an on-line translation sprint. The main purpose of this sprint is to translate the most important parts of the Django documentation into Spanish. After that the Spanish documentation will be available in th

Re: Shouldn't blank=True imply null=True?

2009-01-07 Thread Karen Tracey
On Wed, Jan 7, 2009 at 10:51 AM, Jeff Anderson wrote: > varikin wrote: > > I agree with this. I use null=False, blank=True for some ImageFields > > and integers. > I'm interested in how a blank integer looks in a MySQL database. Can you > provide an example? > > I believe the further description a

Re: lighttpd + django on windows

2009-01-07 Thread Karen Tracey
On Wed, Jan 7, 2009 at 9:54 AM, Eric Simorre wrote: > > Does anybody know a tutorial about deploying django with lighttpd on > windows ? > > it does not work , and I don't find what to do > If nobody responds with a pointer to a tutorial, you might want to provide a few more details on what exac

Re: Using a model method in ModelAdmin fieldsets

2009-01-07 Thread Karen Tracey
On Wed, Jan 7, 2009 at 11:45 AM, EagerToUnderstand wrote: > > What I try to achieve: > I have a couple of model methods that exposes real time information. > (Retrieved when method is called.) This is information I want to > display not only in the list_display, but also within the change view. >

Re: Your IDE of choice

2009-01-07 Thread Cowmix
Add to your list: * native 'scp'/'ftp' ability * Cross platform (Linux, MAC, WIN32) Bernard wrote: > I use Komodo IDE 5 everyday for every Python/Django/PHP/Drupal > projects at work and damn it works well. > > What I love about it: > > * Key bindings(shortcuts) for almost everything > * Simpl

How to impose a permission-based filter in admin?

2009-01-07 Thread ZebZiggle
Hi, I have two Model classes: class Opportunity(models.Model): rep = models.ForeignKey(User) ... class Deal(models.Model): opportunity = models.ForeignKey(Opportunity) ... I want to limit the admin UI so that users can only see Opportunities and the related Deals they own. If they a

Re: Using a model method in ModelAdmin fieldsets

2009-01-07 Thread EagerToUnderstand
Thanks Karen & Daniel, I think your overiding approach will work. Thank you. Implemented a work around. I added extra fields (that persist my method information) to my model that I update and save when I do a listing. Price I pay is an extra database update each time the model is getting list

subquery has too many columns

2009-01-07 Thread timc3
I updated my django version to revision 9710 today and now I am getting the following error message on screen: Caught an exception while rendering: subquery has too many columns This is the traceback: Original Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versi

Re: Shouldn't blank=True imply null=True?

2009-01-07 Thread Jeff Anderson
Karen Tracey wrote: > On Wed, Jan 7, 2009 at 10:51 AM, Jeff Anderson > wrote: > > >> varikin wrote: >> >>> I agree with this. I use null=False, blank=True for some ImageFields >>> and integers. >>> >> I'm interested in how a blank integer looks in a MySQL database. Can you >> provid

Re: subquery has too many columns

2009-01-07 Thread Alex Koshelev
And what is `groupadmins`? On Wed, Jan 7, 2009 at 8:36 PM, timc3 wrote: > > I updated my django version to revision 9710 today and now I am > getting the following error message on screen: > > Caught an exception while rendering: subquery has too many columns > > This is the traceback: > > Orig

Re: Your IDE of choice

2009-01-07 Thread Oscar Carlsson
Sweet! I've been looking (and I'm pretty sure it's not only me who's been looking) for some good tutorial on how to do this. Luckily I use OS X at home, which probably means that I can use this without any modification... :-D Thank you very much! Oscar On Wed, Jan 07, 2009 at 01:06:43PM +

Customizing form fields display

2009-01-07 Thread sagi s
Can anyone suggest a way to customize model field display? For example if I have a model called Course with fields n_girls and n_students, if for a particular record n_girls = 4 and n_students = 10, I want to display for n_girls: "40% (4)" instead of just "4". Obviously I can do this in the tem

Re: Your IDE of choice

2009-01-07 Thread Adam Stein
Glad it was of use. Except for the script which I wrote myself, all the information came from either the following page or a link from that page: http://code.djangoproject.com/wiki/UsingVimWithDjango On Wed, 2009-01-07 at 19:32 +0100, Oscar Carlsson wrote: > Sweet! > > I've been looking (and I

Re: Shouldn't blank=True imply null=True?

2009-01-07 Thread Karen Tracey
On Wed, Jan 7, 2009 at 12:48 PM, Jeff Anderson wrote: > Karen Tracey wrote: > > On Wed, Jan 7, 2009 at 10:51 AM, Jeff Anderson >wrote: > > > > > >> varikin wrote: > >> > >>> I agree with this. I use null=False, blank=True for some ImageFields > >>> and integers. > >>> > >> I'm interested in how a

Re: lighttpd + django on windows

2009-01-07 Thread Eric Simorre
In fact, I think that the chapter describing the fastcgi deployment in the django doc is a little ... light :-) it gives only a description of a typical django.fcgi, and that's all. I have already deployed django sites with the following configs: - fastcgi ona hosting platform - apache/mod_pyt

"submit" and urls.py fail after moving site from runserver to Apache

2009-01-07 Thread rabbi
Hi, I followed the django tutorial and got my site running on runserver + sqlite3 with no problems I then moved the site onto apache + mod_python and (after receiving some help from this group) managed to get the same site semi-running The admin page, home page, and a few others are working as t

Using cache_page decorator with callable cllasses

2009-01-07 Thread Elton Okada
Hello, I wish to use a callable class to anwser this URL: urlpatterns = patterns('voduBBB.servicos.views', (r'^participantes/$', ParticipanteView()), ) It is OK. Now I wish to cache the result of ParticipanteView() using this decorator: @cache_page(60) at the __call__ method of this class.

Re: Shouldn't blank=True imply null=True?

2009-01-07 Thread tofergus
On 07.01-08:51, Jeff Anderson wrote: > > I agree with this. I use null=False, blank=True for some ImageFields > > and integers. > I'm interested in how a blank integer looks in a MySQL database. Can you > provide an example? please troll somewhere else. --~--~-~--~~~-

Re: Traceback in the ``runserver`` console

2009-01-07 Thread Fridrik Mar Jonsson
Hi Russ, As I thank you for your quick reply I apologise for my lack thereof. These approaches seem well suited (and surprisingly clean) for achieving the desired functionality. I think it will make sense to suggest an improvement to the `--traceback` switch, perhaps making a patch if I have a

Re: Shouldn't blank=True imply null=True?

2009-01-07 Thread Jeff Anderson
tofer...@gmail.com wrote: > On 07.01-08:51, Jeff Anderson wrote: > >>> I agree with this. I use null=False, blank=True for some ImageFields >>> and integers. >>> >> I'm interested in how a blank integer looks in a MySQL database. Can you >> provide an example? >> > > please troll som

Revise "search code" in Django Book

2009-01-07 Thread Bob
Hello, I am using the search code from the Django Book to search a publication table (model). The results are placed on the search.html page. I want to drill down and send more detail from the link that now surrounds each of the search results. I would like that detail information to go to ano

Re: Shouldn't blank=True imply null=True?

2009-01-07 Thread Lee Braiden
On Wed, 2009-01-07 at 13:40 -0700, Jeff Anderson wrote: > tofer...@gmail.com wrote: > > ...I was genuinely interested in how this would look. One thing worth bearing in mind is that Django supports different database backends. Potentially, or ideally, it might even support non-SQL databases, lik

Re: Using cache_page decorator with callable cllasses

2009-01-07 Thread bruno desthuilliers
On 7 jan, 20:13, "Elton Okada" wrote: > Hello, I wish to use a callable class to anwser this URL: > > urlpatterns = patterns('voduBBB.servicos.views', > (r'^participantes/$', ParticipanteView()), > ) > > It is OK. > > Now I wish to cache the result of ParticipanteView() using this > decorator

Re: Your IDE of choice

2009-01-07 Thread joeygartin
Textmate with Python/Django bundles is very visually nice, but without code completion (and a few other tools) is just a pretty screen. Eclipse/PyDev would be nice, but it does seem to have a lot of little issues that are annoying. I have used IntelliJ for Java (and a couple of Rails projects) fo

Display of foreignkey relations

2009-01-07 Thread Patricia P.
Hello everybody, I need your help. I have the following data model: class Contract (models.Model): : class Project (models.Model): :: contract= models.ForeignKey( "Contract") and would need to modify the administration interface that automatically generates Django, in order to view in e

Re: Shouldn't blank=True imply null=True?

2009-01-07 Thread tofergus
On 07.01-13:40, Jeff Anderson wrote: [ ... ] > > please troll somewhere else. > > > I wasn't trolling, thank you. I was genuinely interested in how this > would look. my apologies, i mis-read your terse questioning. a 'blank' value is essentially undefined in database terms and may be interpr

Re: How to impose a permission-based filter in admin?

2009-01-07 Thread ZebZiggle
Upon further research ... I'm suspecting I need to create a Manager and override get_query_set(), but since I don't have a request object, I can't get the currently logged in user. Is there a recommended approach to this for the dev stream? -Z --~--~-~--~~~---~--~

Returning large files from a view

2009-01-07 Thread David Lindquist
I would like to return a binary file from a view, and so far I have something like this: def my_file(request): file_data = open("/path/to/file", "rb").read() response = HttpResponse(file_data, mimetype="application/ whatever") response['Content-Disposition'] = 'attachment; file

Re: Redirect parent from within iframe without losing session

2009-01-07 Thread bradders
I am getting a very similar problem when simply going between views (all within the same domain), so it may be nothing to do with iframes. I have put in a trace and can see that in some cases you enter the view with all session variables set and when the session is next saved all the variables hav

Re: Returning large files from a view

2009-01-07 Thread bruno desthuilliers
On 7 jan, 23:37, David Lindquist wrote: > I would like to return a binary file from a view, and so far I have > something like this: > > def my_file(request): > file_data = open("/path/to/file", "rb").read() > response = HttpResponse(file_data, mimetype="application/ > whatever") >

Re: How to impose a permission-based filter in admin?

2009-01-07 Thread Karen Tracey
On Wed, Jan 7, 2009 at 12:30 PM, ZebZiggle wrote: > > Hi, > > I have two Model classes: > > class Opportunity(models.Model): >rep = models.ForeignKey(User) > ... > > class Deal(models.Model): >opportunity = models.ForeignKey(Opportunity) > ... > > > I want to limit the admin UI so that

Re: Returning large files from a view

2009-01-07 Thread David Lindquist
On Jan 7, 2009, at 4:15 PM, bruno desthuilliers wrote: > > On 7 jan, 23:37, David Lindquist wrote: >> I would like to return a binary file from a view, and so far I have >> something like this: >> >> def my_file(request): >> file_data = open("/path/to/file", "rb").read() >> response =

Re: How to impose a permission-based filter in admin?

2009-01-07 Thread ZebZiggle
Karen officially rocks. Thanks! --~--~-~--~~~---~--~~ 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

Re: Returning large files from a view

2009-01-07 Thread bruno desthuilliers
On 8 jan, 00:15, bruno desthuilliers wrote: > On 7 jan, 23:37, David Lindquist wrote: > > > I would like to return a binary file from a view, and so far I have > > something like this: > > > def my_file(request): > > file_data = open("/path/to/file", "rb").read() > > response = Http

Re: How to impose a permission-based filter in admin?

2009-01-07 Thread ZebZiggle
Wow ... that article is so good, it needs to be part of the standard Django docs. --~--~-~--~~~---~--~~ 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.co

Shouldn't get_profile() create the profile object?

2009-01-07 Thread Alvaro Mouriño
I find myself checking for the existence of the profile object for the user everytime I call the get_profile function or making sure that it gets created with every user. Is there a reason for this? Shouldn't the framework assure me that I will get a profile whenever I call get_profile()? Even if

Re: Import models from CSV files?

2009-01-07 Thread Victor Hooi
heya, The sample code request was just me being lazy =). Hmm, so you think the csv parsing code should be in the upload processing? This would just be a form with two boxes for the user to select the .csv files, and an upload button. Better putting it here than in the model? In terms of processi

NewBie Question about ForeignKey relationships

2009-01-07 Thread Mark Jones
Ok, here is some simple code: class Maker(models.Model): name = CharField(max_length=20) class Auto(models.Model): name = CharField(max_length) maker = ForeignKey(Maker) maker = Maker.objects.get(pk=1) How do I get all the Autos made by this maker I don't see a maker.autos (rails

Re: NewBie Question about ForeignKey relationships

2009-01-07 Thread Karen Tracey
On Wed, Jan 7, 2009 at 8:26 PM, Mark Jones wrote: > > Ok, here is some simple code: > > class Maker(models.Model): >name = CharField(max_length=20) > > class Auto(models.Model): >name = CharField(max_length) >maker = ForeignKey(Maker) > > > maker = Maker.objects.get(pk=1) > > How do I

Re: Specified key was too long; max key length is 767 bytes

2009-01-07 Thread Malcolm Tredinnick
On Wed, 2009-01-07 at 20:49 +0530, Rama wrote: > i have a model as below (please follow the red color lines) > > class NewsEntry(models.Model) : > url = models.URLField(max_length=1024,db_index=True) > title = models.CharField(max_length=1024) > > - > thereafter i ran

Re: what type of data structure should I use?

2009-01-07 Thread Ozan Onay
There's no need to keep selecting from the DB and refreshing the page. You can re-sort the list client-side on AJAX response (with jQuery, for instance). The tablesorter plugin (http://tablesorter.com/docs/) is not exactly what you're looking for but will give you an idea of how to sort client-sid

Re: subquery has too many columns

2009-01-07 Thread Malcolm Tredinnick
On Wed, 2009-01-07 at 09:36 -0800, timc3 wrote: [...] > ProgrammingError: subquery has too many columns > > > It seems that this query is creating the problem: > > groupmembers = requestedgroup.group_members.exclude > (id__in=groupadmins) We'll need a bit more information here, since the devil

Re: Customizing form fields display

2009-01-07 Thread Malcolm Tredinnick
On Wed, 2009-01-07 at 10:38 -0800, sagi s wrote: > Can anyone suggest a way to customize model field display? Use auxillary functions. Model fields carry no implicit "display" concept with them, since they represent the data object, separate from the presentation. > > For example if I have a mo

Re: "submit" and urls.py fail after moving site from runserver to Apache

2009-01-07 Thread Malcolm Tredinnick
On Wed, 2009-01-07 at 11:12 -0800, rabbi wrote: [...] > I have a submit input on one of my pages and when I run the site on > runserver it still works fine (I just tried it now) > However, when I run the exact same site on Apache the url that is > returned by "submit" is different, and this obvi

Re: Shouldn't blank=True imply null=True?

2009-01-07 Thread Malcolm Tredinnick
On Wed, 2009-01-07 at 21:46 +, tofer...@gmail.com wrote: > On 07.01-13:40, Jeff Anderson wrote: > [ ... ] > > > please troll somewhere else. > > > > > I wasn't trolling, thank you. I was genuinely interested in how this > > would look. > > my apologies, i mis-read your terse questioning. >

Re: Returning large files from a view

2009-01-07 Thread Graham Dumpleton
Ultimately what they really need is: View-03 wsgi.file_wrapper for large file serving from: http://code.djangoproject.com/wiki/Version1.1Features At least then it will be optimal for WSGI case. Graham On Jan 8, 10:42 am, bruno desthuilliers wrote: > On 8 jan, 00:15, bruno desthuil

Re: could not import settings error, FastCGI

2009-01-07 Thread Malcolm Tredinnick
On Tue, 2009-01-06 at 19:40 -0800, Bradley wrote: > I'm having a strange problem in that I can make any change that I want > to the .fcgi file, short of deleting it and I get the same django > error about seymourherald.settings not found. I can delete the entire > contents of the file so all it h

Re: could not import settings error, FastCGI

2009-01-07 Thread Bradley Proctor
Malcolm Tredinnick wrote: > On Tue, 2009-01-06 at 19:40 -0800, Bradley wrote: > >> I'm having a strange problem in that I can make any change that I want >> to the .fcgi file, short of deleting it and I get the same django >> error about seymourherald.settings not found. I can delete the entir

Re: Shouldn't get_profile() create the profile object?

2009-01-07 Thread Malcolm Tredinnick
On Wed, 2009-01-07 at 22:50 -0200, Alvaro Mouriño wrote: > I find myself checking for the existence of the profile object for the > user everytime I call the get_profile function or making sure that it > gets created with every user. > > Is there a reason for this? Shouldn't the framework assure

Re: what type of data structure should I use?

2009-01-07 Thread backdoc
Thanks for the link. I like that. I'm going to see if I can use it. I'd like to be able to do one query, then bring it into this plugin, sort it 3 or 4 different ways on the client side. I haven't really had any time today to look at it. But, I also thought about trying some kind of session ob

Re: Your IDE of choice

2009-01-07 Thread Vitaly Babiy
Hey for gedit you should try my plug in http://github.com/vbabiy/gedit-openfiles/tree/master Vitaly Babiy On Wed, Jan 7, 2009 at 10:08 AM, don ilicis wrote: > > > 2009/1/7 Kenneth Gonsalves > >> >> On Tuesday 06 Jan 2009 5:18:57 pm HB wrote: >> > What is your favorite IDE for coding Django pro

Re: NewBie Question about ForeignKey relationships

2009-01-07 Thread Mark Jones
Thanks for the pointer, I had read all around that. The short version is: maker.auto_set.all() There was was Dry(er) more elegant method to be found. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Module Title

2009-01-07 Thread Eric I.E.
I am trying to change the title of a module in the admin. I just need to change the displayed name, easy enough for a field or a model but I have not been able to figure out how to do it for an entire module. Any pointers would be greatly appreciated. --~--~-~--~~~---~

Re: Module Title

2009-01-07 Thread Malcolm Tredinnick
On Wed, 2009-01-07 at 20:34 -0800, Eric I.E. wrote: > I am trying to change the title of a module in the admin. I just need > to change the displayed name, easy enough for a field or a model but I > have not been able to figure out how to do it for an entire module. > Any pointers would be greatly

Admin | Lookup via foreign key | Expected Behavior or Bug?

2009-01-07 Thread Glen Jarvis
I'm not certain if this is a bug, or expected behavior. It certainly looks like a Django bug to me. However, after looking at the same database for hours on end, it could simply be a cross-eyed user error.In sort, the admin interface has the following search fields (I know this won't scale very wel

Setting Bound Fields Programmatically

2009-01-07 Thread Keyton Weissinger
I have a form with the following fields (all required): - first_name - last_name - site_id I'd like to use a template to display only the FIRST two items to the user for him to fill out: {{ form.first_name }} {{ form.last_name }} Then when it gets posted back to me I'd like to set the site

Re: Setting Bound Fields Programmatically

2009-01-07 Thread Karen Tracey
On Thu, Jan 8, 2009 at 12:28 AM, Keyton Weissinger wrote: > > I have a form with the following fields (all required): > - first_name > - last_name > - site_id > > I'd like to use a template to display only the FIRST two items to the > user for him to fill out: > > > {{ form.first_name }} > {{ f

Re: Setting Bound Fields Programmatically

2009-01-07 Thread Malcolm Tredinnick
On Wed, 2009-01-07 at 21:28 -0800, Keyton Weissinger wrote: > I have a form with the following fields (all required): > - first_name > - last_name > - site_id > > I'd like to use a template to display only the FIRST two items to the > user for him to fill out: > > > {{ form.first_name }} > {{

Django too slow

2009-01-07 Thread Vicky
I using the django to generate xml and to fetch datas from database. When i run it the response is too slow. it takes nearly 4sec to load the page. So what can i do to make my program more efficient. Plse tell me some things to avoid so that it becomes faster --~--~-~--~~~-

Re: Django too slow

2009-01-07 Thread David Zhou
On Thu, Jan 8, 2009 at 1:04 AM, Vicky wrote: > > I using the django to generate xml and to fetch datas from database. > When i run it the response is too slow. it takes nearly 4sec to load > the page. So what can i do to make my program more efficient. Plse > tell me some things to avoid so that

Re: Admin | Lookup via foreign key | Expected Behavior or Bug?

2009-01-07 Thread Karen Tracey
On Thu, Jan 8, 2009 at 12:28 AM, Glen Jarvis wrote: > I'm not certain if this is a bug, or expected behavior. It certainly looks > like a Django bug to me. However, after looking at the same database for > hours on end, it could simply be a cross-eyed user error. > > In sort, the admin interface

  1   2   >