Re: [Urgent]Accessing tables not created by django models using django APIs.

2009-05-25 Thread Alex Gaynor
se let me know. > > Thanks, > ds99 > > > > Yes, you can use those models with django, you'll need to create Model classes for them though, http://docs.djangoproject.com/en/dev/ref/django-admin/#inspectdb can assist with this task. No one model can't be used to re

Re: When to use admin, and when not to.

2009-05-25 Thread Alex Gaynor
On Mon, May 25, 2009 at 8:25 PM, Sam Kuper wrote: > 2009/5/26 Alex Gaynor > >> On Mon, May 25, 2009 at 7:51 PM, Sam Kuper >> wrote: >> >>> Suppose you were re-writing Facebook in Django. >>> >>> Would you handle the complex profile and privacy

Re: When to use admin, and when not to.

2009-05-25 Thread Alex Gaynor
k to documentation where relevant. > > Many thanks! > > Sam > > > > B). The admin is designed really for use with fully trusted administrators only, the extra hooks that have been placed in for more find grained control notwithstanding. Alex -- "I disapprove of what you say

Re: "if settings.DEBUG" -- good design?

2009-05-25 Thread Alex Gaynor
27;s called) conditionally on settings.DEBUG, that way you only have the test in one place. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law."--Cicero --~--~-~--~~---

Selecting only published Articles

2009-05-25 Thread Alex Jonsson
hat's not very plugable when for example using the django-tagging app. Any suggestions? Alex --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send e

Re: Need help with URL rewrites

2009-05-25 Thread Alex Koshelev
Hi, Kevin. You can try to set FORCE_SCRIPT_NAME = '/directory' [1] settings variable. Or setup your web server to provide valid SCRIPT_NAME environment variable. [1]: http://docs.djangoproject.com/en/dev/ref/settings/#force-script-name --- Alex Koshelev On Mon, May 25, 2009 a

Re: validation and the ORM layer

2009-05-25 Thread Alex Gaynor
PGP SIGNATURE- > Version: GnuPG v1.4.9 (GNU/Linux) > > iEYEAREDAAYFAkoa1u0ACgkQIgvIgzMMSnW/lwCgnONhjZKtCSJ/MCDQobf6+KUX > ankAn13F2RaQbWEvgaY1mGLk3LP/8r7A > =JXgV > -END PGP SIGNATURE- > > Django does not currently support model-validation, there is a google summer of

Re: efficiency question on filters

2009-05-25 Thread Alex Gaynor
ult. get() is for when you want one, and exactly one, resulting object. If you ever want to see what SQL is being excecuted by a queryset you can either do qs.query.as_sql() which returns the SQL string and the params, or you can excecute the query and then do: from django.db import conn

Re: efficiency question on filters

2009-05-25 Thread Alex Gaynor
On Mon, May 25, 2009 at 8:19 AM, Bobby Roberts wrote: > > > If you take a look at Q objects they allow you to do just that: > http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-looku... > > > > Alex > > Hi Alex... that might take some reading up on and

Re: efficiency question on filters

2009-05-25 Thread Alex Gaynor
you take a look at Q objects they allow you to do just that: http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good i

Re: Obfuscate HTML..?

2009-05-24 Thread Alex Gaynor
1. How would I obfuscate the HTML as much as possible (remove all line > breaks, etc.) > 2. How would I best add the layer which does this obfuscation > > > The best way to do the obfuscation would be with middleware, as for how to obfuscate, I don't know. Alex -- "I dis

Re: Add rel="nofollow" to all outbound links?

2009-05-24 Thread Alex Gaynor
On Sun, May 24, 2009 at 3:53 PM, jago wrote: > > Hi, > > can I tell Django 0.96 to automatically process all outbound links and > add: rel="nofollow" ? > > Thanks, > jago > > > You could write a middleware that does this, but there's nothing in Dj

Re: Avoiding unnecessary ajax

