Re: Passing variables from Django to Javascript after page load

2009-02-22 Thread Alex Gaynor
f choice parse this response into some datastructure you can use. For the Django view end you can use standard python libraries such as simplejson to create the response(Django includes a recent version of this), and in JavaScript you can use your favorite library to take the JSON and create a JS

Re: Conditional Logic in Template Loop

2009-02-22 Thread Alex Gaynor
there > a non-hackish way to accomplish this with the default language? > > Regards, > Chris > > > Easies way would just be to have 2 seperate if statements(using {% ifequal %} for the second one) and either and and {% include %} so you don't duplicate all the HTML. Alex

Re: Conditional Logic in Template Loop

2009-02-22 Thread Alex Gaynor
there > a non-hackish way to accomplish this with the default language? > > Regards, > Chris > > > You've now sent this message 3 times, you're want to either calm down or fix your mail client :). Alex -- "I disapprove of what you say, but I will defend to the d

Re: 'tuple' object has no attribute 'has_header'

2009-02-22 Thread Alex Gaynor
was working a > while back. I did some cleanup - removing img and .js files that > weren't in use. I've tried to put all that stuff back, but no luck > and this message isn't very informative .. > > Anyway, any hints appreciated. > > margie > > > > > &

Re: Overriding default manager at import-time

2009-02-23 Thread Alex Gaynor
eeded in order to make > the AnyModel?.foreingKey_set working with the new custom manager. > > Is it correct and/or safe ? > > > > It would be far easier for you to just create a single custom manager and then add several methods onto it, instead of having multiple managers. Alex --

Re: Changing the objects manager without affecting the admin interface ?

2009-02-23 Thread Alex Gaynor
en/dev/topics/db/managers/#using-managers-for-related-object-access 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: how to use django ORM in standalone script ?

2009-02-23 Thread Alex Gaynor
dev/howto/custom-management-commands/ has instrutions on how to do this, and you can find a few good blog posts on the ineternet. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire &

Re: select_related() and reverse foreign keys -OR- how to I get a blog post and its comments?

2009-02-23 Thread Alex Gaynor
e a somewhat simple case and there seems to be no > mention of it in the documentation anywhere. > > Sean. > > > > That's not possible, but that doesn't really affect anything, you still have that accessor available to you, but it does an extra SQL query, that is t

Re: select_related() and reverse foreign keys -OR- how to I get a blog post and its comments?

2009-02-23 Thread Alex Gaynor
On Mon, Feb 23, 2009 at 3:49 PM, Torsten Bronger < bron...@physik.rwth-aachen.de> wrote: > > Hallöchen! > > Alex Gaynor writes: > > > On Mon, Feb 23, 2009 at 12:40 PM, sphogan wrote: > > > >> [...] > >> > >> However, select_related()

Re: Not understand help_text

2009-02-23 Thread Alex Gaynor
ee the method behind the > madness > > > > > The as_* methods are really just meant as quick ways to get started and having something to display really quickly, iterating over the form is, IMO, the perfect balance of total control and DRY: http://docs.djangoproject.com/en/dev/topic

Re: select_related() and reverse foreign keys -OR- how to I get a blog post and its comments?

2009-02-23 Thread Alex Gaynor
it couldn't get) so that you'd get an error > message rather than having that error message pass silently. > > Errors should never pass silently. > Unless explicitly silenced. > ~Zen of Python > > Well, I guess I have a project for this week! > Sean. > >

Re: Passing argument to Model.save via ModelForm

2009-02-23 Thread Alex Gaynor
return obj Just add this method to the ModelForm and you're golden. 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: UnicodeEncodeError pb

2009-02-23 Thread Alex Gaynor
x27;utf-8' > in my settings > > Where does the pb come from? I didn't find the answer on this forum. > thx a lot > > Arbi > > > I'm assuming you're on Django 1.0(or newer, if not please let us know), can you paste what exactly your __unicode__

Re: get_absolute_url() and related models

