Community Wiki/CMS app

2011-09-27 Thread Thomas Guettler
Hi, a group of intelligent, but non computer-nerd people, asked me for help. They want to build a community page: - simple homepage/wiki - news - members with login - mailing list I develop with django daily. Since I don't want to reinvent the wheel, I search django app which can handle mos

Re: Forms from models API example.

2011-09-27 Thread Jack720
Thank you it was a big help. I ended up putting together myself the example I wanted. http://www.peachybits.com/2011/09/django-1-3-form-api-modelform-example/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: ORM only/defer calls do not work on cross-table relations

2011-09-27 Thread John
Works perfectly, thanks :) Tested with a join 4 levels deep too and it made just one query. I use select_related elsewhere for more generic optimizations but it hadn't occurred to me that django would need the hint once in conjunction with an only() call. Perhaps a patch to ensure that the appro

Re: ORM only/defer calls do not work on cross-table relations

2011-09-27 Thread Alasdair Nicol
Hi John, Use select_related [1] to tell Django to 'follow' the foreign key. Try the following: testmodels = models.ATestModel.objects.all().select_related('other').only('other__name') print testmodels[0].other.name Regards, Alasdair [1]: https://docs.djangoproject.com/en/dev/ref/models/qu

user authentication problem

2011-09-27 Thread jenia ivlev
Hello. I want to register users. So I made a RegisterForm(ModelForm): Class Meta: model=User (from django.auten.contrib.User) no i display that form in a view and submit it. When i do form.is_valid(), i get this validation error: Your username and password didn't match. Please try again.

ORM only/defer calls do not work on cross-table relations

2011-09-27 Thread John
Hey, I'm trying to improve the performance of a Django app, and noticed that you can't seem to properly defer fields when making lookups with joins. To demonstrate, I set up a test project with the following models: class ATestModel(models.Model): other = models.ForeignKey('OtherModel') cla

Re: Extracting the database name from an object

2011-09-27 Thread Cal Leeming [Simplicity Media Ltd]
Ohh - I actually didn't know this, thanks for giving a heads up :) Cal On Tue, Sep 27, 2011 at 8:21 PM, Andre Terra wrote: > It doesn't hurt to remind him that methods that begin with _ are considered > unstable API and are subject to change/removal without previous notice. > > > Cheers, > AT >

Re: Extracting the database name from an object

2011-09-27 Thread Andre Terra
It doesn't hurt to remind him that methods that begin with _ are considered unstable API and are subject to change/removal without previous notice. Cheers, AT On Tue, Sep 27, 2011 at 3:51 PM, Willem Romijn wrote: > ob._state.db, according to this article: > > > http://stackoverflow.com/questio

Re: Extracting the database name from an object

2011-09-27 Thread Willem Romijn
ob._state.db, according to this article: http://stackoverflow.com/questions/4146781/does-a-django-model-know-from-which-database-it-was-loaded-and-how-can-this-info 2011/9/27 Juan Pablo Romero Méndez > Hello, > > Suppose I get an object from a non-default database: > > ob = MyModel.objects.usin

Re: Extracting the database name from an object

2011-09-27 Thread Cal Leeming [Simplicity Media Ltd]
Hope this helps. >>> _r = SessionIP.objects.get(id=1000) # figured this out by doing dir(_r._meta) >>> _r._meta.db_table 'ddcms_sessionip' # figured this out by looking at https://docs.djangoproject.com/en/dev/topics/db/multi-db/ >>> _r._state.db 'nats_rw' Cal 2011/9/27 Juan Pablo Romero Ménde

Suggest application