2009-05-24 Thread Alex Gaynor
ving to fetch a list of categories at all of my > views. I'm simply populating the list of categories by ajax. This > seems a bit, clunky to do. Is there a better way to do it? > > > Take a look at template context processors, on inclusion tags. Alex -- "I disapprove of w

Re: please provide a html download of the doc

2009-05-24 Thread Alex Gaynor
need an internet connection *once* to install them, that's all. Regardless this is not the place to discuss the installation of other packages. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is t

Re: multi-table inheritance and binding objects

2009-05-24 Thread Alex Gaynor
c_set.all(): > File "/home/nagyv/virtualenv/django-1.0.2/lib/python2.5/site- > packages/Django-1.0.2_final-py2.5.egg/django/db/models/fields/ > related.py", line 235, in __get__ >raise self.field.rel.to.DoesNotExist > DoesNotExist > > thanks, > Viktor > >

Re: getting error with admin logout

2009-05-24 Thread Alex Gaynor
e that you'll probably need to manually specify some paths during the patch process as the patch is a git format diff. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law."--Cice

Re: Revisit Django trunk and Python 2.6

2009-05-24 Thread Alex Gaynor
; problem? > > Thanks. > > > Django trunk (or 1.0.X branch) has no known issues with Python 2.6, I personally use that for development. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire &

Re: Unintended date to Unicode string conversion

2009-05-23 Thread Alex Gaynor
On Sat, May 23, 2009 at 11:58 AM, Carlos A. Carnero Delgado < carloscarn...@gmail.com> wrote: > > Hi, > > On Sat, May 23, 2009 at 12:54 PM, Alex Gaynor > wrote: > > There was a bug like this seen when aggregates were first added that no > one > > was eve

Re: Unintended date to Unicode string conversion

2009-05-23 Thread Alex Gaynor
> >>> media_file = MediaFile.objects.annotate(hits=Sum('hits__hits'))[0] > >>> media_file.title > u'This is a media file' > >>> media_file.added_on > u'2009-05-23 12:06:14.484000' > >>> media_file.hits > 11 &g

Re: Plugin technology

2009-05-23 Thread Alex Gaynor
ng on > > your needs, you can enforce it a number of ways: simple documentation of > > the superclass, putting in a stub of NotImplemented, etc. > > > > I believe in duck typing (documentation of the superclass) rather than > explicitly forcing something. > > I'm just

Re: Status of support for compound keys

2009-05-22 Thread Alex Gaynor
primary keys are currently not supported, see ticket 373: http://code.djangoproject.com/ticket/373 Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law."--Cicero --~--~-~--~--

Re: Making queries on manytomany tables

2009-05-22 Thread Alex Gaynor
On Fri, May 22, 2009 at 8:21 PM, Patrick wrote: > > Do I also need to use select_related() anywhere? > > On May 22, 5:57 pm, Alex Gaynor wrote: > > On Fri, May 22, 2009 at 7:41 PM, George Song wrote: > > > > > On 5/22/2009 5:31 PM, Patrick wrote: > > >

Re: how to load data?

2009-05-22 Thread Alex Gaynor
ht be able to use Django's > serialization somehow. > > But some more specifics on your data format will allow us to help you more. > > -- > George > > > > If it's an actual db dumb (aka SQL) you can just give it strait to the db. Otherwise you'll probably n

Re: Making queries on manytomany tables

2009-05-22 Thread Alex Gaynor
ManyField(Album) > > > > def __unicode__(self): > > return self.title > > Probably a compound query: > > 1. All albums for a given artist > 2. All songs where albums in #1 > > -- > George > > > > Song.objects.filter(albums__artists=)

Re: please provide a html download of the doc

2009-05-22 Thread Alex Gaynor
ble. b) I suggest you search for past discussions on this: http://groups.google.com/group/django-users/browse_thread/thread/681b37385cc8e687/1ada5b35ba4eb361?lnk=gst&q=downloadable+documentation#1ada5b35ba4eb361 c) Declaring Spinx unpythonic and evil is patently ignorant, I suggest you do any am

