Re: Generic Relations and Django Admin?

2010-01-18 Thread greatlemer
On Jan 19, 5:25 am, Victor Hooi wrote: > heya, > > I'm trying to use an "Address" model as a generic relation against > multiple other models (e.g. in a "User Profile", for each User, as > well as for "Building", "Institution", and various other ones). > > So I've added the

Re: Generic Relations and Django Admin?

2010-01-18 Thread Raffaele Salmaso
Victor Hooi wrote: > class AddressAdmin(VersionAdmin): > pass > class AddressInline(generic.GenericTabularInline): > model = Address > ... fields = (the fields you want to display) or exclude = ('content_type', 'object_id',) > class HospitalAdmin(admin.ModelAdmin): >

problem with multiple database with django 1.1.1 please help

2010-01-18 Thread chiranjeevi.muttoju
Hi friends, i am working with django1.1.1, now i want to connect django with multiple database, could you people please help me how to achieve this. if possible please send me the sample application using django multiple db.. i tried it by reading some procedure in the net.. but i cont able to

Re: ANN: LFC - a CMS

2010-01-18 Thread Kenneth Gonsalves
On Monday 18 Jan 2010 3:37:08 pm Kai Diefenbach wrote: > I would like to announce the alpha release of LFC - a CMS based on Django: > great - actually I had written a CMS a couple of years ago - but never had time to polish it and release it. Yours seems to have almost exactly done what I had

Generic Relations and Django Admin?

2010-01-18 Thread Victor Hooi
heya, I'm trying to use an "Address" model as a generic relation against multiple other models (e.g. in a "User Profile", for each User, as well as for "Building", "Institution", and various other ones). So I've added the content_type, object_id and content_object fields to Address. class

Re: Efficient access through two manytomany layers

2010-01-18 Thread Alastair Campbell
On Mon, Jan 18, 2010 at 5:25 PM, Alex Robbins wrote: > Hmm, you might also look at just doing something like > Event.objects.values_list > ('classes_involved__parent_disciplines__name', flat=True).distinct(). > That works on some relations, but I haven't tested it in your case. I tried that and a

Re: Entire site requires login

2010-01-18 Thread Shawn Milochik
I did it with middleware. Here's my code. http://pastebin.com/f52e6ef04 Make sure you provide exceptions for the login page, password reset, static content, etc. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

save method manytomany

2010-01-18 Thread Wim Feijen
Hi, Will you help me please? I've got a model called Card which has a ManyToMany relationship to Tag. When I save a Card, I'd like to create a Product as well, which I want to have the same ManyToMany relationship to tag. How do I access the instance's tags? self.tags.all() gives an empty list,

Entire site requires login

2010-01-18 Thread Wiiboy
Hi guys, How would I make it so that every page requires a login? Should I use middleware or something like? -- 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

authentication and an http POST from a java applet

2010-01-18 Thread stephendwolff
I'm having problems authenticating an http POST from a java applet (which is loaded from a fully authenticated django view). Does anyone have any idea how I could share the authentication of the browser user with the applet which is loaded? Am i missing something blindingly obvious here? I am

Re: Splitting tests.py

2010-01-18 Thread Olivier Guilyardi
On 01/18/2010 10:21 PM, Olivier Guilyardi wrote: > On 01/18/2010 10:04 PM, Ramiro Morales wrote: >> On Mon, Jan 18, 2010 at 4:40 PM, Olivier Guilyardi wrote: >>> Hi, >>> >>> I'm trying to split tests.py into individual files into a tests/ subfolder, >>> but >>> that doesn't work.

Re: how to do a form with elements drawn from database (not hard-wired in forms.py)?

