Re: Relation not found error while dealing with foreign keys and forms

2011-11-03 Thread Tabitha Samuel
K, so that worked... This is what I got: In [5]: i = Staff.objects.using('gold').get(username='tsamuel') In [6]: i.nics_group.n_group_name Out[6]: u'Systems and Operations' Looks like the foreign key is working fine from the db's perspective. This is how I'm getting the form: form =

Re: django and profile pictures creation

2011-11-03 Thread Kurtis Mullins
One option is to check out userena. If you don't want to use a third party application, then I would go about creating a UserProfile that has a one-to-one relationship with each User. And in that UserProfile Model, create an ImageField for the avatar. Here's some links to help get you started.

How can I limit a 'list_filter' to a certain subset of objects?

2011-11-03 Thread Rodrigo Cea
Explanation: I have 3 models: Client, Project and Task. Each Client has 1 or more Projects. Each Project has 1 or more Tasks. A Client can only see the Projects assigned to him and the Tasks assigned to one of his Projects. This is already working, overriding "queryset" in the ModelAdmin

Re: Which is the best way of query a database view(no from Django model)

2011-11-03 Thread Andre Lopes
Hi Daniel, thanks for the reply. I have tested to "inspectdb" but I think the schema is to complex, for example... for the table "tdir_files_context" (djangoinspectdb.JPG "image in attachment") I got this model: [code] class TdirFilesContext(models.Model): id_category =

Re: Which is the best way of query a database view(no from Django model)

2011-11-03 Thread Daniel Roseman
On Thursday, 3 November 2011 20:04:30 UTC, Andre Lopes wrote: > > Hi, > > I'm a new to Django... > > I have a database schema that stores me information that I want to > show in a Django website. This database schema have nothing to do with > a Django App... > > Which is the best way of doing this

Which is the best way of query a database view(no from Django model)

2011-11-03 Thread Andre Lopes
Hi, I'm a new to Django... I have a database schema that stores me information that I want to show in a Django website. This database schema have nothing to do with a Django App... Which is the best way of doing this in Django? I have read the documentation and seems to me that I will need to

Re: Caching at model class level

2011-11-03 Thread Tom Evans
On Thu, Nov 3, 2011 at 2:22 PM, Thomas Guettler wrote: > Hi, > > I try to reduce the number of db-queries in my app. > > There is a model which changes almost never. It is like a "type of ticket" > in a trouble ticket system. > > On one page there are seven SQL-Queries (SELECT

Re: Relation not found error while dealing with foreign keys and forms

2011-11-03 Thread Furbee
I may have lead you astray. I set up the same models on my end and get the same query; it didn't show the join of the foreign key in the QuerySet of Staff, but when I did a get() on username='tsamuel' I got a Staff object. Then I was able to get the group they belonged to. This was successful for

Re: User form creation from frontend?

2011-11-03 Thread J. Cliff Dyer
This is readily done in Django, but it will require you to handle the logic involved. You will need to create a view that shows a data entry form to the user to create the quiz and processes the data that is submitted, and then to create another view where students see the homework questions

Re: Caching at model class level

2011-11-03 Thread Andre Terra
Django caching frameworks also provide a low level API[1]. sebleier's django-redis-cache is one great tool for the job [2]. In order to use it, you will of course need redis too [3]. Cheers, AT [1] https://docs.djangoproject.com/en/dev/topics/cache/#the-low-level-cache-api [2]

Re: Caching at model class level

2011-11-03 Thread Thomas Guettler
Am 03.11.2011 15:29, schrieb Donald Stufft: > Normally this is cached using the Django caching framework, this lets > you save it in memcache, redis, etc The django caching frameworks provides decorators for caching complete web pages. And it provides an API for caching strings or objects which

User form creation from frontend?

2011-11-03 Thread Mauricio Mercado
I would like to be able to make a user create forms to a section of a site from the frontend, is there anything out there that would let me do this in Django/Python? The point is to be able to create kind of quizzes section, or like homework questions to students, but the teacher who creates

Re: Caching at model class level

2011-11-03 Thread Donald Stufft
Normally this is cached using the Django caching framework, this lets you save it in memcache, redis, etc On Thursday, November 3, 2011 at 10:22 AM, Thomas Guettler wrote: > Hi, > > I try to reduce the number of db-queries in my app. > > There is a model which changes almost never. It is

Caching at model class level

2011-11-03 Thread Thomas Guettler
Hi, I try to reduce the number of db-queries in my app. There is a model which changes almost never. It is like a "type of ticket" in a trouble ticket system. On one page there are seven SQL-Queries (SELECT FROM ticket_type where id=123) which of course always return the same result. I

django and profile pictures creation

2011-11-03 Thread yan
Hello, I am developing a website which will have some social features like people profiles, but I am having a problem on how to create a space where a person will put his/her profile picture, I am using django framework and MySQL, can anyone help me please? -- You received this message because

Re: QuerySet: "if obj in queryset" can be very slow

2011-11-03 Thread Tom Evans
On Wed, Nov 2, 2011 at 6:26 PM, Ian Clelland wrote: > Just looking at the source to QuerySet (finally), and it looks like the > __contains__ method actually does something different than this: It > evaluates the whole QuerySet in bulk at the database level, and starts >

Re: Abstract FormView

2011-11-03 Thread Andre Terra
All you have to do is create a MyFormMixin class and add all those methods you want to override. Usually you will want to call super() on the class so that the normal behavior is also present in your final class. The difference between a Mixin and a full-fledged Class can be nearly non-existent

Re: I've done my first project in django but now I can't start a new one.. ?!

2011-11-03 Thread Andre Terra
You've probably changed your .py file association in Explorer, probably when configuring Notepad++. Try changing them back so that python executes .py files or run > python django-admin.py startproject todo Cheers, AT On Thu, Nov 3, 2011 at 4:58 AM, paz aricha

Re: Suggestions on "Loading" for possible long load-times?

2011-11-03 Thread Andre Terra
What Matt meant to say is that Celery is *the* framework for handling background tasks, especially in the Python/Django world. Cheers, AT On Wed, Nov 2, 2011 at 8:55 PM, Matt Schinckel wrote: > Russ mentioned it in passing, but I'll point it out for clarity: Celery is > a

I've done my first project in django but now I can't start a new one.. ?!

2011-11-03 Thread paz aricha
I finished the ThinkVitamin tutorial on the polls app and now I want to start a new project to work on. So I opened my command line (on windows) and types: "django-admin.py startproject todo" But it didn't work...Instead it just opens the django-admin.py file in notepadd++ and does nothing else.

Re: "python manage.py runserver" creates not tables (tutorial)

2011-11-03 Thread Andre Terra
$ python manage.py dbshell If you can't reach a database shell through that, then there's something wrong with your database setup. Cheers, AT On Wed, Nov 2, 2011 at 10:55 AM, Martin Chiteri wrote: > What about if you do a > > python manage.py sqlall > > From the

Re: QuerySet: "if obj in queryset" can be very slow

2011-11-03 Thread Thomas Guettler
Hi, I created a ticket: https://code.djangoproject.com/ticket/17156 {{{ The documentation should explain what happens in this code: if obj in queryset: If queryset is huge, the above code can be very slow. If you want to run the code in the database, you should use this: if