Re: HELP:Caught an exception while rendering: no such column:

2009-05-22 Thread Alex Gaynor
in without > > altering the table (syncdb doesn't alter existing tables, database > > migrations are not part of its job description). > > > You can either use an application like django-evolution or south to migrate your tables, you can issues the ALTER TABLE SQL you

Re: When do snippets get into Django?

2009-05-22 Thread Alex Gaynor
TURE- > > http://jacobian.org/writing/what-is-django-contrib/ here is a description of what one of the core developers see as the role of django contrib. It should be noted that 2 of the core devs said at euro django con that that they prefer the core of django to remain slim. Alex --

Re: Displaying objects in template

2009-05-20 Thread Alex Gaynor
2009/5/20 Oleg Oltar > Is there any doc I can read about it? > > On Wed, May 20, 2009 at 9:50 PM, Alex Gaynor wrote: > >> >> >> 2009/5/20 Oleg Oltar >> >>> Ok, I got it now >>> What about the inheritance? Question 2? >

Re: Callable objects instead of functions in views.py

2009-05-20 Thread Alex Gaynor
> Is there any elegant solution, which would allow to break, just when > it's needed? > > 2009/5/20 Alex Gaynor : > > > > > > 2009/5/20 Filip Gruszczyński > >> > >> > Take a look at this: > >> > http://code.djangoproject.com/ticket/6735#co

Re: ModelChoiceField help

2009-05-20 Thread Alex Gaynor
On Wed, May 20, 2009 at 2:05 PM, Bobby Roberts wrote: > > > > Your class should inherit from "forms.ModelChoiceField", not just > > ModelChocieField. > > > > Alex > > > Ok i'm getting somewhere! Thanks for your patience. I'm still >

Re: Displaying objects in template

2009-05-20 Thread Alex Gaynor
2009/5/20 Oleg Oltar > Ok, I got it now > What about the inheritance? Question 2? > > On Wed, May 20, 2009 at 9:30 PM, Alex Gaynor wrote: > >> >> >> 2009/5/20 Oleg Oltar >> >> Hi! >>> I have a model with a Sections and Categories

Re: ModelChoiceField help

2009-05-20 Thread Alex Gaynor
s a note, you're going to want to have the > > MyModelChoiceField class before your form (in the file), otherwise the > Field > > won't be defined when you go to use it. > > > > Alex > > > > Alex - > > I really appreciate your help. I mad

Re: Displaying objects in template

2009-05-20 Thread Alex Gaynor
ategories), how to handle it in separate (extended > templates)? E.g. do I have to query categories in each my view and pass it > as value to all templates I use? > > > Thanks in advance > Oleg > > > > > {% for section in category_object.section_set.all %} {% endfo

Re: ModelChoiceField help

2009-05-20 Thread Alex Gaynor
On Wed, May 20, 2009 at 12:32 PM, Bobby Roberts wrote: > > > You aren't actually using that Field though, you need to use it in place > of > > ModelChoiceField where you want that behavior. > > > > Alex > > > here's what i'

Re: Cache and i18n

2009-05-20 Thread Alex Gaynor
ttext_lazy, since strings for fields are defined at the module level and are therefore evaluated when the class is compiled. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law."--Ci

Re: Callable objects instead of functions in views.py

2009-05-20 Thread Alex Gaynor
attributes work is that if something is a class attribute, but you assign to it on an instance the instance gets it's own version of this attribute which "shadows" the classes one. So if Django does something like: status = response.status_code it will just see the objects version, n

Re: Callable objects instead of functions in views.py

2009-05-20 Thread Alex Gaynor
> Your alternatives are cool, but I would like to get a solution as > general as (in practical sense) possible. > > -- > Filip Gruszczyński > > > > Take a look at this: http://code.djangoproject.com/ticket/6735#comment:37snippet which ac

Re: Creating a custom form from models, problems when ordering

2009-05-20 Thread Alex Gaynor
On Wed, May 20, 2009 at 10:34 AM, ccsakuweb wrote: > > Sorry, I forgot to tell it, I use the 1.0.2 version > > On 19 mayo, 23:41, Alex Gaynor wrote: > > On Tue, May 19, 2009 at 2:53 PM, ccsakuweb wrote: > > > > > I have a form from a model. I add 3 new inputs

Re: ModelChoiceField help

2009-05-20 Thread Alex Gaynor
On Wed, May 20, 2009 at 10:38 AM, Bobby Roberts wrote: > > > Take a look at label_from_instance: > http://docs.djangoproject.com/en/dev/ref/forms/fields/#modelchoicefield > > > > Alex > > > > yeah I'm lookin at that but it makes no sense to me. &g

Re: Error notification in admin site. Should be easy!!!

2009-05-20 Thread Alex Gaynor
yset: >if : > self.message_user(request, "OK message") >else: >< here I want to access cl.formset.errors to display > my error messages > > > > Thank you > > On 20 mayo, 16:29, Alex Gaynor wrote: > > O

Re: ModelChoiceField help

2009-05-20 Thread Alex Gaynor
ed_data['page_category_id'] >return data > >def clean_template_id(self): > data=self.cleaned_data['template_id'] >return data > > > > Take a look at label_from_instance: http://docs.dj

Re: Admin interface is slow

2009-05-20 Thread Alex Gaynor
On Wed, May 20, 2009 at 9:31 AM, Skylar Saveland wrote: > > Is this something having to do with pools? > > > Django doesn't pool connections, so unless the original poster is using an external pool, no. Alex -- "I disapprove of what you say, but I will defend to the d

Re: Error notification in admin site. Should be easy!!!

2009-05-20 Thread Alex Gaynor
en't figured out how to do it > yet > > Has anybody found a workaround for this? > > Thank you > > > Django doesn't use the user.message_set for displaying those errors. It just uses this: http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/templates/ad

Re: Callable objects instead of functions in views.py

2009-05-20 Thread Alex Gaynor
; http://www.screeley.com/entries/2009/apr/01/class-based-views-and-reusable-apps/ > > It's a useful technique, I think. > > > One thing to keep in mind is that the object is shared across all requests in that process, so you can't actually store state on your object. Alex -

Re: Formwizard with inlines

2009-05-19 Thread Alex Gaynor
msets are a subclass of formsets. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law."--Cicero --~--~-~--~~~---~--~~ You received this message becau

Re: Raises Http404 from Middleware?

2009-05-19 Thread Alex Gaynor
a 404 page from middleware? > > Thanks! > > > No, this is a known bug in Django: http://code.djangoproject.com/ticket/6094 Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "T

Re: Creating a custom form from models, problems when ordering

2009-05-19 Thread Alex Gaynor
nputs too? Or the solution is > only to create a form without inheritance from a model? > > I hope you understand me. Sorry because my simple english. > > > > What version of Django are you running? Ordering fields is only supported in the latest development version. Alex --

Re: ForeignKeyRawId widget contains incorrect link when you click on search gif?

2009-05-19 Thread Alex Gaynor
t; first in case I am missing something. > > > > I can't recreate this with either the alpha or current trunk level (don't > > have beta set up to test easily at the moment). I tried both the 1.0 > style > > of urlpattern