2010-01-18 Thread Shawn Milochik
In your form's __init__ function, you can dynamically add items to its self.fields. You can dynamically supply the label value as well, so what is shown on-screen will be properly labeled. So, you'd pull from your database, then create (in code) a field (such as a forms.CharField or

how to do a form with elements drawn from database (not hard-wired in forms.py)?

2010-01-18 Thread dk
I have an application in which I'd like to present a form whose elements are stored in a database. To be specific, the database contains a series of questions that I'd like to ask the user, via radio buttons. I can't do e.g. class thingee(forms.Form): q1 = forms.BooleanField()

Re: Using the form field values in templates

2010-01-18 Thread Shawn Milochik
This is something I've run into as well. If it's a forms.ModelForm, and you instantiated it by passing an instance, you can access it like this: {{ person_form.instance.last_name }} Shawn-- You received this message because you are subscribed to the Google Groups "Django users" group. To post

Admin pages, filtering instance list by instance field value and a newbie (me)

2010-01-18 Thread Massimiliano della Rovere
Greetings, I'm here to seek your help: I'm new to Django (I have experience with Prado and Zope3 though). Here is my problem: I created a model having - among the other ones - a status field (approved, draft, proposed, etc) and a reference to the user that created the instance. I'd like to use

Re: Splitting tests.py

2010-01-18 Thread Olivier Guilyardi
On 01/18/2010 10:04 PM, Ramiro Morales wrote: > On Mon, Jan 18, 2010 at 4:40 PM, Olivier Guilyardi wrote: >> Hi, >> >> I'm trying to split tests.py into individual files into a tests/ subfolder, >> but >> that doesn't work. >> >> I correctly import everything from within

Re: Splitting tests.py

2010-01-18 Thread Olivier Guilyardi
On 01/18/2010 09:58 PM, Shawn Milochik wrote: > On Jan 18, 2010, at 3:50 PM, Olivier Guilyardi wrote: > >> On 01/18/2010 08:59 PM, Shawn Milochik wrote: >>> Here's a fantastic resource. It's what I used to switch to this >>> methodology. It talks you through exactly how to do this. >>> >>>

Re: Splitting tests.py

2010-01-18 Thread Ramiro Morales
On Mon, Jan 18, 2010 at 4:40 PM, Olivier Guilyardi wrote: > Hi, > > I'm trying to split tests.py into individual files into a tests/ subfolder, > but > that doesn't work. > > I correctly import everything from within tests/__init__.py, as previously > said > on this mailing list:

Re: Splitting tests.py

2010-01-18 Thread Shawn Milochik
On Jan 18, 2010, at 3:50 PM, Olivier Guilyardi wrote: > On 01/18/2010 08:59 PM, Shawn Milochik wrote: >> Here's a fantastic resource. It's what I used to switch to this methodology. >> It talks you through exactly how to do this. >> >>

Re: Splitting tests.py

2010-01-18 Thread Olivier Guilyardi
On 01/18/2010 08:59 PM, Shawn Milochik wrote: > Here's a fantastic resource. It's what I used to switch to this methodology. > It talks you through exactly how to do this. > > http://ericholscher.com/blog/2008/nov/4/introduction-pythondjango-testing-basic-unit-tests/ Oh yes, I found this one.

Re: Splitting tests.py

2010-01-18 Thread Olivier Guilyardi
On 01/18/2010 09:19 PM, Reinout van Rees wrote: > On 01/18/2010 08:40 PM, Olivier Guilyardi wrote: >> Hi, >> >> I'm trying to split tests.py into individual files into a tests/ >> subfolder, but >> that doesn't work. >> >> I correctly import everything from within tests/__init__.py, as >>

Re: no attribute 'save_m2m'

2010-01-18 Thread Daniel Roseman
On Jan 18, 7:17 pm, GoSantoni wrote: > I didn't alter the model but the view > > def new(request, form_class=BlogForm, template_name="blog/new.html"): >     if request.method == "POST": >         if request.POST["action"] == "create": >             blog_form =

Re: Splitting tests.py

2010-01-18 Thread Reinout van Rees
On 01/18/2010 08:40 PM, Olivier Guilyardi wrote: Hi, I'm trying to split tests.py into individual files into a tests/ subfolder, but that doesn't work. I correctly import everything from within tests/__init__.py, as previously said on this mailing list:

Re: Splitting tests.py

2010-01-18 Thread Shawn Milochik
Here's a fantastic resource. It's what I used to switch to this methodology. It talks you through exactly how to do this. http://ericholscher.com/blog/2008/nov/4/introduction-pythondjango-testing-basic-unit-tests/ Shawn-- You received this message because you are subscribed to the Google

Splitting tests.py

2010-01-18 Thread Olivier Guilyardi
Hi, I'm trying to split tests.py into individual files into a tests/ subfolder, but that doesn't work. I correctly import everything from within tests/__init__.py, as previously said on this mailing list:

Re: My Own Auth Backend

2010-01-18 Thread Olivier Détour
Thanks for this link, I saw it Saturday. But the problem is the same, I have to login to use template like that: {% if user.is_authenticated %} lol {% else %} not lol {% endif %} and my view.py is somethink like that: username = request.POST['user'] password =

Re: permalinks from cron job

2010-01-18 Thread eric.frederich
I do not understand how this would work. The only place where /apps/ is mentioned is apache's config file. WSGIScriptAlias /apps /export/home/web/docs/django/my_site/apache/ django.wsgi There is nothing in my Django settings about /apps/. Is there a setting that I can put in my Django settings?

Re: no attribute 'save_m2m'

2010-01-18 Thread Bill Freeman
Have you, perhaps, overridden the save() method of your model form, and neglected to capture **kwargs and pass it on to the superclass method? On Mon, Jan 18, 2010 at 1:23 PM, GoSantoni wrote: > Hi Nek4life, > > Unfortunately that didn't work. > > TypeError at /blog/new/

Re: Save inline instances first

2010-01-18 Thread Marco Rogers
I had a need for this at one point because my main model had an overridden save method that would modify the inlines. But it didn't work because the inlines weren't there. I had to reverse the save method and put it on the inline model. But in my case, there was no reason not to do that. :Marco

Re: no attribute 'save_m2m'

2010-01-18 Thread GoSantoni
I didn't alter the model but the view def new(request, form_class=BlogForm, template_name="blog/new.html"): if request.method == "POST": if request.POST["action"] == "create": blog_form = form_class(request.user, request.POST) if blog_form.is_valid():

Re: no attribute 'save_m2m'

2010-01-18 Thread Adam Knight
Ensure it's the save() method on the FORM and not the MODEL. :) On Mon, Jan 18, 2010 at 12:23 PM, GoSantoni wrote: > Hi Nek4life, > > Unfortunately that didn't work. > > TypeError at /blog/new/ > save() got an unexpected keyword argument 'commit' > Request Method: POST >

Re: no attribute 'save_m2m'

2010-01-18 Thread GoSantoni
Hi Nek4life, Unfortunately that didn't work. TypeError at /blog/new/ save() got an unexpected keyword argument 'commit' Request Method: POST Request URL:http://localhost:8000/blog/new/ Exception Type: TypeError Exception Value: save() got an unexpected keyword argument 'commit' On Jan 18,

Re: Newbie question : passing control from one view function to another. I get a function does not return an HttpResponse object error

2010-01-18 Thread harijay
Thanks Karen.. Did not realize that "Running of the end of the code" in python results in returning a None and not the last evaluated expression. I wrote a small test case and realized what you said that without an explicit return , python returns a None even though the evaluated expression

AttributeError: 'module' object has no attribute 'DatabaseError'

2010-01-18 Thread abs
Trying to start dev server of django on mac os x with postresql database. bash-3.2$ ./manage.py runserver Validating models... Unhandled exception in thread started by Traceback (most recent call last): File "/Library/Python/2.6/site-packages/django/core/management/ commands/runserver.py",

Re: Efficient access through two manytomany layers

2010-01-18 Thread Alex Robbins
Probably need to solve the problem individually: First problem: Performance. Have you looked at using select_related[1] in your query? That might speed up the loop since it would do all the lookups in one big query. (It'll need more memory since it is loading it all at once, but it will probably

Re: Project layout: put templates and js/css together?

2010-01-18 Thread Bill Freeman
I suppose that you can do what you want, but in deployment static files like js and css files are usually served by the front end (apache, for example), while, despite the .html, templates are not static files, and should never be served as is, only through the django template engine. It is

Re: Efficient access through two manytomany layers

2010-01-18 Thread Alastair Campbell
On Mon, Jan 18, 2010 at 2:59 PM, Alex Robbins wrote: > Hmm, you posted the save method for your Event model, but not the > definition. I think you haven't gotten any feed back because no one > really knows what you are asking. Could you show the Event model, and >

Re: Should Django handle uploaded files in PUT as well as POST?

2010-01-18 Thread Russell Keith-Magee
On Mon, Jan 18, 2010 at 5:23 PM, Masklinn wrote: > On 18 Jan 2010, at 03:04 , Russell Keith-Magee wrote: >> >> On Mon, Jan 18, 2010 at 8:14 AM, Malcolm Box wrote: >>> On Sat, Jan 16, 2010 at 4:58 AM, Russell Keith-Magee >>>

Re: no attribute 'save_m2m'

2010-01-18 Thread nek4life
On Jan 18, 10:01 am, GoSantoni wrote: > Hi > > Trying to use save_m2m as described > herehttp://docs.djangoproject.com/en/1.0/topics/forms/modelforms/#the-sav... > Though in run into an attrribute error 'Post' object has no attribute > 'save_m2m' > > *** Model *** >

no attribute 'save_m2m'

2010-01-18 Thread GoSantoni
Hi Trying to use save_m2m as described here http://docs.djangoproject.com/en/1.0/topics/forms/modelforms/#the-save-method Though in run into an attrribute error 'Post' object has no attribute 'save_m2m' *** Model *** class Post(models.Model): id =

Re: Efficient access through two manytomany layers

2010-01-18 Thread Alex Robbins
Hmm, you posted the save method for your Event model, but not the definition. I think you haven't gotten any feed back because no one really knows what you are asking. Could you show the Event model, and then show what a finished save should look like? What should the data end up like? Alex On

Re: Admin list_display loop though sub objects and output sum of values - newbie

2010-01-18 Thread Alex Robbins
There is also an online version of one of the django books here: http://djangobook.com/ On Jan 17, 5:08 pm, pfwd wrote: > Thanks fantastic thank you > I was also able to do: > result = obj.task_set.aggregate(Count('id'))['id__count'] > to get the a count of the tasks for

Re: Linked list of abstract objects

2010-01-18 Thread Alex Robbins
Also, I think you'll need to make those relations to a class that isn't abstract. Right now you have a 'class Meta: abstract=True' That means your model doesn't really exist for the relations to link to. Hope that helps, Alex On Jan 18, 2:26 am, Kerrick wrote: > I'm

Re: Save, Signals and Models

2010-01-18 Thread Victor Loureiro Lima
Thanks Eric, that worked like a charm. I've never got to use the update, thus I had no idea of its existence, fair enough that is exactelly what I needed. Thank you very much, and other who have answered this thread. Victor Lima 2010/1/16 Eric Chamberlain > > On Jan 15, 2010, at

Re: Debugging Templates

2010-01-18 Thread diofeher
I think this would help you: http://github.com/robhudson/django-debug-toolbar On 17 jan, 14:51, oakmad wrote: > What is the best way to debug templates when data is not showing? > > Here is my problem. I'm using Google App Engine with app-engine-patch > so I realize it may

Project layout: put templates and js/css together?

2010-01-18 Thread Stephan Walter
Hi, After having Django used a long time ago, I recently started a new project, using "django-admin.py startproject". What I found inconvenient is that in the default project layout, the templates and the static media are so "far away" from each other. What I mean is this: In the default

Re: Linked list of abstract objects

2010-01-18 Thread Gonzalo Delgado
El 18/01/10 05:26, Kerrick escribió: > I'm trying to implement a linked list of abstract objects in my > models.py; however, it is throwing an error. > --activenotes/models.py-- > class Element(models.Model): > class Meta: > abstract = True > prev = models.OneToOneField('Element',

Re: Save inline instances first

2010-01-18 Thread Karen Tracey
On Mon, Jan 18, 2010 at 6:23 AM, Gabriel Reis wrote: > In the ModelAdmin using inline forms I would like to know if it is possible > to save the inline instances first/before saving the instance edited by the > main ModelAdmin form. > Why do you want to? It can't be done

Re: null = True and blank = True in contenttypes generic relations: why not ?

2010-01-18 Thread Karen Tracey
On Mon, Jan 18, 2010 at 3:58 AM, Alessandro Pasotti wrote: > Hello, > > I would like to have a table with optional pointers to other tables > items, generic relations would do it fine, the only problem seems to > be the fact that generic forreign keys don't accept null values.

Re: Newbie question : passing control from one view function to another. I get a function does not return an HttpResponse object error

2010-01-18 Thread Karen Tracey
On Sun, Jan 17, 2010 at 11:47 PM, Benjamin Welton < benjamin.r.wel...@wmich.edu> wrote: > Since the call structure goes similar to this Django Internals -> > view_func1 -> authenticate_user. That return is required so that the Django > internals see the HttpResponse Class. Without this return

Linked list of abstract objects

2010-01-18 Thread Kerrick
I'm trying to implement a linked list of abstract objects in my models.py; however, it is throwing an error. --activenotes/models.py-- class Element(models.Model): class Meta: abstract = True prev = models.OneToOneField('Element', null=True, blank=True) next =

Re: Should Django handle uploaded files in PUT as well as POST?

2010-01-18 Thread Malcolm Box
On Mon, Jan 18, 2010 at 9:23 AM, Masklinn wrote: > On 18 Jan 2010, at 03:04 , Russell Keith-Magee wrote: > > > > On Mon, Jan 18, 2010 at 8:14 AM, Malcolm Box > wrote: > >> On Sat, Jan 16, 2010 at 4:58 AM, Russell Keith-Magee > >> Which raises the

Save inline instances first

2010-01-18 Thread Gabriel Reis
Hi, In the ModelAdmin using inline forms I would like to know if it is possible to save the inline instances first/before saving the instance edited by the main ModelAdmin form. Thanks for your consideration. Kind regards, Gabriel Gabriel de Carvalho Nogueira Reis Software Developer +44 7907

ANN: LFC - a CMS

2010-01-18 Thread Kai Diefenbach
Hi guys, I would like to announce the alpha release of LFC - a CMS based on Django: - http://pypi.python.org/pypi/django-lfc You will also find the installation instruction there. Some documentation can be found here: - http://packages.python.org/django-lfc/general/overview.html Some first

Re: Should Django handle uploaded files in PUT as well as POST?

2010-01-18 Thread Masklinn
On 18 Jan 2010, at 03:04 , Russell Keith-Magee wrote: > > On Mon, Jan 18, 2010 at 8:14 AM, Malcolm Box wrote: >> On Sat, Jan 16, 2010 at 4:58 AM, Russell Keith-Magee >> wrote: >>> >>> On Sat, Jan 16, 2010 at 6:32 AM, Malcolm Box

Re: Send and Receive SMS from a django app

2010-01-18 Thread Alessandro Ronchi
On Sun, Jan 17, 2010 at 7:18 PM, Chris Withers wrote: > Alessandro Ronchi wrote: > >> I cannot use an SMS gateway for my app (I must use a SIM and an hardware >> modem). >> > > Why? This is not a sane requirement for a web app... > > Chris Because of the number of the

Re: Should Django handle uploaded files in PUT as well as POST?

2010-01-18 Thread Malcolm Box
On Mon, Jan 18, 2010 at 2:04 AM, Russell Keith-Magee wrote: > On Mon, Jan 18, 2010 at 8:14 AM, Malcolm Box > wrote: > > On Sat, Jan 16, 2010 at 4:58 AM, Russell Keith-Magee> Which raises the > question of what the correct behaviour should be, so

null = True and blank = True in contenttypes generic relations: why not ?

2010-01-18 Thread Alessandro Pasotti
Hello, I would like to have a table with optional pointers to other tables items, generic relations would do it fine, the only problem seems to be the fact that generic forreign keys don't accept null values. Any hint or idea about why NOT NULL is enforced in this kind of relations ? --

Re: django hosting

2010-01-18 Thread nostradamnit
bells-n-whistles.net appears to be dead, but www.alwaysdata.com is alive and providing excellent hosting, with a free option. On Jan 17, 1:59 pm, alrobeler wrote: > hi i ve heard you can provide with free django >

Re: Admin list_display loop though sub objects and output sum of values - newbie

2010-01-18 Thread nostradamnit
I recommend this book - and the answer to your question is in chapter 8. http://www.amazon.com/Practical-Django-Projects-Pratical/dp/1590599969 go ahead and get this one too http://www.amazon.com/Python-Essential-Reference-David-Beazley/dp/0672329786/ref=pd_sim_b_4 and read

Re: My Own Auth Backend

2010-01-18 Thread nostradamnit
Olivier, Look at this - http://stackoverflow.com/questions/1057149/django-users-and-authentication-from-external-source I imagine your problem comes from the fact that django.contrib.auth User is tied to the DB Sam On Jan 18, 12:09 am, Olivier Détour wrote: > up > >

Re: permalinks from cron job

2010-01-18 Thread Andy McKay
You can set a prefix here: http://code.djangoproject.com/browser/django/trunk/django/core/urlresolvers.py#L364 -- Andy McKay, @clearwind http://clearwind.ca/djangoski -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,