DRY forms

2010-10-19 Thread simonty
Hello, I have a database table with about 100 fields. I have a number of forms with only a few fields in each form based on the fields in the table. If I create one massive django model to represent the table and a number of modelforms based on the django model, this becomes inefficent because eve

Re: rake routes

2010-10-19 Thread Phlip
> 2. Add 'django.contrib.admindocs' to your INSTALLED_APPS. Tx! But I will rip the innards of that out, because I'm targeting the test side (as usual!), and because we have no admin yet... -- You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: rake routes

2010-10-19 Thread James Bennett
On Tue, Oct 19, 2010 at 8:20 PM, Phlip wrote: > A web platform which I will refer to as "Rails" lets you print out all > the equivalents of the matchers and modules in the tree of urls.py > files using "rake routes". One easy way: 1. Install docutils. 2. Add 'django.contrib.admindocs' to your IN

rake routes

2010-10-19 Thread Phlip
A web platform which I will refer to as "Rails" lets you print out all the equivalents of the matchers and modules in the tree of urls.py files using "rake routes". Does Django have such a command? Or how could one be written? -- Phlip http://bit.ly/ZeekLand -- You received this message bec

change the default widget to a field in a modelform

2010-10-19 Thread refreegrata
Hello list. I have a model with a ManyToMany field. For example: -- class Table(models.Model): myField = models.ManyToManyField(OtherTable) -- The modelForm

Re: Directions on How To Help?

2010-10-19 Thread Łukasz Rekucki
On 19 October 2010 23:50, OldTroll wrote: > I spotted a couple of errors in documentation and after a quick scan > on the docs website I haven't spotted a clear way to help.  I can find > directions on helping with code, but I'm not certain if that applies. > Can anyone point me in the right direc

Re: jsi18n date and time formating