Re: HTML works directly in browser, but not in DJango... Why???

2009-05-19 Thread Alex Gaynor
uot; > name="wimpybutton288" align="middle" allowScriptAccess="sameDomain" > type="application/x-shockwave-flash" pluginspage="http:// > www.macromedia.com/go/getflashplayer" /> > > > > > The browser probably isn't

Re: http://127.0.0.1:8000/admin/admin/logout/ (duplicate admin)

2009-05-19 Thread Alex Gaynor
on the admin page, but when I log out it is logging out > > > with two admin/admin and I get an error page not found. I cannot > > > figure out why this is happening? > > > Thx > > > > > > > Yep, the patch on there should *just work* after you apply

Re: upload_to usage

2009-05-19 Thread Alex Rades
On Tue, May 12, 2009 at 1:02 PM, Alex Gaynor wrote: > The reason the model isn't saved at thie point is because Django stores the > path to the file in the DB.  This means it has to know the path to the file > in order to save it.  However, you want it to save it in order to c

Re: additional data on ManyToManyField and symmetrical

2009-05-19 Thread Alex Rades
On Mon, May 18, 2009 at 2:13 AM, Russell Keith-Magee wrote: > When you have a symmetrical m2m relation to self, Django needs to > store 2 rows in the m2m table to fully represent the relation - that > is, when you store a 'friendship' between Alice and Bob, Django stores > the relationship (alic

Re: ForeignKeyRawId widget contains incorrect link when you click on search gif?

2009-05-19 Thread Alex Gaynor
r admin and 1.1 (including > admin.site.urls). Which are you using? Perhaps more details on the > specifics of your admin configuration would shed some light. > > Karen > > > > There was a bug similar to this when using raw_id from the change_list view with list_editable, howev

Re: Many-to-one relations on the "one" side admin form

2009-05-18 Thread Alex Gaynor
n form... is it possible? > > Thanks! > > __ > Diogo Baeder > http://www.diogobaeder.com.br > > > > Take a look at inlines in the admin: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodeladmin-objects Alex -- "I disapprove of

Re: how to identify if fix for ticket 7028 is in trunk?

2009-05-18 Thread Alex Gaynor
latest patch should be ready for a committer to commit the patch, and it needs no more work. In practice the patch may or may not actually need work, but that's the purpose of the flag. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Vo

Re: Dojo widgets inside Django

2009-05-18 Thread Alex Gaynor
On Mon, May 18, 2009 at 2:04 PM, Guri wrote: > > Hi, > Is there are way to use Dojo widgets inside Django forms.py? > > Any package, pointers or procedure will help. > > Thanks In Advance > ~Guri > > > http://code.google.com/p/dojango/ aims to do just

Re: parsing data from fileupload

2009-05-17 Thread Alex Gaynor
Site:http://apsl.net > > > Getting an instance of a FileName and accessing .title on it will give you a file like object you can work with normally and extract whatever information you want from it. I'm not 100% sure I understand your question. Alex -- "I disapprove of wha

Re: What's the recommended way to use ForeignKey?

2009-05-17 Thread Alex Gaynor
models.Model): >manufacturer = models.ForeignKey(Manufacturer) > > > > The generally reccomended way to use it is to always import the module, except in the case where a circular reference would prevent you from doing so. Alex -- "I disapprove of what you say, but I will