2011-09-27 Thread Yaroslav Govorunov
Hello! We are developing Helicon Zoo – a repository of web frameworks and applications for Windows and IIS ( http://www.helicontech.com/zoo/gallery/ ). Currently we have Python 2.7.1 and Django 1.3 running under IIS 7. Now we are filling repository with various Django applications. We have alread

Extracting the database name from an object

2011-09-27 Thread Juan Pablo Romero Méndez
Hello, Suppose I get an object from a non-default database: ob = MyModel.objects.using('somedb').get(pk=1) Is it possible later to retrieve the database name just from the object? ob.db?? Regards, Juan Pablo -- You received this message because you are subscribed to the Google Groups "Dj

Re: Cloudfiles Storage Backend

2011-09-27 Thread Eric Hutchinson
django cumulus does this with the directory hierarchy just fine. On Sep 26, 11:33 am, Kurtis wrote: > Hey, > > I really want to build a storage back-end for cloudfiles. The snag is > that cloudfiles containers do not allow for a hierarchical directory > structure. Everything must be in a "base di

Re: commit=false and user id

2011-09-27 Thread David
Great food for thought. Thank you for your help Tom! -- 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...@goog

Re: commit=false and user id

2011-09-27 Thread Tom Evans
On Tue, Sep 27, 2011 at 4:15 PM, David wrote: > Hi Tom > > I had been using ajax on the form and thus hadn't got my traceback. I > removed all ajax to get the traceback and it says: > > 'WSGIRequest' object has no attribute 'person' > > Relating to: > > f.person = request.person > > I guess. Do I

Re: Admin TabularInline Edit Parent Record?

2011-09-27 Thread Lee
Found this snippet, have not tried it yet: http://djangosnippets.org/snippets/431/ -- 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: commit=false and user id

2011-09-27 Thread David
Hi Tom I had been using ajax on the form and thus hadn't got my traceback. I removed all ajax to get the traceback and it says: 'WSGIRequest' object has no attribute 'person' Relating to: f.person = request.person I guess. Do I have to add a hidden field for the person id? -- You received th

Re: commit=false and user id

2011-09-27 Thread Tom Evans
On Tue, Sep 27, 2011 at 4:06 PM, David wrote: > Hi Tom > > I am unsure, yes it could be request.person that isn't populated. How > can I pass that through my form submission ? > > Thanks for your reply. > How can you be unsure? What does your traceback say? Debugging by guesswork is slow and err

Re: queryset.delete() ON DELETE ...

2011-09-27 Thread Jacob Kaplan-Moss
On Tue, Sep 27, 2011 at 8:30 AM, Thomas Guettler wrote: > it seems, that the django ORM can only do deletes which result in a lot > of SQL-Queries to do "on delete cascade" in python code. > > https://docs.djangoproject.com/en/1.3/ref/models/querysets/#delete > > Is there a way to leave this up to

Re: commit=false and user id

2011-09-27 Thread David
Hi Tom I am unsure, yes it could be request.person that isn't populated. How can I pass that through my form submission ? Thanks for your reply. -- 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@

Re: queryset.delete() ON DELETE ...

2011-09-27 Thread Lucian Nicolescu
AFAIK you can only call delete() on each separate member of the result and overwrite the models's delete() method where you decide wether to delete or not. Lucian On Tue, Sep 27, 2011 at 4:30 PM, Thomas Guettler wrote: > Hi, > > it seems, that the django ORM can only do deletes which result in

Re: commit=false and user id

2011-09-27 Thread Tom Evans
On Tue, Sep 27, 2011 at 3:55 PM, David wrote: > Hopefully this will make sense. > > You are on a page displaying information about a Person. You want to > add a log to this person so you fill in the form at the bottom of the > page. When that form is saved to a log object both the user that has >

commit=false and user id

2011-09-27 Thread David
Hopefully this will make sense. You are on a page displaying information about a Person. You want to add a log to this person so you fill in the form at the bottom of the page. When that form is saved to a log object both the user that has submitted the log, and the person to whom the log belongs

sekizai and django-registration tests failing

2011-09-27 Thread Brian Schott
Still pretty new to Django. I'm trying to understand how to write django tests and hit the following test failures in other installed apps. 1. Does the sekizai test failure mean that it expects settings to be in the python path? My settings.py file does have TEMPLATE_DEBUG, why isn't setting

Sampling of the two models by matching fields.

2011-09-27 Thread Satan Study Django
Good day. To the case. There are some models (simplified form): class Group (models.Model): name = models.CharField () class Person (models.Model): name = models.CharField () groups = models.ManyToManyField (Group) class Event (models.Model): name = models.CharField () g

Re: Cloudfiles Storage Backend

2011-09-27 Thread dm03514
YOu can implement a virtual directory, we do it for our cloud files. http://www.rackspace.com/cloud/blog/2010/01/26/nested-folders-in-rackspace-cloud-files/, It's clearly documented on a number of sites, if you just serach for it in google. -- You received this message because you are subscribed

Re: DB: working with databases

2011-09-27 Thread Uros Trebec
You can upgrade the "inspectdb" result with Django Autoadmin ( https://github.com/bancek/django-autoadmin ) which generates necessary basic AdminModel classes on the fly, without the need for manual definition and/or Django-specific DB tables (auth, for example). This way you can be up and running

Re: Django work experience wanted

2011-09-27 Thread Cal Leeming [Simplicity Media Ltd]
Sorry - I just realised this response would have been more appropriate 'off-list'. My apologies. Cal On Tue, Sep 27, 2011 at 3:13 PM, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote: > Hi Jon, > > I've forwarded your info to a few clients of mine, to try and help

Re: Django work experience wanted

2011-09-27 Thread Cal Leeming [Simplicity Media Ltd]
Hi Jon, I've forwarded your info to a few clients of mine, to try and help spread the word. Might also be worth looking for Python/Django on LinkedIn - and contacting people directly. Cal On Tue, Sep 27, 2011 at 10:19 AM, Jon Underwood wrote: > Dear Django people, > > I'm looking for some work

Re: Multiple Image Field in a model

2011-09-27 Thread Tom Evans
On Tue, Sep 27, 2011 at 2:49 PM, NavaTux wrote: > Thanks I have done the same way before seeing this valuable one. > > Let me ask you one more? ..Need to do some extra functioalities like > the effects of Uploading file in gmail like that in django? any > suggestions? > Google is full of tips and

Re: Multiple Image Field in a model

2011-09-27 Thread NavaTux
Thanks I have done the same way before seeing this valuable one. Let me ask you one more? ..Need to do some extra functioalities like the effects of Uploading file in gmail like that in django? any suggestions? On Sep 26, 7:14 pm, Philip Mountifield wrote: > I would put the images in a seperate

Re: Best practices to create multiple users profiles using Auth

2011-09-27 Thread ryan west
I actually just wrote a blog post about why I think extending contrib.auth.models.User is a better solution to using a OneToOneField (or a ForeignKey), you can find it here: http://ryanwest.info/blog/2011/django-tip-5-extending-contrib-auth-models-user/ Please let me know what you think. Regards

queryset.delete() ON DELETE ...

2011-09-27 Thread Thomas Guettler
Hi, it seems, that the django ORM can only do deletes which result in a lot of SQL-Queries to do "on delete cascade" in python code. https://docs.djangoproject.com/en/1.3/ref/models/querysets/#delete Is there a way to leave this up to the database? I know that you can give the ForeignKey the on

Re: FieldError on ManyToMany after upgrading to Django 1.3

2011-09-27 Thread Philip Mountifield
So I've had a further look into this. Firstly, I updated to PG 8.4, and found the the issue is still there. Secondly I had a look at Matthias' code on github and tries a few hacks. I found that clearing the caches on the opposite side of the many to many relationship solved the problem. E.g.

Best practices to create multiple users profiles using Auth

2011-09-27 Thread Santiago Basulto
Hello friends, i'm new with django. I've something to ask you. I'm building a website similar to eBay where i've different "kinds" of users. These are: CustomerUser and SellerUser. Both of them has different data to be saved. While reading docs and django book i noted the UserProfile "trick" (ht

Re: Help with image file upload

2011-09-27 Thread David
Thank you for the link but unfortunately it hasn't got me any further. I believe I have my model set up correctly: image_width = models.IntegerField(editable=False, null=True) image_height = models.IntegerField(editable=False, null=True) image = models.ImageField(upload_to='persons/%Y

Re: Help with image file upload

2011-09-27 Thread seb
On 27/09/2011 10:57, David wrote: Hello This is my view: @login_required @transaction.commit_on_success def update_person(request): try: person_id = int(request.POST['person_id']) except KeyError: raise Http404 person = Person.objects.select_related().get(pk=per

Django work experience wanted

2011-09-27 Thread Jon Underwood
Dear Django people, I'm looking for some work experience to help me develop my Django skills. I'm available 2 days a week (generally Monday and Wednesday) between 10am and 5pm GMT for the next few months. I've got a graduate Systems Engineering qualification and 1.5 years ANSI C experience in a

model.clean() return errors with field highliting

2011-09-27 Thread engrost
Hi I'm developing django application that have multiple admin panels. One for Admins one for customers one for our sales team. So I figured out to not override code too much best is to make validation on model level and that's possible with django 1.2. I needed to check if postal town of contact

Help with image file upload

2011-09-27 Thread David
Hello This is my view: @login_required @transaction.commit_on_success def update_person(request): try: person_id = int(request.POST['person_id']) except KeyError: raise Http404 person = Person.objects.select_related().get(pk=person_id) form = PersonForm(request.POS

Re: How to make a query form depend on a field?

2011-09-27 Thread David G. Pullman
On Sep 26, 2011, at 5:06 PM, Doug Ballance wrote: > There are also a few third-party apps that can assist you with the > form->query process such as this one: > > https://github.com/alex/django-filter > > -- > You received this message because you are subscribed to the Google Groups > "Django