Re: performance of model instgance save()

2011-05-10 Thread Brian
Sure - it's just that bit more convenient and readable to use the ORM approach. If I get the chance, I must try substituting direct calls to psycopg and see if that makes it significantly faster again. I'd guess there's maybe another factor of 2 to be had. -- You received this message because

Re: Apache + mod_wsgi deploy problem

2011-05-10 Thread Renato Beserra
Now I understand you, Stuart. Thanks to both yours and Tom's advices i was able to notice my network was fine and that still my apache did not get any external requests. I suspected that my ISP was blocking the port 80 and so i changed to 85 and everything is running smoothly. Thank you very much!

Re: django-simple-history

2011-05-10 Thread Shawn Milochik
The official answer is that you can't unless you rewrite everything to accept 'user' as a keyword-argument and then pass it from all your views. The dirty, wicked, reviled answer is to use threadlocals, but don't do that* or all the kids will laugh at you and you won't have any friends. Shawn

Re: Can django admin log be trusted?

2011-05-10 Thread Shawn Milochik
On 05/10/2011 09:11 PM, Venkatraman S wrote: @Shawn : can you elucidate on how your system with MongoDB performs? -V If you mean what is the performance penalty I couldn't really say. Our user-base is fairly small, so I don't know what the penalty is. If you want to know how it works, it's r

django-simple-history