Re: dictsort / regroup - custom order?

2009-05-17 Thread Alex Gaynor
just uses the default ordering of the key you provide, if you want some other ordering the best way to do it would probably be to write a custom template tag/filter. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people

Re: has_add_permission() isn't working properly

2009-05-17 Thread Alex Gaynor
er() method to get that since it's not a part of the forms library. The best you could do is to pass it the widget constructor, which will be ok because of how we use the widgets in the admin, which will require a little bit of re-architecting. Alex -- "I disapprove of what you say, b

Re: How do I override the __unicode__ of User?

2009-05-17 Thread Alex Gaynor
/topics/db/models/#proxy-models if you're on the latest development version. Otherwise I'd just add a method to your model to print the user formatted as you'd like. Alex -- "I disapprove of what you say, but I will defend to the death your r

Re: ModelForm not respecting "exclude" - what am I doing wrong?

2009-05-17 Thread Alex Gaynor
On Sun, May 17, 2009 at 12:38 PM, ringemup wrote: > > > Aha. I'm on 1.0. Can I still use custom validation on the ModelForm > if I use the ModelAdmin to exclude the fields? > > Thank you! > > > On May 17, 1:36 pm, Alex Gaynor wrote: > > On Sun, May

Re: ModelForm not respecting "exclude" - what am I doing wrong?