2009-02-23 Thread Alex Gaynor
gt; > > First of all use self.category.slug so that you don't have to do an extra query if the local cache is already populated. Next in places you know this is giong to be an issue when you do your Product query add a call to select_related('category') this will cause Django to pr

Re: get_absolute_url() and related models

2009-02-23 Thread Alex Gaynor
ute_url, you then > have to remember to always use select_related(). > > You could even make that automatic by creating a custom default manager > whose get_query_set() method looked like this: > >def get_query_set(self): > return super(MyManager, >

Re: Securely storing passwords

2009-02-24 Thread Alex Gaynor
advance, > > Mathieu > > > If you're going to need to log into another website that you don't have control over using this password you can do whatever you want to it, but ultimately you need to be able to restore it to it's plaintext format, which means you can'

Re: Not understand help_text

2009-02-24 Thread Alex Gaynor
(and other as_xxx > methods). > > > > similar changes would be needed for as_ul() and as_table() > > > There's already a ticket for this exact item: http://code.djangoproject.com/ticket/8426 so don't file another one :) . However if you want this now feel free to

Re: linking to files from database

2009-02-24 Thread Alex Gaynor
This just takes a path, > rather than a file object. See: > http://docs.djangoproject.com/en/dev/ref/models/fields/#filepathfield > -- > DR. > > > If you want to reference an existing file what you want to do is just obj.file_field = "file/location.txt" That just a

Re: Unusual Schema question

2009-02-24 Thread Alex Gaynor
gt; proj1.app1.models? I know I could just use dir(), but that gives me > other stuff beyond just the models defined just within that file. > > Jay > > -- > Jay Deiman > > \033:wq! > > > > Note that the following uses what is technically an internal: from django.db

Re: Beginners question

2009-02-25 Thread Alex Gaynor
hnique for doing this are template tags, either regular ones or inclusion tags, James Bennet wrote an excellent blog post on the subject: http://www.b-list.org/weblog/2006/jun/07/django-tips-write-better-template-tags/ Alex -- "I disapprove of what you say, but I will defend to t

Re: Managing over 100 static booleanfield fields Model, Form Class and so on. Profiles process

2009-02-25 Thread Alex Gaynor
hope you are :) ) it's just a matter of using a MultipleModelChoiceField with a CheckboxSelectMultiple widget, which does exactly what you want(assuming you set it up as a many to many field). Alex -- "I disapprove of what you say, but I will defend to the death your right to say it.&qu

Re: Searching a list of Q

2009-02-25 Thread Alex Gaynor
oo", u"Bar"]: > if qset is None: > qset = Q(author__iexact=each) > else: > qset = qset | Q(author__iexact=each) > > > > > You can clean it up slightly, but that strategy is basically what you want to do: qset = Q() for term in ['

Re: Searching a list of Q

2009-02-25 Thread Alex Gaynor
qset is None: > > qset = Q(author__iexact=each) > > else: > > qset = qset | Q(author__iexact=each) > > > Kevin, the way IN works at the SQL level basically means that it will be doing an exact match against each item, which isn't what he want

Re: Passing argument to Model.save via ModelForm

2009-02-25 Thread Alex Gaynor
t. Thanks! > > > > On Feb 23, 5:51 pm, Alex Gaynor wrote: > > > > > On Mon, Feb 23, 2009 at 5:40 PM, bretro...@gmail.com < > bretro...@gmail.com>wrote: > > > > > > Hello, > > > > > > I'd like to send an email when

Re: avoiding a save when the form contains no new data

2009-02-25 Thread Alex Gaynor
flects what they've done, or not done. IE, "book foo updated' or > "book foo unchanged". > > Anyway, just curious if others have encountered this. > > Margie > > > Form's have a method "has_changed" which says whether or not there is chan

Re: Modifying the default admin edit page for Sites

2009-02-25 Thread Alex Gaynor
old model admin, use admin.site.unregister(Site) to remove the old one, create you're own subclass of the current one and register it like normal, presto! Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." -

Re: Problems specifying fields for admin inline