2010-10-19 Thread timc3
For example: formats['DATETIME_FORMAT'] = 'N j, Y, P'; On Oct 17, 10:13 pm, timc3 wrote: > I am using jsi18n for trying to internationalize some Javascript and > its work fine. > > But I am wondering how to translate the datetime format used (based on > PHP's date) to a format that Javascript ca

Re: "No module named copycompat" error

2010-10-19 Thread timc3
>From a python prompt can you do: from django.utils import copycompat If not, Django might not be imported properly. Also check your PYTHONPATH. On Oct 18, 10:57 pm, mathphreak wrote: > I just upgraded my computer to Ubuntu 10.10, and now running "python > manage.py runserver" gives me "Error:

Re: Newbie question: How should I structure my very simple project / app?

2010-10-19 Thread timc3
Take a look at: http://lincolnloop.com/django-best-practices/projects/layout.html After you have done the tutorials and stuff. Tim. -- 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

Re: Passing file to .net web service

2010-10-19 Thread timc3
Well are you doing that in a page request? Is it timing out? Also if you are doing this with large files its going to eat memory and processing power like you couldn't believe. I would hand this off to another service or daemon, or in my case Celery to do the work. On Oct 19, 10:58 am, Pradnya w

Directions on How To Help?

2010-10-19 Thread OldTroll
I spotted a couple of errors in documentation and after a quick scan on the docs website I haven't spotted a clear way to help. I can find directions on helping with code, but I'm not certain if that applies. Can anyone point me in the right direction? Thanks -- You received this message becaus

serving SOAP service with soaplib, consuming with suds

2010-10-19 Thread Ricko
Hi all, I am trying to make a SOAP service in Django via soaplib(1.0.0 - beta 8) and consume the same service for testing purposes with SUDS (0.4). I can consume external SOAP services with SUDS no problem, but am running into problems when trying to consume my own service. My service is as foll

Re: Expense of django query

2010-10-19 Thread Javier Guerra Giraldez
On Tue, Oct 19, 2010 at 3:46 PM, Ed wrote: > I have 3 tables: studio, film, images.  If film has a foreign key to > studio, and images has a foreign key to film.  If I wanted to pull all > of the images for a particular studio, it would be more expensive to > pull: what i do is: in the view, get

Export current filtered view in contrib.admin

2010-10-19 Thread Russ B.
I'm in the processes of customizing the contrib.admin module to add a few reporting features that we need, specifically the ability to dump the current filtered view to some other format, say CSV. I found a post on django-snippets (http://djangosnippets.org/snippets/ 1792/) that seems like it shou

Re: Expense of django query

2010-10-19 Thread Ed
Thanks for the answers. I thought that the view was already pulling the data. I didn't realize it gets pulled when called in the template. I was able to rewrite the view to provide the data more efficiently. I have another related question on the topic of query expense. What is the best practi

Re: login_required and new class based views

2010-10-19 Thread Valentin Golev
Thank you, I didn't know that! -- Best Regards, Valentin Golev Lead Developer r00, http://r00.ru http://valyagolev.net +7 921 789 0895, avaiable 12:00-18:00 MSK 2010/10/19 Łukasz Rekucki : > On 19 October 2010 21:21, Valentin Golev wrote: >> Thank you! >> >> Does python's super really works t

Re: Expense of django query

2010-10-19 Thread Daniel Roseman
On Oct 19, 4:43 pm, Tom Evans wrote: > On Tue, Oct 19, 2010 at 4:16 PM, Daniel Roseman wrote: > > The solution here is to evaluate the queryset in your view first, > > before passing it to the template. You can do this by simply calling > > list() on it - eg instead of defining your context as {'

Re: login_required and new class based views

2010-10-19 Thread Łukasz Rekucki
On 19 October 2010 21:21, Valentin Golev wrote: > Thank you! > > Does python's super really works the way like in the last option? Yes, it should call dispatch() from the next class in MRO. So if you place it at the start, like this: class MyView(LoginRequiredMixin, TemplateView): pass It sho

Re: MultiFileInput widget

2010-10-19 Thread alecx
Okay, I am answering myself. Maybe this info helps someone else. I created a fileupload model with foreignkey relation. # models.py class Item(models.Model): serialnr = models.CharField(max_length=5, blank=True) class Fileupload(models.Model): item = models.ForeignKey(

Re: login_required and new class based views

2010-10-19 Thread Valentin Golev
Thank you! Does python's super really works the way like in the last option? -- Best Regards, Valentin Golev Lead Developer r00, http://r00.ru http://valyagolev.net +7 921 789 0895, avaiable 12:00-18:00 MSK 2010/10/19 Łukasz Rekucki : > On 19 October 2010 19:06, Valentin Golev wrote: >> Hell

Re: login_required and new class based views

2010-10-19 Thread Łukasz Rekucki
On 19 October 2010 19:06, Valentin Golev wrote: > Hello, > > I'm trying to start using new class based views from the trunk. > > I need to rewrite a view which is decorated > django.contrib.auth.decorators.login_required. > > How should I go with that? There are couple of options. 1) decorate the

django-adminfiles and sorl-thumbnail

2010-10-19 Thread Dominic Osterried
Hi, I'm trying to install django-adminfiles and therefore I have to install sorl-thumbnails, too. When I now try to create or change am Entry in the admin the adminfiles-widget doesn't render, but just gets me an error-message saying that 'thumbnail' is an invalid block tag. The same happens, when

login_required and new class based views

2010-10-19 Thread Valentin Golev
Hello, I'm trying to start using new class based views from the trunk. I need to rewrite a view which is decorated django.contrib.auth.decorators.login_required. How should I go with that? I was going to write something like LoginRequiredMixin, but I have no idea how to do this. I need to run m

customizing inherited field attributes

2010-10-19 Thread pixelcowboy
Hi, I have the need for the following inheritance customization: class abstract(models.Model): field=models.Charfield() class Meta: abstract=True class A(abstract): I want the field 'field' to be required here. class B(abstract):

Re: Comments and cascade delete

2010-10-19 Thread David De La Harpe Golden
On 19/10/10 17:16, shacker wrote: > If Django comments are attached to a record (like a news item) and > that item is deleted, the comment remains in the database. In other > words, comments don't get cascade delete treatment like foreign key > relationships do. The django comments contrib uses t

Re: Comments and cascade delete

2010-10-19 Thread Shawn Milochik
One possibility is to add a post-delete signal which listens for instances of news items and uses the content type to clean up comments with that content type and primary key. I'm pretty sure this isn't considered a bug, but I couldn't address the issue of whether it was a planned part of the desi

Re: Different logins in same browser session and login_required

2010-10-19 Thread David De La Harpe Golden
On 19/10/10 17:03, Bill Freeman wrote: > This is a limitation of the browser. It does not keep separate credentials > for separate windows. This is usually desirable because you may choose > to open a link in a new window (or tab) and you still expect to be logged in. > IE8 (and probably other

Re: Newbie question: How should I structure my very simple project / app?

2010-10-19 Thread Mike Seidle
Waza - Django should be ideal for your project. It should be a snap once you figure out how Django's put together. *Skip Do as others have suggested and do the tutorial. It will help you better understand MVC. * Skip the AJAX stuff unitl you have the above figured out. The magic ponies some

Re: Session issues in Internet Explorer

2010-10-19 Thread Daniel Roseman
On Oct 19, 3:13 pm, Quiet Light Development wrote: > Hello, > > I am having trouble getting sessions to work with my production > server. When I move from one page to the next and try to call > request.session["app"] it is giving me a key error even though I know > I had set it in the previous pag

Comments and cascade delete

2010-10-19 Thread shacker
If Django comments are attached to a record (like a news item) and that item is deleted, the comment remains in the database. In other words, comments don't get cascade delete treatment like foreign key relationships do. This leads to A) database clutter and B) breakage when you do things like loop

Re: Different logins in same browser session and login_required

2010-10-19 Thread Bill Freeman
This is a limitation of the browser. It does not keep separate credentials for separate windows. This is usually desirable because you may choose to open a link in a new window (or tab) and you still expect to be logged in. The only solution I know is to run separate browsers. You can install,

Re: Session issues in Internet Explorer

2010-10-19 Thread Jonathan Barratt
On 19 ?.?. 2010, at 22:25, Tom Evans wrote: The server is running Apache 2.2.12 on Ubuntu. >>> >>> You are running in a threaded environment then, your sessions can't persist >>> without cookies or equivalent external storage because the HTTP exchange is >>> not all contained within the s

Re: Expense of django query

2010-10-19 Thread Tom Evans
On Tue, Oct 19, 2010 at 4:16 PM, Daniel Roseman wrote: > The solution here is to evaluate the queryset in your view first, > before passing it to the template. You can do this by simply calling > list() on it - eg instead of defining your context as {'actor_list': > actor_list}, do {'actor_list':

Re: Newbie question: How should I structure my very simple project / app?

2010-10-19 Thread wawa wawawa
Hi Javier, Many thanks for your comments. On 19 October 2010 15:57, Javier Guerra Giraldez wrote: > first and foremost, yes, you have to read the manual, and do the > tutorial. ideally, you should forget about your specific project > while doing it. it's not too long, should take a few hours

Re: Session issues in Internet Explorer

2010-10-19 Thread Tom Evans
2010/10/19 Jonathan Barratt : > > On 19 ต.ค. 2010, at 21:49, Jonathan Barratt wrote: > >> >> On 19 ต.ค. 2010, at 21:32, Quiet Light Development wrote: >> >>> Thank you Masklinn and Jonathan for your responses. I don't know a lot >>> about the physical set-up of the system, I can ask the server >>>

Re: Expense of django query

2010-10-19 Thread Daniel Roseman
On Oct 19, 3:45 pm, Ed wrote: > I have a table for Actor that I query and populate the result in > actor_list to pass to the template. I installed the Django Debug > Toolbar to check the queries hitting the database and found some > strange behavior. If I iterate through the actor_list, only one S

Re: Expense of django query

2010-10-19 Thread Javier Guerra Giraldez
On Tue, Oct 19, 2010 at 9:45 AM, Ed wrote: > Why is that?  Is there a way to do this that doesn't result in two > queries? check: http://docs.djangoproject.com/en/1.2/topics/db/optimization/#don-t-overuse-count-and-exists there's a tip about loading the whole query once: use {% with actor_list

Re: Session issues in Internet Explorer

2010-10-19 Thread Jonathan Barratt
Ben, Yes, that is definitely going to be the quickest way to resolve your issue, and I see no reason not to use them - Django hashes the data in them so it's safe from casual prying... Hth, Jonathan ? 19 ?.?. 2553 21:54 Ben Luedtke ?: > Thanks Jonathan, > > Either way though, the s

Different logins in same browser session and login_required

2010-10-19 Thread PyMan
Hi guys, I need some help about logins and session and any help would be much appreciated :) This is the scenario: * Django 1.2.0 * Firefox (but I think any browser too) This the steps: 1) In the same computer (so in the same browser session) I have two browser windows "W1" and "W2" where the use

Re: Session issues in Internet Explorer

2010-10-19 Thread Ben Luedtke
Thanks Jonathan, Either way though, the solution is to set the cookie to allow the session to persist correct? Thanks, Ben On Oct 19, 9:51 am, Jonathan Barratt wrote: > On 19 ต.ค. 2010, at 21:49, Jonathan Barratt wrote: > > You are running in a threaded environment then, your sessions can't pe

Re: Session issues in Internet Explorer

2010-10-19 Thread Jonathan Barratt
On 19 ?.?. 2010, at 21:49, Jonathan Barratt wrote: > > On 19 ?.?. 2010, at 21:32, Quiet Light Development wrote: > >> Thank you Masklinn and Jonathan for your responses. I don't know a lot >> about the physical set-up of the system, I can ask the server >> administrators that question. >> >> T

Re: Session issues in Internet Explorer

2010-10-19 Thread Jonathan Barratt
On 19 ต.ค. 2010, at 21:32, Quiet Light Development wrote: > Thank you Masklinn and Jonathan for your responses. I don't know a lot > about the physical set-up of the system, I can ask the server > administrators that question. > > The server is running Apache 2.2.12 on Ubuntu. You are running i

Expense of django query

2010-10-19 Thread Ed
I have a table for Actor that I query and populate the result in actor_list to pass to the template. I installed the Django Debug Toolbar to check the queries hitting the database and found some strange behavior. If I iterate through the actor_list, only one SQL query is created, as expected: {% f

Re: HTTP load testing tools?

2010-10-19 Thread Paul Winkler
On Oct 13, 10:27 am, Paul Winkler wrote: > On Oct 13, 4:17 am, Chris Withers wrote: > > > Hey all, > > > I hope this is still on topic, but what tool sets do people around here > > use for doingloadtestingof Django projects? > > Same stuff as for any web project.  Last time I needed something mor

Re: Session issues in Internet Explorer

2010-10-19 Thread Quiet Light Development
Thank you Masklinn and Jonathan for your responses. I don't know a lot about the physical set-up of the system, I can ask the server administrators that question. The server is running Apache 2.2.12 on Ubuntu. Thanks, Ben On Oct 19, 9:20?am, Jonathan Barratt wrote: > ?On 19 ?.?. 2010, at 21:13,

Re: How django admin knows about related objects on delete?

2010-10-19 Thread Marc Aymerich
On Tue, Oct 19, 2010 at 4:03 PM, Shawn Milochik wrote: > Check out your model's _meta.get_all_related_objects(). > > Explore that through the interactive interpreter and you'll find > everything you need. > Shawn, _meta.get_all_related_objects() is great :) Thank you very much for sharing this !

Re: Session issues in Internet Explorer

2010-10-19 Thread Jonathan Barratt
On 19 ต.ค. 2010, at 21:13, Quiet Light Development wrote: > Hello, > > I am having trouble getting sessions to work with my production > server. When I move from one page to the next and try to call > request.session["app"] it is giving me a key error even though I know > I had set it in the pre

Re: Session issues in Internet Explorer

2010-10-19 Thread Masklinn
On 2010-10-19, at 16:13 , Quiet Light Development wrote: > I'm not using cookies at all presently, but trying to track sessions > through the database. This is only the server-side storage of the session, you still need a way to match a given client and its session, and that's generally done via a

Session issues in Internet Explorer

2010-10-19 Thread Quiet Light Development
Hello, I am having trouble getting sessions to work with my production server. When I move from one page to the next and try to call request.session["app"] it is giving me a key error even though I know I had set it in the previous page. This error is only occurring in IE. Firefox and Chrome work

Re: How django admin knows about related objects on delete?

2010-10-19 Thread Shawn Milochik
Check out your model's _meta.get_all_related_objects(). Explore that through the interactive interpreter and you'll find everything you need. Shawn -- 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.

Re: Newbie question: How should I structure my very simple project / app?

2010-10-19 Thread Javier Guerra Giraldez
On Tue, Oct 19, 2010 at 6:52 AM, wawa wawawa wrote: > So, given this paucity of requirements and the horrendously unclear > explanation above, what suggestions might you lot have? (Apart from "RTFM", > of course!) first and foremost, yes, you have to read the manual, and do the tutorial. ideally

Re: multiple views function in a single URL specification

2010-10-19 Thread garagefan
seems like you're over thinking... you want a single url to handle multiple pieces of information? you can assign a single view function to a url. but you can define multiple functions within that view and merely pass them through to the template as part of the response. Or take a look at templat

Newbie question: How should I structure my very simple project / app?

2010-10-19 Thread wawa wawawa
Hi All, I'm new to Django (and to be honest, a little bit hazy on the subtleties of MVC, but if you don't try, you don't learn). I want to create a simple web frontend for a Python program I have already (mostly) written and I'd like to use Django (which may be overkill... not sure). - Users hav

Re: django-ckeditor causes an unhandled exception

2010-10-19 Thread jean polo
replying to myself... this was fixed 5 days ago on github. updating to latest django-ckeditor solved it. _y On Oct 19, 12:49 pm, jean polo wrote: > hallo ! > > I installed django-ckeditor-0.0.7, run it smoothly locally but now I'm > trying to commit the changes on my server, I get an Unhandled

django-ckeditor causes an unhandled exception

2010-10-19 Thread jean polo
hallo ! I installed django-ckeditor-0.0.7, run it smoothly locally but now I'm trying to commit the changes on my server, I get an Unhandled Exception: [SNIP] File "/usr/local/alwaysdata/python/django/1.2.1/django/core/ urlresolvers.py", line 247, in _get_url_patterns raise ImproperlyConfigu

Re: XMPP based apps

2010-10-19 Thread acellam guy
thats good work eric On Tue, Oct 19, 2010 at 2:32 AM, Eric Chamberlain wrote: > We've done django based xmpp services and created middleware to enable > django to manage and authenticate ejabberd users. > > On Oct 18, 2010, at 6:10 AM, Venkatraman S wrote: > > Well, I havent Googled, but was won

How django admin knows about related objects on delete?

2010-10-19 Thread Marc Aymerich
Hi! When we delete an object through admin bulk deletion, django deletes all related objects too. Now imagine that we have these models: class ModelBase(models.Model): pass class ModelA(models.Model): base = models.ForeignKey(ModelBase) class ModelB(models.Model): base = models.ForeignK

Re: Path issue on Linux

2010-10-19 Thread Sithembewena Lloyd Dube
Thanks Ken. On Mon, Oct 18, 2010 at 2:44 PM, Kenneth Gonsalves wrote: > On Mon, 2010-10-18 at 14:34 +0200, Sithembewena Lloyd Dube wrote: > > Just manage.py , instead of always having to specify the > > program to > > run the command with (python). > > anyway you got the answer - chmod > -- > reg

Passing file to .net web service

2010-10-19 Thread Pradnya
Hello I am using Django 1.1 and Python 2.6 I want to pass file ot file byte array to a web serrvice which is written in .net, so I am using import urllib2 import urllib2_file data = [ ('fileName' , 'test.txt'), ('file', open'/tmp/test.text', 'r') ] data=urllib.urlencode(data) req=urllib2.Reques