2011-05-10 Thread Venkatraman S
Hi, I am trying to use django-simple-history [ https://bitbucket.org/q/django-simple-history ] for keeping an audit log of some of my tables; and was wondering how the current logged-in users info can be captured in this scheme. django-audit-log claims to capture the user information, but i see th

Re: Can django admin log be trusted?

2011-05-10 Thread Venkatraman S
On Wed, May 11, 2011 at 4:56 AM, Shawn Milochik wrote: > > 1. I have a post_save signal listener and I dump the info about each model > instance with a timestamp and the pk of the user to MongoDB each time. The > main reason is for auditing purposes, but you can also use this data to > recreate m

Re: performance of model instgance save()

2011-05-10 Thread Venkatraman S
On Wed, May 11, 2011 at 4:51 AM, Brian wrote: > Having hauled myself a few feet up out of the abyss of ignorance, I can > answer my own question (which might be of benefit to others getting started > with django). To clarify the problem, I have a standalone script that > imports the django settin

Re: my models are remembering old fields that I have since deleted

2011-05-10 Thread Doug
Got it. I was assuming that snycdb was dropping the old tables for me. All of the crazy stuff that was happening seems to be explained. Thanks. On 5/7/2011 9:50 PM, George Silva wrote: Just drop the old tables and run syncdb again! Cheers On Sat, May 7, 2011 at 10:45 PM, Nick Arnett

Re: Can django admin log be trusted?

2011-05-10 Thread Shawn Milochik
On 05/10/2011 05:59 PM, Paweł Roman wrote: You're right, I've just checked it and there's a gap for 100+ ids, so he must be right. Two things. One won't help you (this time), but the other will. 1. I have a post_save signal listener and I dump the info about each model instance with a timesta

Re: performance of model instgance save()

2011-05-10 Thread Brian
Having hauled myself a few feet up out of the abyss of ignorance, I can answer my own question (which might be of benefit to others getting started with django). To clarify the problem, I have a standalone script that imports the django settings and uses its ORM pleasantness to populate one of

django-debug-toolbar and it's development

2011-05-10 Thread David Cramer
Since not everyone uses Convore, and I wanted to pop in over here and talk about the direction of the Debug Toolbar. First off, I want to ask everyone what kind of workflow they prefer. Previously Rob had been using what is known as the "git-flow", which basically means master is a stable, release

Re: Can django admin log be trusted?

2011-05-10 Thread Jacob Kaplan-Moss
On Tue, May 10, 2011 at 4:59 PM, Paweł Roman wrote: > But does that mean that the django admin log is broken and cant be > trusted? How come there isnt any trace of adding those items? Well, I'd say "broken" might be a bit strong. Some cars drive 200 MPH, but mine won't. Does that mean my car's "

Re: Can django admin log be trusted?

2011-05-10 Thread Karen Tracey
On Tue, May 10, 2011 at 5:59 PM, Paweł Roman wrote: > You're right, I've just checked it and there's a gap for 100+ ids, so > he must be right. > > But does that mean that the django admin log is broken and cant be > trusted? How come there isnt any trace of adding those items? > Were they added

Re: filter in python

2011-05-10 Thread pankaj sharma
thanku very much. On May 9, 11:02 pm, Jani Tiainen wrote: > On Mon, 2011-05-09 at 06:15 -0700, pankaj sharma wrote: > > i have 4 branches in a college.. > > some college have three some have 4 and so on > > so i want to provide a search system to the user that they can see the > > list of

Re: Can django admin log be trusted?

2011-05-10 Thread Paweł Roman
You're right, I've just checked it and there's a gap for 100+ ids, so he must be right. But does that mean that the django admin log is broken and cant be trusted? How come there isnt any trace of adding those items? On May 10, 11:28 pm, Shawn Milochik wrote: > For what it's worth: > >      Rega

Re: How do you apply a decorator to all views in a views.py file?

2011-05-10 Thread Shawn Milochik
On 05/10/2011 05:15 PM, Jason Culverhouse wrote: http://docs.djangoproject.com/en/dev/topics/http/middleware/#process-exception Jason, That's perfect. I didn't know about process_exception. I asked about using middleware for this earlier today on this list, but nobody replied to that one. So

Re: Can django admin log be trusted?

2011-05-10 Thread Shawn Milochik
For what it's worth: Regardless of logging you should be able to identify any gaps in the table's primary keys. Your database should guarantee that. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dja

ANN: Django-photophile v.0.2.0 - templatetag for thumbnail generation with automatic rotation and an abstract model for EXIF-metadata handling.

2011-05-10 Thread Thomas Weholt
Just released a new version of django-photofile, featuring: - a template tag for easy thumbnail generation, supporting automatic rotation based on EXIF.Orientation. This is the reason this project got started in the first place; I did not find any thumbnailing package supporting rotation based on

unit testing and file location

2011-05-10 Thread Brian Craft
I would like unit tests that do file manipulations to run with a different storage "location", so they're not manipulating real app files. Is there a good way to do this? Is there a way to override model field initializers, so I can instance a model, passing in the 'storage' parameter for an ImageF

Can django admin log be trusted?

2011-05-10 Thread Paweł Roman
This is serious. A customer I've been working for, claims that he had been adding data via django admin panel (100+ or so records, and one record is really big, using many 'inlines' each with its own formset etc. so adding 100 such records is quite an effort) and at some point of time, large part

Re: How do you apply a decorator to all views in a views.py file?

2011-05-10 Thread Jason Culverhouse
On May 10, 2011, at 12:50 PM, Shawn Milochik wrote: > I have a decorator I'd like to apply to every view in a given views.py file. > Is there an elegant way to do that in Django? > > I searched Google and the docs but didn't find anything. > > So, I wrote some code which works and demonstrates

Re: Encrpting urls to hide PKs

2011-05-10 Thread Sean Brant
On May 10, 2011, at 4:02 PM, "Cal Leeming [Simplicity Media Ltd]" wrote: > Sean, are you suggesting that the OP rely on base36 encoding for security? > Please tell me you are joking. No not at all, I thought he stated this does not have to be secure. If it does, then yeah my code is a bad

Re: Encrpting urls to hide PKs

2011-05-10 Thread Cal Leeming [Simplicity Media Ltd]
Sean, are you suggesting that the OP rely on base36 encoding for security? Please tell me you are joking. On 10/05/2011 15:32, Sean Brant wrote: Sorry I think I only responded to the original poster. >>> from django.utils.http import int_to_base36, base36_to_int >>> int_to_base36(1

Re: Decimal * Float problem

2011-05-10 Thread Shawn Milochik
What error do you get? You should be able to import Decimal then do: discount = Decimal('0.65') -- 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,

Re: Encrpting urls to hide PKs

2011-05-10 Thread bedros
rather than embedding the confirmation ID in the URL; you can use session messages to pass the ID to the confirmation page view check out some examples here http://www.djangobook.com/en/beta/chapter12/ Regards, Bedros On May 10, 7:32 am, Sean Brant wrote: > Sorry I think I only responded to

Decimal * Float problem

2011-05-10 Thread Colin Corbett
models.py class OurProducts(models.Model): code = models.CharField(max_length=60) rrp = models.DecimalField (max_digits=8, decimal_places=2) def __unicode__(self): return self.name def discount_amount(self): discount=0.65 amount=self.rrp*discount return amount My variab

Re: How do you apply a decorator to all views in a views.py file?

2011-05-10 Thread Bill Freeman
Let's restate the problem. You want to find view automatically, rather than enumerate them. Beware, in your existing approaches, that not all functions having a first argument named request, and found in files named view.py, are view functions. Also, not all view functions meet that description.

Re: Where are request.user defined and assigned?

2011-05-10 Thread Shawn Milochik
On 05/10/2011 04:00 PM, Andy wrote: Thank you. So LazyUser is there to cache the user instance. Not exactly. It appears to be 'lazy' in that it doesn't actually do a database lookup to get the user until it has to. Read the LazyUser code and you'll see. In LazyUser(object), the user instanc

Re: Where are request.user defined and assigned?

2011-05-10 Thread Andy
Thank you. So LazyUser is there to cache the user instance. In LazyUser(object), the user instance is stored in request._cached_user In AuthenticationMiddleware(object), the user instance is stored in request.__class__.user But I don't see request.user being assigned at all. Where does that hap

How do you apply a decorator to all views in a views.py file?

2011-05-10 Thread Shawn Milochik
I have a decorator I'd like to apply to every view in a given views.py file. Is there an elegant way to do that in Django? I searched Google and the docs but didn't find anything. So, I wrote some code which works and demonstrates what I'm trying to do, but it's really ugly. http://dpaste.com

Re: Where are request.user defined and assigned?

2011-05-10 Thread Shawn Milochik
The User model is in django.contrib.auth, not in the core of Django. request.user is dealt with in the middleware that comes with the auth module. http://code.djangoproject.com/browser/django/trunk/django/contrib/auth/middleware.py -- You received this message because you are subscribed to t

Where are request.user defined and assigned?

2011-05-10 Thread Andy
I'm trying to understand how does request.user work. Looking into the source code of the HttpRequest class (https:// code.djangoproject.com/browser/django/trunk/django/http/ __init__.py#L135) there is no "user" attribute for HttpRequest. So where is the "user" attribute defined? And which code is

Re: How to deal with an auto-incrementing primary key

2011-05-10 Thread Lucian Nicolescu
If you are absolutely sure the field is filled in (the sequence is defined) I guess you can allow it to be null in the model definition. On Tue, May 10, 2011 at 7:33 PM, wilbur wrote: > Using exclude works to eliminate this sample_id field from the form, > but I get a > > 'Null value in column "s

Logging view exceptions: A tip and a question.

2011-05-10 Thread Shawn Milochik
Tip part 1: I just learned about the awesome logging.exception function today. Instead of a logger.error or logging.debug, you can call logging.exception (if you're in the "except" of a try/except block), and it will automatically include the stack trace. This is super-helpful, especially now

Re: How to deal with an auto-incrementing primary key

2011-05-10 Thread Amanjeev Sethi
> > Will south add in the new ID field? I have never come across a situation where South was not able to change something in a table for me, so far. Try it please. On Tue, May 10, 2011 at 1:52 PM, wilbur wrote: > I definitely need to keep the database, and have South installed, but > should I

Re: How to deal with an auto-incrementing primary key

2011-05-10 Thread wilbur
I definitely need to keep the database, and have South installed, but should I get rid of the original primary key and the sequence it depends on? Will south add in the new ID field? On May 10, 11:48 am, Shawn Milochik wrote: > If you don't mind losing all your data you can destroy the database t

Re: How to deal with an auto-incrementing primary key

2011-05-10 Thread Shawn Milochik
If you don't mind losing all your data you can destroy the database then do syncdb. If you re-run syncdb without re-creating the database then it will do nothing for existing tables. You can use South[1] if you need to keep your data intact. [1] http://south.aeracode.org/ -- You received th

Re: How to deal with an auto-incrementing primary key

2011-05-10 Thread wilbur
I will try just removing it from the model. Does this mean I should remove the sample_id variable from the Postgres database as well. Will running syncdb create the new id field for that table? On May 10, 10:33 am, wilbur wrote: > Using exclude works to eliminate this sample_id field from the for

Re: Apache + mod_wsgi deploy problem

2011-05-10 Thread Stuart MacKay
The idea behind using telnet was simply to verify the network connections - that the web server is listening on the correct port and that your router was working correctly. Stuart I am not sure I got your suggestion and I don't have telnet working but i have similar rules for django productio

Re: How to deal with an auto-incrementing primary key

2011-05-10 Thread Shawn Milochik
I think the problem is that you used IntegerField instead of AutoField. http://docs.djangoproject.com/en/1.3/ref/models/fields/#autofield However, why even bother? Why not get rid of that field and use the built-in id field that you're going to get from a Django model? There's no benefit at al

Re: How to deal with an auto-incrementing primary key

2011-05-10 Thread wilbur
Thanks for helping on this Shawn... My model definition looks like this: class Sample(models.Model): met_type = models.ForeignKey(MetType, verbose_name='Meteorite Type') sample_name = models.CharField(max_length=100, verbose_name='Sample Name') sample_id = models.IntegerField(primary

Re: How to deal with an auto-incrementing primary key

2011-05-10 Thread Shawn Milochik
What's your model look like? Did you add the foreign_key = True kwarg to the field in question? -- 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,

Re: Apache + mod_wsgi deploy problem

2011-05-10 Thread Renato Beserra
I am not sure I got your suggestion and I don't have telnet working but i have similar rules for django production server on port 8000 and ssh and they works just fine from external hosts. Does that help? Thanks. 2011/5/10 Stuart MacKay > Can you telnet to the web server: telnet 80 (assuming >

Re: How to deal with an auto-incrementing primary key

2011-05-10 Thread wilbur
Using exclude works to eliminate this sample_id field from the form, but I get a 'Null value in column "sample_id" violates not-null constraint' If one inserts a record directly through Postgresql command line, the sample_id field gets incremented automatically with its sequence, but it does not

Re: How to deal with an auto-incrementing primary key

2011-05-10 Thread Shawn Milochik
http://docs.djangoproject.com/en/1.3/ref/contrib/admin/ Check out 'fields' and 'exclude.' -- 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

How to deal with an auto-incrementing primary key

2011-05-10 Thread wilbur
I am using Django 1.2.4 with a Postgresql 8.4 backend. Before creating my models in Django, I began with a existing Postgresql database with tables for which I had defined integer primary keys that used an autoincrementing sequence on table inserts. When I created my Django models, I defined the pr

Re: Apache + mod_wsgi deploy problem

2011-05-10 Thread Stuart MacKay
Can you telnet to the web server: telnet 80 (assuming it is listening on port 80). That would at least tell you whether your LAN setup was correct. Stuart MacKay Lisboa, Portugal -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to thi

Re: Apache + mod_wsgi deploy problem

2011-05-10 Thread Renato Beserra
I guessed that the problem was at my httpd.conf because i am a newbie at apache configuration. But i looked at both logs you indicated and they show absolutely no response to external request. I checked my router again and the port 80 is forwarded to the right internal IP and the router firewall se

Re: How to cache model field?

2011-05-10 Thread Amanjeev Sethi
You can have a field called "total_votes" in the Book model. Then you can override the save() method in the Vote class, which calculates the total votes on a particular Book and updates the "total_votes" in the book. Also, why not use https://github.com/brosner/django-voting Django-voting app? I

Re: How to cache model field?

2011-05-10 Thread Amanjeev Sethi
oops. my bad wrong email. sorry. -- 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...@googlegroups.com. For mo

Re: Problem Spoofing From Field with Django Emails

2011-05-10 Thread benp
Darn, thanks for saving me a lot of time and frustration Brett. Best, Ben On May 10, 10:48 am, Brett Parker wrote: > On 10 May 07:34, benp wrote: > > > Thanks Brett, > > > I was starting to go a little nuts. > > > >To a limited extent - also don't forget that the envelope sender and the > > >fro

Re: Problem Spoofing From Field with Django Emails

2011-05-10 Thread Brett Parker
On 10 May 07:34, benp wrote: > Thanks Brett, > > I was starting to go a little nuts. > > >To a limited extent - also don't forget that the envelope sender and the > >from header are different. > > This seems to imply that I can still change the from header (what I > understand to be spoofing). I

Re: Problem Spoofing From Field with Django Emails

2011-05-10 Thread benp
Thanks Brett, I was starting to go a little nuts. >To a limited extent - also don't forget that the envelope sender and the >from header are different. This seems to imply that I can still change the from header (what I understand to be spoofing). I assume that companies like AddThis (a social m

Re: Encrpting urls to hide PKs

2011-05-10 Thread Sean Brant
Sorry I think I only responded to the original poster. >>> from django.utils.http import int_to_base36, base36_to_int >>> int_to_base36(123) '3f' >>> base36_to_int('3f') 123 Sean -- You received this message because you are subscribed to the Google Groups "Django users" gro

Re: Problem Spoofing From Field with Django Emails

2011-05-10 Thread Brett Parker
On 10 May 07:15, benp wrote: > Hi, > > I'm new to mail servers. My issue is that I want to enable my > website's users to email each other directly via their personal (often > gmail) accounts. I've have the default Email backend set up and my > settings file looks like this: > > EMAIL_HOST='smt

Problem Spoofing From Field with Django Emails

2011-05-10 Thread benp
Hi, I'm new to mail servers. My issue is that I want to enable my website's users to email each other directly via their personal (often gmail) accounts. I've have the default Email backend set up and my settings file looks like this: EMAIL_HOST='smtp.gmail.com' EMAIL_HOST_USER='b...@mycompany

Re: Django 1.3 CSRF faild when upgraded from Django 1.2.5

2011-05-10 Thread _ johnny .
Try add RequestContext in render_to_response() from django.template import RequestContext return render_to_response('account/login.html', > locals(), context_instance=RequestContext(request)) On Tue, May 10, 2011 at 10:10 AM, 阮明辉 wrote: > return render_to_response('account/login.html') > --

Re: Apache + mod_wsgi deploy problem

2011-05-10 Thread Tom Evans
On Tue, May 10, 2011 at 12:39 PM, Renato Beserra wrote: > Hi, > > I think I have a really basic problem but I didn't find a solution searching > the web. > > I have a Django application running on my local apache, and I can access > everything locally whitout any problems. But when i try to access

Django 1.3 CSRF faild when upgraded from Django 1.2.5

2011-05-10 Thread 阮明辉
Hi, When I upgrade Djago from 1.2.5 some of my code failds. I am new to django, When I write a login form . there are some errors. I got a http403 CSRF verification failed. Request aborted. But I hava put 'django.middleware.csrf.CsrfViewMiddleware', on settings.py and {% csrf_token %} on my t

How to cache model field?

2011-05-10 Thread Eugene Goldberg
For example, we have object 'book' and 'vote'. Each vote is assigned to some book. On page I'd like to know how many votes was for certain book? The first solution was to create a methdon in book model: def get_votes(self): .. database query here . return an integer... That is the best w

Apache + mod_wsgi deploy problem

2011-05-10 Thread Renato Beserra
Hi, I think I have a really basic problem but I didn't find a solution searching the web. I have a Django application running on my local apache, and I can access everything locally whitout any problems. But when i try to access it from an external host, the server timeout.I guess it has somethin

Re: Django on FreeHostingCloud.com

2011-05-10 Thread Ryan Osborn
Is no one able to offer any help? Thanks, Ryan -- 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...@googlegr

Re: Loading project to alwaysdata

2011-05-10 Thread Stuart MacKay
Try Google Translate, http://translate.google.com/?hl=en#fr|en|, it's not perfect but it does rather a good job, particularly on formal documents. Regards, Stuart MacKay Lisboa, Portugal My problem with those is that I can't read french so I have no idea what it is saying. On May 9, 3:01 pm

Re: Loading project to alwaysdata

2011-05-10 Thread ruler501
My problem with those is that I can't read french so I have no idea what it is saying. On May 9, 3:01 pm, werefrog wrote: > Hi, > >  From their wiki [1], they provide a link for activating your ssh > account [2]. Then, you can connect from your client (they link to PuTTY > [3]). I see that your h

Re: How to use 2 different cache backends

2011-05-10 Thread Tom Evans
On Tue, May 10, 2011 at 12:17 PM, galgal wrote: > I need to use memcached and file based cache. > Docs says: > cache.set('my_key', 'hello, world!', 30) > cache.get('my_key') > OK, but how can I now set and get cache only for 'inmem' cache backend (in > future memcached)? Documentation doesn't ment

Re: How to use CreateView?

2011-05-10 Thread Tom Evans
On Mon, May 9, 2011 at 6:19 PM, Boštjan Mejak wrote: > > What if you add the dot to action, like above? What does that mean? And note > that my form method is get. Anyone knows about what the dot does? > The action parameter takes a URL location. This can be absolute or relative, using '.' is si

How to use 2 different cache backends

2011-05-10 Thread galgal
I need to use memcached and file based cache. I setup my cache in settings: CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', 'LOCATION': 'c:/foo/bar', }, 'inmem': { 'BACKEND': 'django.core.cache.backends.dummy.DummyCache'

AW: unpredictable CSRF error on mobile devices

2011-05-10 Thread Szabo, Patrick (LNG-VIE)
Maybe they should try to log in simulatneously with the same user while one uses his iPhone and the other one a PC. If the error still occurs you know it's not about the devices but about using the same user or same wifi-network. cheers . . . . . . . . . . . . . . . . . . . . . . . . . . Patr

Re: unpredictable CSRF error on mobile devices

2011-05-10 Thread nederhoed
Is it possible for a user to receive the CSRF error when he logs in using two almost identical iPhones, from the same Wifi network, with the same username, simultaneously? I would think these 2 sessions wouldn't collide... Cheers, Robert-Reinder On May 9, 11:06 am, nederhoed wrote: > Hi everyon

Re: using django on a server?

2011-05-10 Thread Kenny Meyer
>> Could I get the same functionality by just using pythong cgi and python to >> access mysql? (like php scripting) > > Probably; but that is like if you were to ride a monstrous and untamed > Warhorse, having this cute and little pony which can already do a 100 > tricks. :-) You will not always n

Re: using django on a server?

2011-05-10 Thread Kenny Meyer
> 1. What is the purpose of using a web framework like django? Could I > get the same functionality by just using pythong cgi and python to > access mysql? (like php scripting) A web application framework is a software framework that is designed to support the development of dynamic websites, web a

Re: Encrpting urls to hide PKs

2011-05-10 Thread ALJ
Some interesting stuff here. The short URL generator looks interesting. But yes, I appreciate the thoughts about security. Horses for courses and all that. Cheers ALJ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

AW: outer joins, raw sql or one-to-many?

2011-05-10 Thread Szabo, Patrick (LNG-VIE)
The latter might not work for your specific model but in general it works. I'm using this synax in quite a few cases. . . . . . . . . . . . . . . . . . . . . . . . . . . Patrick Szabo XSLT Developer LexisNexis Marxergasse 25, 1030 Wien mailto:patrick.sz...@lexisnexis.at Tel.: +43 (1) 534 52 -

Re: outer joins, raw sql or one-to-many?

2011-05-10 Thread Michel30
wow this works :-) I think I mixed up the tables before: submitter = models.ForeignKey(Author, db_column='SubmitterID') vs submitter = models.ForeignKey(Author, db_column='authorid') the latter doesn't work obviously.. Thanks all, I think this will help me on my way! On May 10, 9:38 am

AW: outer joins, raw sql or one-to-many?

2011-05-10 Thread Szabo, Patrick (LNG-VIE)
The lather should work... . . . . . . . . . . . . . . . . . . . . . . . . . . Patrick Szabo XSLT Developer LexisNexis Marxergasse 25, 1030 Wien mailto:patrick.sz...@lexisnexis.at Tel.: +43 (1) 534 52 - 1573 Fax: +43 (1) 534 52 - 146 -Ursprüngliche Nachricht- Von: django-users@goog

Re: outer joins, raw sql or one-to-many?

2011-05-10 Thread Kenneth Gonsalves
On Tue, 2011-05-10 at 00:26 -0700, Michel30 wrote: > {{ some_thing.firstname }} maybe {{ some_thing.submitter.firstname }} -- regards KG http://lawgon.livejournal.com Coimbatore LUG rox http://ilugcbe.techstud.org/ -- You received this message because you are subscribed to the Google Groups "D

Re: outer joins, raw sql or one-to-many?

2011-05-10 Thread Michel30
Oops slip of the mouse there :-) I've tried setting up the relations before like my previous post. But then when I want to fetch data with, for example: some_thing = Documentrevision.objects.filter(some_filter criteria) and then use it in my form like this: {{ some_thing.firstname }} Ther

Re: outer joins, raw sql or one-to-many?

2011-05-10 Thread Kenneth Gonsalves
On Tue, 2011-05-10 at 00:18 -0700, Michel30 wrote: > I tried that before using: > submitterid = models.ForeignKey('Author', to_field='authorid') that is the correct way (although I would prefer to call the field submitter) -- regards KG http://lawgon.livejournal.com Coimbatore LUG rox http://ilu

Re: outer joins, raw sql or one-to-many?

2011-05-10 Thread Michel30
Hi Kenneth, I tried that before using: submitterid = models.ForeignKey('Author', to_field='authorid') On May 10, 9:07 am, Kenneth Gonsalves wrote: > On Mon, 2011-05-09 at 23:56 -0700, Michel30 wrote: > > Now, for every documentid I retrieve I want to find it's firstname and > > lastname. Authori

Re: outer joins, raw sql or one-to-many?

2011-05-10 Thread Jani Tiainen
On Mon, 2011-05-09 at 23:56 -0700, Michel30 wrote: > Hey all, > > I'm having trouble wrapping my head around querying multiple tables > with relations between them. > I'm writing an (cms-like) app that will use an existing mysql > database. I modeled that, got my code up and running and am now in

Re: outer joins, raw sql or one-to-many?

2011-05-10 Thread Kenneth Gonsalves
On Mon, 2011-05-09 at 23:56 -0700, Michel30 wrote: > Now, for every documentid I retrieve I want to find it's firstname and > lastname. Authorid relates to submitterid in this case. submitter should be foreign key to author - then all your problems will go away. -- regards KG http://lawgon.livej