2009-02-25 Thread Alex Gaynor
> admin.site.register(Site, SiteAdminMod) > > > > > Drop the formset = bit and simply provide fields = ['order'] in the InlineModelAdmin definition. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "

Re: get translated text from ugettext_lazy() result

2009-02-26 Thread Alex Gaynor
.py > @register.simple_tag > def show_webstore_user_ratings(user_ratings): >A = RATING_CHOICES[user_ratings] >return A[1] > > > > Perhaps you're looking for this method: http://docs.djangoproject.com/en/dev/ref/models/instances/#get-foo-display Alex -- "I disapprove of wha

Re: Docstring documentation

2009-02-26 Thread Alex Gaynor
ng the docutils module and the __doc__ attribute on functions, you can see how it occurs here: http://code.djangoproject.com/browser/django/trunk/django/contrib/admindocs/views.py Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire &qu

Re: Queryset Caching

2009-02-26 Thread Alex Gaynor
object, it's not any sort of global, cross request cache. 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 --~--~-~--~~~---~--~~ Y

Re: Queryset Caching

2009-02-26 Thread Alex Gaynor
On Thu, Feb 26, 2009 at 6:26 PM, Jason Broyles wrote: > > Thanks for the reply. I was talking about using memcache to cache the > view. If a search changes, will it get the cache or hit the database? > > On Feb 26, 6:11 pm, Alex Gaynor wrote: > > On Thu, Feb 26, 2009 at 6

Re: DEFAULT_FILE_STORAGE settings conflict

2009-02-26 Thread Alex Gaynor
ings cannot be imported, because > environment variable %s is undefined." % ENVIRONMENT_VARIABLE) > ImportError: Settings cannot be imported, because environment variable > DJANGO_SETTINGS_MODULE is undefined. > > Somebody help? > > > > That's probably because D

Re: Customizing HTML

2009-02-26 Thread Alex Gaynor
d also substitute > my own. > > Jack Orenstein > > > > > The best way to do HTML rendering of forms(IMO) is by simply iterating over the fields: http://docs.djangoproject.com/en/dev/topics/forms/#looping-over-the-form-s-fields. In my experience

Re: Customizing HTML

2009-02-26 Thread Alex Gaynor
On Thu, Feb 26, 2009 at 9:56 PM, Jack Orenstein wrote: > > On Feb 26, 2009, at 9:44 PM, Alex Gaynor wrote: > > > On Thu, Feb 26, 2009 at 9:42 PM, Jack Orenstein > > wrote: > > > > Suggestion: Instead of hardwiring formatting into Django, allow > > attribut

Re: Customizing HTML

2009-02-26 Thread Alex Gaynor
On Thu, Feb 26, 2009 at 10:10 PM, Jack Orenstein wrote: > > On Feb 26, 2009, at 10:04 PM, Alex Gaynor wrote: > > > > > > > On Thu, Feb 26, 2009 at 9:56 PM, Jack Orenstein > > wrote: > > > > > > > value="m" name="gender&quo

Re: reverse question

2009-02-26 Thread Alex Gaynor
f reverse. > > I'm using modpython, django 1.0.2 and python 2.5.2. > > Thanks > > > Unfortunately reverse raises stupid error message, it tries prepending your project name to the search if the original lookup fails, so the error message doesn't usually look correct. U

Re: calling a view from within a view

2009-02-26 Thread Alex Gaynor
ks in advance > > > > > You just call it, views are normal python functions, that being said it is often better to redirect where possible(or sensible). Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people

Re: Manually parsing a URL and returning the view name and args

2009-02-27 Thread Alex Koshelev
Of course within `reverse` function there is `resolve` function that parses path and return view function, positional arguments, and named arguments. On Fri, Feb 27, 2009 at 2:33 PM, Andrew Ingram wrote: > > Hi All, > > I'm trying to to build a model which can store a link to any page on > the s

Re: Undocumented comment setting