2009-05-17 Thread Alex Gaynor
lude = ('blog', 'slug') > > class EntryAdmin(admin.ModelAdmin): >form = EntryForm > > admin.register(Entry, EntryAdmin) > > > What version of Django are you using? Django only respects the exclude and field options from the form in the latest developmen

Re: Help required to generate a query

2009-05-17 Thread Alex Gaynor
ge | dom | > +-+-+ > | 18 | 1 | > | 19 | 1 | > | 20 | 1 | > | 18 | 1 | > +-+-+ > > Thanks for your time. > > Regards, > Lokesh > > > > > For the first one you want: Model.objects.values_list('age', flat=True).distinct

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Alex Gaynor
On Sun, May 17, 2009 at 11:24 AM, Lokesh wrote: > > Hi Alex, > > Then I can go ahead with required=false attribute to avoid form > validation and validation should be taken care by program. > Correct me if I am wrong. > > Regards, > Lokesh > > &g

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Alex Gaynor
choices and pass it to the > > form etc. Can someone out there lend me a hand? I'd like the options > > on the form to be checkboxes. > > > If you're using choices you really should use a ChoiceField as it will validate that the selections is one of the desired choice

Re: Form trouble

2009-05-17 Thread Alex Gaynor
t; > > > > > > > > Thanks. :) > > Alan > > > Specifically tuple's are immutable arrays. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law."

Re: quickest way to print template names

2009-05-16 Thread Alex Gaynor
On Sat, May 16, 2009 at 11:14 PM, mickey wrote: > > Ok this doesn't sound too intuitive. If anyone else have a better > solution please do post. > > Thanks. > > On May 16, 8:01 pm, Alex Gaynor wrote: > > On Sat, May 16, 2009 at 9:57 PM, mickey wrote: > > &

Re: quickest way to print template names

2009-05-16 Thread Alex Gaynor
name and put it into the context dictionary. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law."--Cicero --~--~-~--~~~---~--~~ You received this me

Re: Filtering contrib.comments on related object property?

2009-05-16 Thread Alex Gaynor
_for_model(Entry), > > > object_pk__in=Entry.objects.filter(category="some category")). > > > Err yeah, the syntax I used will only work in 1.1, and might not even work then depending no how your DB handles int/string types (in PgSQL it won't work if your object has

Re: What data structure to use, and how?

2009-05-16 Thread Alex Gaynor
e' values in the django > template? > > Many thanks in advance. > > Jon > > > > You can do: {% for server, data in status_table.iteritems %} {{ server }}: {{ data.0 }}, {{ data.1 }} {% endfor %} Which prints as: somehost: yes, 2 remotehost: yes, 1 localhost:

Re: Filtering contrib.comments on related object property?

2009-05-16 Thread Alex Gaynor
by storing a primary key and a content type, and those aren't really relational database concepts, however you can do something like this: Comment.objects.filter(content_type=ContentType.objects.get_for_model(Entry), object_pk__in=Entry.objects.filter(category="some category")). Alex

Re: Form trouble

2009-05-16 Thread Alex Gaynor
terForm' object has no attribute 'email' > > Exception Location: /home/projects/tst/authprof/views.py in > regattempt, line 47 > > line 47 is the p = tuser(so-on and so-forth > > If anyone can explain

Re: referencing the object id from clean validation methods

2009-05-16 Thread Alex Gaynor
req = self.cleaned_data['storage_required'] >obj_id = ? > > btw I am using gae but this shouldn't affect this I think. > > Thanks guys > > Simon > > > self.instance will be the current object, and therefore self.instances.pkwill be that object

Re: quickest way to print template names

2009-05-16 Thread Alex Gaynor
ontext unless you specifically pass it in. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law."--Cicero --~--~-~--~~~---~--~~ You received this mess

Re: Why getting message object not iterable?

2009-05-16 Thread Alex Gaynor
as using others methods returns a QuerySet. A single object is just that, one object, whereas a QuerySet is a group of objects, so you need to know which one you have to know how to work with it. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it.&q

Re: how to refer a foreign key to a non primary column from other model

2009-05-16 Thread Alex Gaynor
t; > > Is it possible to create a foreign key to a model referring to a > non > > > > > primary column from other model. > > > > > > > class details(models.Model): > > > > > username = > > > > > > > ?? ->

Re: how to refer a foreign key to a non primary column from other model

2009-05-16 Thread Alex Gaynor
foreign key to username > column which is from auth_user table. > > Thanks in advance. > > Regards, > Lokesh > > > > You can do this using the "to_field" option as documented here: http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models

Re: Ordering a query by comments connected to model

2009-05-16 Thread Alex Gaynor
underlying Query > to > > allow support for additional conditions on a join clause). > > Alex, thanks for your comment. > However, this code works for me with Django 1.1 beta1 (rev10793). > I understand that one should not rely on undocumented behaviour, but > does this case