2009-02-27 Thread Alex Gaynor
tirely of swear words. > > . > > Some days you think you've heard everything. Then someone comes along > and proves you wrong. :-) > > Yours, > Russ Magee %-) > > > > Feel free to build your own profanities list though(lord knows Django's is pretty arbitr

Re: populate a form from database and show all item fields in a template

2009-02-27 Thread Alex Gaynor
On 2/27/09, MarcoS wrote: > > Hi! wondering if someone could point me in the right > direction with this one: > > I'm trying to populate fields in a form with data from database: > i.e. suppose I've this model: > Try using a multiplemodelchoice field with a check

Re: Initializing a variable for each request

2009-02-27 Thread Alex Gaynor
ier solution. > > > You say it needs to be in each view, but if it's just something to put at the top of each page then where you really need it is in the template right? So it sounds like you want a template context processor. Alex -- "I disapprove of what you say, but I will

Re: django query question

2009-02-27 Thread Alex Gaynor
On Fri, Feb 27, 2009 at 2:40 PM, Bobby Roberts wrote: > > hi all. I have a situation where I have two tables, auctions and > bids. I need to do a subquery as such: > > select distinct id from auctions_auction where Active=1 and id IN > (select distinct AuctionId_id from auctions_bid where Bidde

Re: Obtaining URL for an Admin page

2009-02-27 Thread Alex Gaynor
. Thanks in advance! > > > > Paul > > > > FYI, here is what I am doing now: > > return HttpResponseRedirect('/admin/invoice/invoice/%s/' % object_id) > > This works, but pretty ugly... > > > > If you are on 1.0

Re: select_related + annotate = bug?

2009-02-27 Thread Alex Gaynor
chetype.classname. > > If I remove select_related(), it works like I expect it should, except > that now the db is hit a bunch of extra times each time through the > loop. If I remove annotate(), it also works. > > Has anyone else

Re: Fixtures with custom constructor

2009-02-28 Thread Alex Gaynor
jango source(which will cause it to break for other models) it's not going to magically work with your new signature. If you could provide your modified __init__ we could give some suggestions as to how to make the signature compatible. Alex -- "I disapprove of what you say, but I wi

Re: Fixtures with custom constructor

2009-02-28 Thread Alex Gaynor
str(user.id), user.email, ip])) > self.sha = sha1 > self.user = user > > > Vitaly Babiy > > > On Sat, Feb 28, 2009 at 3:41 PM, Alex Gaynor wrote: > >> >> >> On Sat, Feb 28, 2009 at 3:38 PM, Vitaly Babiy wrote: >> >>> I have a model th

Re: djWarehouse setting up

2009-03-01 Thread Alex Gaynor
e! > Justin > > > > I don't have experience with it, but you may also want to checkout Satchmo: http://satchmoproject.com/trac/timeline it has a great reputation, and very good docs. Alex -- "I disapprove of what you say, but I will defend to the death your

Re: Using Admin Datepicker in Other Apps

2009-03-01 Thread Alex Gaynor
On Sun, Mar 1, 2009 at 10:25 PM, Chris wrote: > > On Feb 21, 10:03 am, Alex Gaynor wrote: > > On Sat, Feb 21, 2009 at 7:48 AM, Chris wrote: > > > > > Is it a good idea to reuse admin's JS datepicker widget in other apps, > > > and if so,

Re: admin templates problem

2009-03-01 Thread Alex Gaynor
min template? Do you > not see your custom version? Or you don't see anything? > > Regards, > Malcolm > > > > > > The index.html is only for the index page, perhaps you meant to overide base.html or base_site.html? Alex -- "I disapprove of what you

Re: How to compare two different types in templates using ifequal

2009-03-02 Thread Alex Koshelev
Just now {% ifequal %} doesn't support filter expressions as arguments. So you must prepare values by {% with %} tag before using them in {% ifequal %}. On Mon, Mar 2, 2009 at 12:22 PM, eli wrote: > > Hi, > > I have a problem: > > Python: > week = [1, 2, 3, 4, 5, 6, 7] > # There are only two re

Re: how to create a registration with the UserCreationForm fields and an optional email field?

2009-03-02 Thread Alex Gaynor
> registerResponse5 = UserCreationFormExtended(request.POST) > > if registerResponse1.is_valid() and registerResponse5.is_valid(): > userObject = registerResponse1.save(commit = False) > userObject.email = registerResponse5 -> how can i access the > email field value?

Re: Forms with dynamic *fields*

2009-03-02 Thread Alex Gaynor
> > 5 super(MyForm, self).__init__(*args, **kw) > > > > What is the correct syntax for line 4? Is this even possible? > > > > Martin > > > I reccomend you read this post: http://www.b-list.org/weblog/2008/nov/09/dynamic-forms/ Alex -- "I d

Re: ModelMultipleChoiceField

2009-03-02 Thread Alex Gaynor
u'9']}> > > It seems that POST is ok, but cannot process it > > ¿any help? > > > by default subscriping on a QueryDict object gives only the first item, so you want request.POST.getlist('titulos'). Alex -- "I disapprove of what you say, but I will defend to

Re: Help with Singletons

2009-03-02 Thread Alex Gaynor
he best way to handle something like this is with a real caching system that is seperate from your python processes, specifically memcache. Checkout the Django caching docs for how to use it with Django. Alex -- "I disapprove of what you say, but I will defend to the death your right to say i

Re: filter with respect to single attribute does not work properly

2009-03-02 Thread Alex Gaynor
7;mnem': 2}. To fix this you want to seperate it into 2 filter calls filter(mnem=1).filter(mnem=2). But that still probably doesn't do what you want, since you can't have a field which has 2 values at once, therefore I'm guessing you want to OR them together, http://docs.djangopr

Re: filter with respect to single attribute does not work properly

2009-03-02 Thread Alex Gaynor
On Mon, Mar 2, 2009 at 2:56 PM, limas wrote: > > thank you Alex for your valuable reply. > but i am still not able to find out the solution. > i tried this: > dataobj=DataValue.objects.filter(Q(file=file.id)|Q(mnem=1)|Q(mnem=2)) > but it is not working fine. it is returning ev

Re: Admin Pages - want horizontal scroll ability

2009-03-02 Thread Alex Gaynor
roject.com/browser/django/trunk/django/contrib/admin/media/css/base.css#L623 To lower that you'll probably need to write some of your own CSS to make it play nice. FWIW it may just be that you have some really long strings being displayed in certain places since I don't notice any issues on m

Re: Admin Pages - want horizontal scroll ability

2009-03-02 Thread Alex Gaynor
On Mon, Mar 2, 2009 at 3:23 PM, Peter Bailey wrote: > > Yeah, I have big objects in tables. Sigh, was hoping to avoid writing > more css, but thought it might come down to that. > > Thanks Alex. > > > On Mar 2, 3:09 pm, Alex Gaynor wrote: > > On Mon, Mar 2,

Re: Django not deleting files still referenced by ImageField

2009-03-02 Thread Alex Gaynor
gt; > > Yep, here's the code that makes it handle: http://code.djangoproject.com/browser/django/trunk/django/db/models/fields/files.py#L195this get's registered as a post_delete signal on any model that has a filefield. Alex -- "I disapprove of what you say, but I will defend to the d

Re: Help w/ installing admin on 1.0.2 on MAC OS 10.4

2009-03-02 Thread Alex Gaynor
lve > 179. for pattern in self.urlconf_module.urlpatterns: > File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ > site-packages/django/core/urlresolvers.py" in _get_urlconf_module > 198. self._urlconf_module = __import__ > (self.url

Re: Why do some shared hosting providers support Django and others don't?

2009-03-02 Thread Alex Gaynor
e providing. The one thing I can say is it defintely can be done, look at someone like webfaction, they have full mod_wsgi and Django support, and even guarnteed RAM numbers for something like $10 a month. Alex -- "I disapprove of what you say, but I will defend to the death your right to sa

Re: Why do some shared hosting providers support Django and others don't?