Re: About forms.ChoiceField()

2009-05-16 Thread Alex
Thanks for reply, Jim. Hmm, just saved full page to disk. Almost the same time... now i think it's just cost of transferring of big select box. I'll make it a bit smaller. Gzip will help me I think) Thanks again. On May 16, 4:44 pm, Jim wrote: > > I have made a small form, only 10 fields. But

additional data on ManyToManyField and symmetrical

2009-05-16 Thread Alex Rades
Hi, I have a model which looks like: class Person(models.Model): friends = models.ManyToManyField("self", through="Friendship") class Friendship(models.Model): person_a = models.ForeignKey(Person) person_b = models.ForeignKey(Person, related_name="_unused_") Now, as mentioned in: htt

About forms.ChoiceField()

2009-05-16 Thread Alex
Hello all! First of all sorry for my bad english:) I have made a small form, only 10 fields. But now I see that page loads more than two times slower! I found problem in this field: age = forms.ChoiceField(required=True, choices=AGE_CHOICES, initial='18') without this field page loads much fast

Re: Trying to access admin but getting AttributeError: 'NoneType' object has no attribute 'cursor'

2009-05-15 Thread Alex Gaynor
)) > > > > AttributeError: 'NoneType' object has no attribute 'cursor' > > > > running syncdb works fine and updates my database. > > > I don't believe you are correctly running r10790, as that code no longer exists in it, this was a bug fixe

Re: Ordering a query by comments connected to model