2009-03-02 Thread Alex Gaynor
a response back in some form. Using Django isn't hugely different from that, except you're mostly using Django's provided stuff, it's WSGI interface, it's URL routing, it's ORM, it's template, instead of using(for example) WebOb, routes, sql alchemy, and Jinja. Ale

Re: Django bilingual web site

2009-03-02 Thread Alex Gaynor
it manually by just putting 2 fields for each "field" one for each language. 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: newbie problem -- import django fails

2009-03-02 Thread Alex Gaynor
thon prompt. Any command prefixed with >>> means it needs to be executed in a python shell. The reason you can't do django-admin.py is because it's not on your PATH, someone more familiar with windows could tell you how to alter that, but for now you can get to it by providing

Re: Why do some shared hosting providers support Django and others don't?

2009-03-02 Thread Alex Gaynor
or reviews of Django hosts, that being said they don't have anything on MochaHost. 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: newbie problem -- import django fails

2009-03-02 Thread Alex Gaynor
or any help you can provide. > kkaste > > On Mar 2, 5:24 pm, Alex Gaynor wrote: > > On Mon, Mar 2, 2009 at 8:20 PM, kkaste wrote: > > > > > I followed the instructions for installing django. Apparently this was > > > successful because I have a folder named

Re: Why do some shared hosting providers support Django and others don't?

2009-03-02 Thread Alex Gaynor
sily work a dollar to me. 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 because you a

Re: Generating dynamic csv data

2009-03-03 Thread Alex Gaynor
ew to the csv_view otherwise. > > Thanks in advance for any insight on this issue. > > ~G > > > > What you want to do is abstract the machinery that creates the queryset into a seperate function, that way you can take the GET vars in both functions and get a queryset from them. F

Re: Ignore Case Sensitive Property

2009-03-03 Thread Alex Gaynor
the Django > documentation - using the search box helpfully provided on every page > - for the word 'insensitive' provided the correct syntax as the top > result. > -- > DR. > > > You probably want icontains actually, since your original query was contains.

Re: Using BaseInlineFormSet with customized form

2009-03-03 Thread Alex Gaynor
eriences ? > > Koen > > > > AFAIK the intention was always to eventually have a metaclass so it looked more like model forms, but the usecase wasn't as strong, and no one who wanted it ever wrote any code AFAIK Alex -- "I disapprove of what you say, but I will defend to t

Re: template error

2009-03-03 Thread Alex Robbins
It looks like your problem is probably on line 2. The {% comment_form_target %} tag is trying to do a reverse url lookup. However, there aren't any matches in your url conf. Hopefully, you just forgot to set up a url for post_comment. Unfortunately, what that usually means for me is that there is

Re: template blocks inside include?

2009-03-03 Thread Alex Robbins
blem yourself during that testing. Sorry I didn't have a quick answer, hope that helps. Alex On Mar 2, 5:41 pm, Roy wrote: > *bump* anyone have any idea on this? > > On Mar 1, 9:17 pm, Roy wrote: > > > Hi group, > > > Say I have the ff in my base.html: > >

Re: Aggregating Ignores Slicing?

2009-03-03 Thread Alex Gaynor
his an improper use of aggregation, or am I doing something wrong > with my query? > > > Before an aggregation is preformed all limits are removed, so you are seeing expected behavior. I can't remember why this behavior exists though :/ Alex -- "I disapprove of what you say,