2009-05-15 Thread Alex Gaynor
="object_pk") > > However, denormalization would still be better in most cases. > > > Any aggregation over generic relations is currently unsupported, it was hoped this would make it into 1.1, but unfortunately some of the way SQL works prevented this (since it requires us t

About forms.ChoiceField()

2009-05-15 Thread Alex
Hello all! First of all sorry for my english. I have made a small form, just 10 fields. now I see that page loads much slower then without this form... I found problem in this part of form: age = forms.ChoiceField(required=True, choices=AGE_CHOICES, initial='18') without this field page loads

Re: abstract classes in models

2009-05-15 Thread Alex Gaynor
On Fri, May 15, 2009 at 1:38 PM, Rusty Greer wrote: > > > On Fri, May 15, 2009 at 10:10 AM, Alex Gaynor wrote: > >> >> >> On Fri, May 15, 2009 at 12:08 PM, Rusty Greer wrote: >> >>> >>> >>> On Fri, May 15, 2009 at 9:57 AM, Geor

Re: Ordering a query by comments connected to model

2009-05-15 Thread Alex Gaynor
gt; How do I order a query by comments connected to a model? > > -Martin > > > If you are using the latest development version you can do this using aggregates: http://docs.djangoproject.com/en/dev/topics/db/aggregation/#order-by Alex -- "I disapprove of what you say, but I will defe

Re: ForeignKey with null=True

2009-05-15 Thread Alex Gaynor
On Fri, May 15, 2009 at 12:11 PM, aa56280 wrote: > > So to be clear then, yes, I want to delete the object from the > database entirely. How to go about doing that using location_set? > > On May 15, 12:07 pm, Alex Gaynor wrote: > > On Fri, May 15, 2009 at 12:04 PM, aa56280

Re: abstract classes in models

2009-05-15 Thread Alex Gaynor
y what is expected > > from python code, class1.abstractthing_set.all gives me an AttributeError > > 'class1' object has no attribute 'abstractthing_set' > > > class1.thingtype1_set.all returns exactly what is expected > > i was hoping that the abstr

Re: ForeignKey with null=True

2009-05-15 Thread Alex Gaynor
eign key isn't nullable the only option is to actually delete the object, which isn't exactly the same as what you specifified (since its destructive). Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's

Re: get current logged user from manager

2009-05-15 Thread Alex Gaynor
the currently logged in user there, you'll need to pass it in from the view. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law."--Cicero --~--~-~--~~~

Re: has date template filter been fixed?

2009-05-14 Thread Alex Gaynor
gt; > Using 1.0. Has this been fixed? > > > This was fixed in the 1.1 development branch and the 1.0.X devel branch. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law.

Re: Aggregation of field properties?

2009-05-13 Thread Alex Gaynor
t; and I'm getting what I expect. But I just hit a roadblock with the > size, since it is an attribute of file_system_object. > > Can I aggregate over a field property? > > Best regards, > Carlos. > > > > No, since the size isn't stored in the database you n

Re: Using a subset of a queryset in a template

2009-05-13 Thread Alex Koshelev
On Wed, May 13, 2009 at 2:56 PM, Alex Rades wrote: > > Hi, > in one of my templates I'd like to show the last images taken from > a queryset. So the equivalent of: > > images.all()[:5] > > in a template. > Is there a simple way to do this? Do i need a templa

Using a subset of a queryset in a template

2009-05-13 Thread Alex Rades
Hi, in one of my templates I'd like to show the last images taken from a queryset. So the equivalent of: images.all()[:5] in a template. Is there a simple way to do this? Do i need a templatetag? --~--~-~--~~~---~--~~ You received this message because you are su

Re: I/O operation on closed file

2009-05-12 Thread Alex Gaynor
/django-trunk/django/db/models/fields/files.py", > line > 239, in save > self._dimensions_cache = get_image_dimensions(content) > > File "/home/mybandsite/django-trunk/django/core/files/images.py", line 39, > in > get_image_dimensions >data = file.re

Re: How do you handle apostrophe and spaces in dynamic url?

2009-05-12 Thread Alex Gaynor
is to have a seperate slug field, Django's SlugField for models serves to fill this exact purpose, it can only be used in conjuction with the prepopulated_fields ModelAdmin option. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --V

Re: how can I modify automatic ordering of fields in a ModelForm?

2009-05-12 Thread Alex Gaynor
ModelAdmin form factory pattern is a pretty good one to follow. > > -- > George > > > > You can control the order of fields on a modelform by settings the ordering in the fields option in the inner Meta class. That is if you set fields = ['b', 'a', 'c&#

Re: How do I handle urls with different names?

2009-05-12 Thread Alex Gaynor
ct=type) > > If my table has 1000s of pets, isn't the above a bit slow when > compared to the retrieving a pet by id? How is this kind of situation > handle in some of the Django web application out there? > > On May 11, 11:00 pm, Mike Ramirez wrote: > > On M

Re: exclude subquery executed twice?

2009-05-12 Thread Alex Gaynor
ll do it in a few minutes if no one still has), but AFAICT the issue is here: http://code.djangoproject.com/browser/django/trunk/django/db/models/sql/query.py#L1622 with the if not value triggering the issue. It's probably solvable by changing that to if (not hasattr(value, 'as_sql') and n

<    3   4   5   6   7   8   9   10   11   12   >