Re: ManyToOne : cannot form a proper query :(

2009-03-03 Thread Alex Gaynor
d by John and Paul (not only by John > and only by Paul). Who this could be done and who could this be done > with a Q-object (in one query)? > > > > I suggest you start by taking a look at this section of the docs: http://docs.djangoproject.com/en/dev/topics/db/queries/#spanning-mu

Re: Aggregating Ignores Slicing?

2009-03-03 Thread Alex Gaynor
use aggregation and let the database find the > maximum and minimum for me, but that doesn't work as Alex said. > > On Mar 3, 10:08 am, Alex Gaynor wrote: > > On Tue, Mar 3, 2009 at 8:55 AM, Ross wrote: > > > > > I have started using aggregation, but it seems to ignor

Re: Aggregating Ignores Slicing?

2009-03-03 Thread Alex Gaynor
, > which, > > > > unless you're using GROUP, is going to be 1. To do what you want, > > > > you'd need a subselect, which (correct me if I'm wrong,) you'd have > to > > > > manually write in SQL. Like so: > > > > > > select sum(

Re: Trouble overriding UserAdmin

2009-03-03 Thread Alex Gaynor
; TIA, > Brandon > > > The not registered problem is probably because you have your user profile application before django.contrib.auth in the installed apps list in your settings, simply switch these around to fix that. The next thing you want to do is make sure your new user admi

Re: Trouble overriding UserAdmin

2009-03-03 Thread Alex Gaynor
On Tue, Mar 3, 2009 at 12:54 PM, Alex Gaynor wrote: > > > On Tue, Mar 3, 2009 at 12:41 PM, Brandon Taylor > wrote: > >> >> Hi everyone, >> >> Not sure what's up here, the same code works on another site. >> Basically what I'm doing is

Re: Generating dynamic csv data

2009-03-03 Thread Alex Gaynor
a project to do > > something similar here:http://github.com/alex/django-filter/tree/master > > Thanks for the response, can you point me to the app you are referring > to? > > > It's linked in my message: http://github.com/alex/django-filter/tree/master Alex -- &qu

Re: form object created with empty _meta

2009-03-03 Thread Alex Gaynor
Yaniv > > > You haven't pasted your form class itself, so we can't well say what's not correct. Please give us your form class so we have something to work with. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltair

Re: form object created with empty _meta

2009-03-03 Thread Alex Gaynor
= forms.CharField(label=_("Password"), > widget=forms.PasswordInput) >password2 = forms.CharField(label=_("Confirm Password"), > widget=forms.PasswordInput) >tos = forms.BooleanField(widget=forms.CheckboxInput(), > label=_(u&#x

Re: form object created with empty _meta

2009-03-03 Thread Alex Gaynor
es someone have experience with ModelForm in GAE? > > Thanks, Yaniv > > > You've now sent this message 3 times, either your mail program has a bug, or please be patient :) Alex -- "I disapprove of what you say, but I will defend to the de

Re: session vars or User in templatetags

2009-03-03 Thread Alex Gaynor
gt; > > You need to pass request.user.id to the templatetag, nothing automatically has access to the current user or the current request. 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 high

Re: session vars or User in templatetags

2009-03-03 Thread Alex Gaynor
nd get the assertion error, it prints au.id, not the > value of au.id > > what am i doing wrong? > > > > http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#passing-template-variables-to-the-tag Alex -- "I disapprove of what you say, but I will defend to the deat

Re: Using variables with object.filters

2009-03-03 Thread Alex Gaynor
o this ? > > > > > > You can do it using the python kwarg syntax: Ship.objects.filter(**{field: value}). You want to make sure you sanitze field so that the user can't filter against something you don't want though. Alex -- "I disapprove of what you say, but I will defe

Re: never_cache and firefox

2009-03-03 Thread Alex Gaynor
gt; > "Use Javascript to clear the cache or some other trick" - Relying on > JS being active is like relying on users. > > So, is this a feature waiting to be developed? Or is there a way to > make it work right with the existing code? > > > > > > The most obviou

Re: reason for working on a copy of POST object

2009-03-03 Thread Alex Gaynor
eference kinda thing? > > Cheers, > Ishwor > The reason for making a copy is that by default the POST object isn't mutable, that is you can't change the values of it's keys, so if you'd like to change something in order to alter parts of it you'll need to ma

Re: Aggregating Ignores Slicing?

2009-03-04 Thread Alex Gaynor
this, but if this works... > > > But that requires actually pulling in all the records, not a big deal when it's 100, but if it's more, and network latency is an issue you don't want to do that. Plus I don't think negative slicing works in SQL. Alex -- "I disapprove o

Re: Accessing the development server from another machine.

2009-03-04 Thread Alex Gaynor
never gets the request. I'm not > running any firewall. Is there some other setting somewhere that allows the > development server to serve up requests to external browsers? > > > > > Try running the server at 0:8000 this tells it to serve requests to all hosts

Re: DB Queries of unusual size

2009-03-04 Thread Alex Gaynor
ny queries, and 50+ would usually five me pause however the question is always is it fast enough. And if it is there is mo reason to worry. If it isn't you get to sit down and do some profiling. Alex --~--~-~--~~~---~--~~ You received this message because y

Re: multiple primary key, solution?

2009-03-04 Thread Alex Gaynor
ou do this you guys? I really > need multiple keys... > > thx > > Arbi > > > The ticket for composite ok support in django(373) has yet to be resolved. The last work on it was done by David cramer and is I believe available on github. That being said to my knowledge no p

Re: Overriding the HTML id in ModelForm

2009-03-04 Thread Alex Gaynor
lass B(models.Model): >> amount = models.IntegerField() >> >> >> class AForm(ModelForm): >> class Meta: >>model = A >> >> class BForm(ModelForm): >> class Meta: >>model = B >> >> Conflict of ids when forms printed:

Re: Possible bug in admin?

2009-03-04 Thread Alex Gaynor
e the email field is bizarrely small (it doesn't have > the 'vTextField' class)... > return super(MyModelAdmin, self).formfield_for_dbfield > (db_field, **kwargs) > > Thanks a lot, > > Julien > > > It's a suckasding issue. There is a ticke

Re: Possible bug in admin?

2009-03-04 Thread Alex Gaynor
On Mar 4, 2009, at 10:33 PM, Julien Phalip wrote: > > On Mar 5, 2:16 pm, Alex Gaynor wrote: >> On 3/4/09, Julien Phalip wrote: >>> Hi, >> >>> I can't find the exact cause of this, but it seems as though >>> something >>> ha

Re: how to display and update the same form? wait online

2009-03-05 Thread Alex Gaynor
rofile) > return HttpResponseRedirect('%sdone/' % request.path) > > else: > myuser = User.objects.get(username = request.user) > profile = Profile.objects.get(user=myuser) > form = ChangePersonalInfo() > > context = Request

Re: manage.py test doesn't run tests

2009-03-05 Thread Alex Gaynor
I run > > manage.py test app1.TestCase1.test1 , it runs fine. For some reason > > django is unable to find app tests. I have all the apps in > > INSTALLED_APPS. What am I missing? > > > > Thanks, > > saeb > > > Does your application have a models.py file

Re: Self Join using QuerySet

2009-03-05 Thread Alex Gaynor
b ON a.created_on <= b.created_on > > WHERE a.object_id = 1 > > GROUP BY 1 > > > > Which finds the sums for votes before the datetime of each vote. > > > The real question is what question are you trying to answer with your query, it may be possible with t

Re: newbie with django-tagging problem

2009-03-05 Thread Alex Gaynor
t; > > If you are using Django 1.0 or newer you can't use the latest release of django-tagging, you need to use an SVN checkout. 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 hig

Re: count and group by aggregation

2009-03-06 Thread Alex Koshelev
Try this: R.objects.values('type').aggregate(Count('type')) On Fri, Mar 6, 2009 at 10:12 PM, kbs wrote: > > Hello, > > I got a model with a type field > > > class R(mode): >type = CharField(max_length=100) > > > Here is what im trying to do using sql notation: > > > SELECT typ,count(*)

Re: manage.py dumpdata app.model doesn't seem to work?

2009-03-06 Thread Alex Koshelev
This `dumpdata` command you can only serialize whole application not just its models. On Fri, Mar 6, 2009 at 11:17 PM, John M wrote: > > I tried using the command > > $ python manage.py dumpdata app.model. > > where app is the name of my application and model is one of it's > models, I didn't a

<    1   2   3   4   5   6   7   8   9   10   >