Re: Django Server performance

2009-07-07 Thread Alex Gaynor
the advices... > > Also what is the realistic number of page views/ simultaneous connections > that a Nehalem quad core Intel i-7 920, 8 GB RAM machine can handle? Any > statistical experiences. > > Thanks > > -- > Ramdas S > > > > > > Though scaling is

Re: Caching query results and ManyToMany relationships

2009-07-08 Thread Alex Gaynor
that pulls in the queryset and caches it on the model and always use that instead of teh default manager, that way when you cache the obj if it has a local cache it will be stored. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire &

Re: Circular imports problem

2009-07-08 Thread Alex Gaynor
els.py and that leads to a circular import. What > is the best way to solve this problem? > > Cheers, > Ryan > > > Depending on how you're using these other models you can a) do imports inside of functions, or b) http://docs.djangoproject.com/en/dev/ref/models/fields/#lazy-rela

Re: any ideas about "load testing" django apps?

2009-07-08 Thread Alex Gaynor
On Wed, Jul 8, 2009 at 3:52 PM, happyb787 wrote: > > Any ideas about load testing django apps? JMeter? Ab? > > Please advise. thanks! > > > > You'd use the same tools you use for any other HTTP application, I've heard good things about Ab and Siege. Alex

Re: Make three columns without violating DRY

2009-07-09 Thread Alex Gaynor
On Thu, Jul 9, 2009 at 4:49 PM, Wiiboy wrote: > > The columns are actually categories. The left column is sports, etc. > So I can't make it a grid like that. > > I don't quite see how the paginator helps. > > > Why not just make it a list of tuples, so [('left', [list_of_left cats]), ('right',

Re: Add extra field to ModelForm

2009-07-11 Thread Alex Gaynor
define a Field on the ModelForm in the same way you would on a regular Form and it will get added to the Form. 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 limit the maximum selection from MultipleChoiceField from forms?

2009-07-12 Thread Alex Gaynor
On Sun, Jul 12, 2009 at 12:35 PM, Lokesh wrote: > > Hi, > > forms.py > education = forms.MultipleChoiceField(choices=education_filler > (education_list)) > > In one of my forms I have the field to select multiple options for > education. I am able to populate all the choices and also multi > sele

Re: creating user directories upon account activation

2009-07-13 Thread Alex Robbins
ep. (Pdb is a little cryptic at first, but well worth the time to learn it.) Hope that helps, Alex 1 http://docs.python.org/library/pdb.html On Jul 12, 11:34 pm, neridaj wrote: > moved os import to the top and got rid of try except, with no change. > >         if SHA1_RE.search(activ

Re: Unhandled Exception when stopping database engine

2009-07-13 Thread Alex Gaynor
e queries being executed during middleware and Django currently doesn't catch exceptions that are thrown from middleware. This is the subject of ticket 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.

Re: Constraining LEFT OUTER JOIN with aggregates?

2009-07-13 Thread Alex Gaynor
ase is fairly obvious; any > suggestions on how this kind of query could be cleanly represented in > Django's ORM syntax are welcome. > > Yours, > Russ Magee %-) > > > > Unless I've missed something the behavior you've described is what the default behavior shou

Re: unittest DB questions

2009-07-13 Thread Alex Gaynor
hawn > > > > If you set your DATABASE_ENGINE to be sqlite3 and leave TEST_DATABASE_NAME blank it will automatically use an in memory sqlite db. The best way to do this would be to just maintain 2 settings files, with one of them inheriting the defaults from the other by means o

Re: Predefined models like tree,sortable_set

2009-07-13 Thread Alex Gaynor
; adding, moving,deleting nodes etc. Is this somehow possible in Django? > > > > In Python you'd just use inheritance or some sort of registration pattern. Take a look at django-treebeard and django-mptt for how they implement these things. Alex -- "I disapprove of what you sa

Re: QuerySet rendering

2009-07-13 Thread Alex Gaynor
have a module named django-filter that does the filtering aspect of this (similar to the list_filter aspect of the admin), but has no default rendering. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it.

Re: inheriting Model more than once

2009-07-14 Thread Alex Gaynor
;" > > from django.db import models > > class A(models.Model): >a = models.CharField(max_length=100) >class Meta: >abstract = True > > class B(A): pass > class C(A): pass > > class D(B): pass > class E(B,C): pass > > > > >

Re: Question regarding post_save signal and ManyToMany field objects

2009-07-14 Thread Alex Gaynor
ow to get this feature is to use an intermediary model which obviously get's its own signals. Additionally I've been working on refactoring m2ms to always use an intermediary model, thus signals would always be sent. Alex -- "I disapprove of what you say, but I will defend to th

Re: Deployment dilemma

2009-07-14 Thread Alex Gaynor
ve problem. > > --rama > > > > > > > > Take a look at PIP and it's requirement file system, which I think for python packages is a good solution. If you have OS level dependencies (such as the stuff GIS relies on) you'll probably need to see what tools your packa

Re: Import all modelspy from all apps

2009-07-14 Thread Alex Gaynor
ding import cache cache.get_apps() will returns the models.py modules for all your apps. 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 "Code can always be

Re: dict objects are unhashable in admin... in this a bug?

2009-07-14 Thread Alex Gaynor
lp_text|safe }}{% endif %} > 15 > > > Can you paste the admin.py file or other code for the app that's giving you this error? Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." -- Voltaire "The people'

Re: Slug Field

2009-07-14 Thread Alex Gaynor
> in slug field in admin site. > > Can anybody throw some light on this? > > Thanks in advance, > Sonal. > > > The slug will only be automatically populated when you are adding records from the admin. Any other method of entry will not have the slug field automatically p

Re: tagging question about django-tagging

2009-07-15 Thread Alex Gaynor
roject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objectsexplains how to do queries with OR clauses. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." -- Voltaire "The people's good

Re: accessing multiple dbs?

2009-07-15 Thread Alex Gaynor
and what I posted seems to > > work to an extent, but I am currently having some m2m field problems > > (not problems with foreign keys though), so what I posted may be > > flawed. > > > > Alex G is working on getting proper support added to django for google > > summer

PyOhio - Python Regional Conference

2009-07-15 Thread Alex Gaynor
). For further general sprint information you can go to: http://www.pyohio.org/Sprints/ Hope to see you there! 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 &q

Re: PyOhio - Python Regional Conference

2009-07-15 Thread Alex Gaynor
On Wed, Jul 15, 2009 at 12:56 PM, Fred Chevitarese wrote: > Record this !!! And put on Youtube for us!!! Whe´re in Brazil!!! > > Thanks! ;) > > 2009/7/15 Alex Gaynor >> >> PyOhio: >> Dates: 25th - 26th July >> More info: http://www.pyohio.org/Home >&g

Re: New to unit testing, need advice

2009-07-16 Thread Alex Robbins
manager method to make sure it was selecting the right stuff. (Not a mutating operation, but it is model-related) Hope that helps, Alex [1] http://docs.djangoproject.com/en/dev/topics/db/managers/#topics-db-managers On Jul 16, 4:27 am, Joshua Russo wrote: > > besides the testing issues (whi

Re: Dict objects are unhashable errors

2009-07-16 Thread Alex Koshelev
'object_detail', info_dict, > {'template': 'diamond_detail.html'}), > Please read url patterns docs [1] and answer to yourself - why you have 2 dicts in one pattern? [1]: http://docs.djangoproject.com/en/dev/topics/http/urls/#patterns --- Alex Koshelev --~--~

Re: model name ending with an 's'

2009-07-17 Thread Alex Gaynor
me plural to control that: http://docs.djangoproject.com/en/dev/ref/models/options/#verbose-name 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

Re: Row-specific user permissions

2009-07-18 Thread Alex Gaynor
lication just to > incorporate the feature? > (Which, by the way, is a must for any collaborative online > publication.) > > Thanks to all who have thought about the same problem. > > > Take a look at this: http://www.b-list.org/weblog/2008/dec/24/admin/ Alex -- "

Re: newbie questions: common components in django

2009-07-18 Thread Alex Gaynor
d to pass data footer.html and header.html every > time i include these pages? > > > Thanks > > > Check the docs for information on template context processors or inclusion template tags. Either of those is a perfect solution to common data needed on every page. Alex -- &quo

Re: A question about reverse url lookups for admin site in svn version

2009-07-19 Thread Alex Gaynor
> Thanks. >> >> > Tryreverse('admin:index ') >> > The colon is the new namespaces that were just added to the django >> > urlresolvers. Pretty exciting, huh? >> > FYI the admin uses 'admin' as the default app instance. I am not sure what >> > this will

Re: Django, MySQL - bug?

2009-07-19 Thread Alex Gaynor
1: > > print "all()[0].id=", TestModel.objects.all()[0].id > > -- > Tomasz Zieliński > http://pyconsultant.eu > > > I believe this is just a shortcoming of either MySQL, or MySQLDb, in that it can't return the ID of an inserted object. Alex -- "I

Re: Foreign key triggered some redundant SQL queries

2009-07-19 Thread Alex Gaynor
sing something here? > > Thanks. > > -- > Regards. > -Tian > > > > Try doing item.bar_id. Doing item.bar causes Django to load up the bar object, but if all you want is the id you can use "bar_id". Alex -- "I disapprove of what you say, but I wil

Re: Using Django's Cache

2009-07-19 Thread Alex Gaynor
> from the server again.  The txt files are just list so there is > nothing about security, but they are just very long. > > thanks > > > There is no way to access a users temporary files. Django's cache system is exclusively on the backend. Alex -- "I disapprove of

Re: A simple use for multidb... is this possible yet?

2009-07-19 Thread Alex Gaynor
hould easily be able to do what you want, check the docs the multiple_database regression tests for a sense of the API. (Remember to use the soc2009/multidb branch, not the old multi-db one). Alex -- "I disapprove of what you say, but I will defend to the death your right to say it."

Re: Change default queryset in admin for a model

2009-07-19 Thread Alex Gaynor
d with no additional fields >> > > specified shows up in the parent model's admin page listing.  I was >> > > going to exploit this to make a dummy subclass of the model superclass >> > > with a different list_display and reg

Re: Redundant SQL queries regarding DELETE ALL

2009-07-19 Thread Alex Gaynor
ich means doing some pure python processing. However, I believe that last SELECT query should be able to be optimized out, so I'm going to look into removing it. Alex -- "I disapprove of what you say, but I will defend to the death your rig

Re: Redundant SQL queries regarding DELETE ALL

2009-07-20 Thread Alex Gaynor
On Mon, Jul 20, 2009 at 1:10 AM, aXqd wrote: > > On Mon, Jul 20, 2009 at 12:00 PM, Alex Gaynor wrote: >> >> On Sun, Jul 19, 2009 at 9:51 PM, aXqd wrote: >>> >>> Hi, all: >>> >>> I encountered another redundant SQL query problem while using dja

Re: combining valueslistqueryset with a simple list

2009-07-20 Thread Alex Gaynor
one named extend and it should work fine. a = ['user'] a.extend(valuelist_queryset) print a ['user', ...] Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." -- Voltaire "The

Re: where does this slug come from?

2009-07-20 Thread Alex Koshelev
es me. > > Any suggestions? > > T > > Look at the html code itself not browser's status line output. --- Alex Koshelev --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group.

Re: coercing to Unicode: need string or buffer, Post found

2009-07-20 Thread Alex Gaynor
ost). This will return the unicode coersion of the comment_post, which is presumabley what you were intending. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." -- Voltaire "The people'

Re: OR in query_set

2009-07-21 Thread Alex Gaynor
oject.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 is the highest law." -- Cicero &

Re: middleware cache problem

2009-07-22 Thread Alex Robbins
story_list), context_instance=RequestContext(request) Also, you might just to temple level caching.[2] Finally, if you aren't having performance issues yet, maybe don't worry about caching. (Premature optimization and all that...) Hope that helps, Alex [1]http://docs.djangoproje

Re: Use an arbitrary changelist

2009-07-22 Thread Alex Gaynor
ide the queryset() method on it to return your filtered queryset. 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 &q

Re: Django-admin {{ root_path }} problem !

2009-07-22 Thread Alex Gaynor
Did you by any chance copy the text of the old templates, from before the rc? If so you'll need to update them for thr changes. Alex On Jul 23, 2009 12:35 AM, "Dr.Hamza Mousa" wrote: Hello Thanks Russ for the fast reply , The url for the admin is the same as the defa

Re: Slugs, why would you ever need to store one in the database?

2009-07-24 Thread Alex Robbins
You might want to look into the SlugField [1]. It makes sure you only have url friendly stuff. You can also autopopulate it from another field in the admin[2]. That way you just type the title and it makes a slug for you. One reason to hide pks is that they allow people to learn more about your s

Re: Where are the admin app icons from?

2009-07-24 Thread Alex Gaynor
for where those came from? > > Margie > > > > I don't know where the Django ones came from (they may have been custom designed for all I know), but if you're looking for good free icons I'm quite fond of the famfamfam silk icon set: http://www.famfamfam.com/lab/icons

Re: Database connection closed after each request?

2009-07-24 Thread Alex Gaynor
tional 150ms latency resulting from non- persistent DB connection is huge - it implies almost 30% fewer customer orders. And it has nothing to do with traffic." I'd just like to take a moment to point out that that simply *cannot* be, else the only logical conclusion would be that .5s of

Full-text search: what to use

2009-07-27 Thread alex finn
Python process". I found some links in the internet saying that sphinx can not handle non-ascii character sets well which is critical for me. Whoosh seems to be a little amateur - did not see any links on real world usage. Did you try one of these options? Or do you know any other so

Re: iterating through user.groups

2009-07-27 Thread Alex Gaynor
ManyRelatedManager' object >      is not iterable" > > The same if I put the code inside my view (for group in user.groups:) > > any idea? > > Regards > Salvatore > > > > > > > > user.groups is a manager, if you want a queryset of all the items i

Re: Prefetch user profiles

2009-07-27 Thread Alex Gaynor
f directly > modifying the User model in contrib.auth? > > -- Andrew > > > This isn't currently possible and is the subject of ticket 7270. 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: best way to format serialized data?

2009-07-28 Thread Alex Robbins
time(non- ajax), using {% if request.is_ajax %} to control what comes through for ajax[2]. I know that is a departure from the standard json response to ajax calls, but then I don't have to do templating in my javascript, which grosses me out. Hope that helps, Alex [1] http://docs.jquery.com

Re: Fatal Python error: Inconsistent interned string state.

2009-07-28 Thread Alex Robbins
You mentioned that it just happens sometimes, and I see from your traceback it happened in the autoreload.py file. Do you still see the errors if you call runserver --noreload ? Alex On Jul 27, 3:57 pm, Ken Schwencke wrote: > I'm working with GeoDjango and PostGIS, and I'm g

Re: I just need some feedback and advice about my project layout and design.

2009-07-28 Thread Alex Robbins
list display for your root url[2] inside the app. [1] http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-list-detail-object-detail [2] http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-list-detail-object-list Hope that helps, Alex On Jul 27,

Re: Full-text search: what to use

2009-07-28 Thread alex finn
Thanks for your replies, it is useful. Has anyone used whoosh in production so far? Any ideas about it's performance? Alex. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group.

Re: Error - got an unexpected keyword argument 'instance' on initialising form

2009-07-28 Thread Alex Gaynor
'/css/jquery-ui.css','/css/smoothness/jquery- > ui-1.7.2.custom.css') } > >    class Meta : >        model = Task > > ??? Is it something obvious again? > > > > It looks like you intended to use a ModelForm, but instead inherited from Form, ch

Re: Possible to add to a queryset?

2009-07-28 Thread Alex Gaynor
You ca use the | operator o querysets themselves. So qser | model.objects.filter(id__i=[1,2,3]) Alex On Jul 28, 2009 3:49 PM, "Margie" wrote: Is it possible to add to a queryset? Say I have a Book model and qset is an existing queryset of books. If I want to create a new que

Re: Simple Pagination Problem

2009-07-29 Thread Alex Gaynor
t; On Jul 29, 3:44 pm, krylatij wrote: >> >> > > Read >> > > documentationhttp://www.djangoproject.com/documentation/models/pagination/ > > > {{ page.paginator.count }} should be exactly what you want. Al

Re: Query builder or report builder

2009-07-29 Thread Alex Gaynor
ut building a user-friendly interface seems > to be the most challenging part, and I'm hoping jquery will fill this > void. > > I'm very interested to hear what anyone else thinks of this concept. > > Regards, > > Mike Kimmick > > > > I've written an

Re:

2009-07-29 Thread Alex Gaynor
s there a > generally accepted strategy that others are using? > > Margie > > > Margie > > > > The way I do it is what you allude to at the end, have a special class on the inputs and then use the inner Media class of the widget (http://docs.djangoproject.com/en/dev/topi

Re: Can I have custom validation in the admin change_list form when using ModelAdmin.list_editable?

2009-07-29 Thread Alex Gaynor
/browser/django/trunk/django/contrib/admin/options.py#L350 can be used to provide custom forms. 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 "Code can alway

Re: Query builder or report builder

2009-07-29 Thread Alex Gaynor
On Wed, Jul 29, 2009 at 7:36 PM, mike wrote: > >> I've written an app called django-filter which seems like it may be >> what you want:http://github.com/alex/django-filter/tree/master. >> Here's an example of it in use with a ticketing >> appliation:

Re: sqlite error: Encrypted or Not a Database

2009-07-29 Thread Alex Gaynor
File encrypted or not a database." How can I > access the database outside of Django? > > > > It may be that your command line SQLite version isn't the same as the one Django uses. Try using the sqlite3 command line program. Alex -- "I disapprove of what you say

Re: Application Template on top of Django

2009-07-30 Thread Alex Gaynor
at I don't need to build it from scratch? > > Thank you. > > > > > django.contrib.auth provides almost all the functionality you've suggested out of the box: http://docs.djangoproject.com/en/dev/topics/auth/ http://www.djangobook.com/en/2.0/chapter14/ Alex -- "I disapprove of wh

Re: Template links when Django not domain root

2009-07-30 Thread Alex Koshelev
://docs.djangoproject.com/en/dev/ref/settings/#force-script-name --- Alex Koshelev On Thu, Jul 30, 2009 at 10:55 PM, Streamweaver wrote: > > I have a django project that has worked just fine in development but > I'm trying to move it to a demo site and the application is not on a > root dom

Re: odd behavior with session variable that contains a list

2009-07-31 Thread Alex Gaynor
ing request.SESSION['key'].append() uses the __getitem__ method on request.SESSION and calls append on the result, whereas doing request.SESSION['key'] = val uses the __setitem__ method. http://docs.djangoproject.com/en/dev/topics/http/sessions/#when-sessions-are-saved describes how to work w

Re: forward declaration

2009-07-31 Thread Alex Gaynor
*** > I got this error message: > AssertionError: ManyToManyField( stammbaum.bloodline.models.Parent at 0x84fc11c>) is invalid. First > parameter to ManyToManyField must be either a model, a model name, or > the string 's

Re: Python Conditional help

2009-08-01 Thread Alex Gaynor
4, 9, ' >> elif: student_id_validate == stu_id:\n')) >> >> Exception Location:     C:\dantest\..\dantest\urls.py in , line 3 >> Python Executable:      C:\Python26\python.exe >> Python Version:         2.6.2 >> Python Path:    ['C:\\dantest', &#

Re: UserProfile and select_related

2009-08-03 Thread Alex Gaynor
ce attributes > via > >        obj.user.username > > where "obj" is now a UserProfile instance. > > Regards, > Malcolm > > > > > It's worth noting that the ability to do this is the subject of ticket 7270: http://code.djangoproject.com/ticket/7

Re: Date/time field styling?

2009-08-03 Thread Alex Gaynor
dgets (all the output is done by > the widgets, so it's nicely encapsulated). > > Search around before doing that, however. I have a vague feeling that > somebody might have started a project like this, but I haven't ever used > it. > > Regards, > Malcolm > > &

Re: Adding errors

2009-08-04 Thread Alex Gaynor
ot exist or wrong password > > What am I doing wrong? > > > > > > > > Do ErrorList(["User does"]). Alex -- "I disapprove of what you say, but I will defend to the death your right to say it."

Re: Unit test failing with 302 instead of 200, using Django's TestCase class

2009-08-04 Thread Alex Gaynor
  'subsets': subsets, >                               'parameters': list, >                               'num_files': num_files, >                               'fcs_list': fcs_list, >                               'subset_header':

Re: Intermediate Table question

2009-08-04 Thread Alex Gaynor
x27;) > > Will this validate and actually work? > > > I don't believe it would work, but even if it did, what would this do? What's the expecected behavior? Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." -- Vo

Re: 'RelatedManager' object is not iterable

2009-08-04 Thread Alex Gaynor
mpression that the output from obkects.all() was > iterable? > > I would appreciate any help anyone can give. > > Thanks > > > > It is, you've done something, either in your template or in your models that's somehow causing the issue. If you could show us those

Re: model upload_to

2009-08-04 Thread Alex Gaynor
works great if I just want to change the filename but I can't > change folder. > > So what am I doing wrong? > > Stefan > > > > > > > > You needed to do self.the_file. In python member variables aren't automatically accessible, you have to get them

Re: Intermediate Table question

2009-08-04 Thread Alex Gaynor
t > > I'd like to store all the ordering info in one intermediate table > while maintaining different tables for the porducts > > Lee > > > Bah, this is what I get for reading too quickly. The answer is maybe, you'd have to try it. I see no obvious reason it wouldn&

Re: is it possible to do a monkey patch on django.contrib.atuh.models.User to make the email field unique?

2009-08-04 Thread Alex Koshelev
Hi, Vasil! `Field.unique` is the read only property. If you want to set uniqueness you have to assign field's `_unique` attribute to True. --- Alex Koshelev On Wed, Aug 5, 2009 at 12:54 AM, Vasil Vangelovski wrote: > > Having this line of code: > > User._meta.get_field(&#

Re: Can i rise 404 from my middleware ?

2009-08-04 Thread Alex Gaynor
= > urlparse.urlsplit(request.META['HTTP_HOST'])[2].split('.') >                        request.subdomain = bits[0] >                else: >                        raise Http404 > > -- > Mirat Can Bayrak > > > > Right now there is a bug in django's middleware where it doesn&

Re: Searchform with pagination and GET parameters - easy solution needed

2009-08-05 Thread Alex Gaynor
:project, 'form':form, > 'newurl':newurl} >    ) > >    return response > > template.html > > > {% extends 'base.html' %} > {% load i18n %} > > {% block content %} > > {% trans "Browse Measurands" %} ({% trans &qu

Re: Have I found a bug? Deletion and rolled back transactions

2009-08-05 Thread Alex Gaynor
s or with sqlite) I get this >> assertion error: >> >> Traceback (most recent call last): >> ... >> AssertionError: 3 >> >> If someone more clued up than me could take a look at this and confirm >> that it is a Django bug I can start looking int

Re: python md5

2009-08-06 Thread Alex Gaynor
ed > > > Thanks > > > You can call the hexdigest() method on the md5 object to get a string of the hash. 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: access to REQUEST_URI ?

2009-08-06 Thread Alex Koshelev
Hi, Rebecca! Try to use request's `get_full_path` [1] method. It's environment independent and produces full path string with query. [1]: http://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.get_full_path --- Alex Koshelev On Fri, Aug 7, 2009 at 1:37 A

Re: Bug with model get_*_display() methods?

2009-08-08 Thread Alex Gaynor
hen I >> > moved to a different db? >> >> Actually, my SQLite observation was entirely bogus. I suspect what >> you're seeing is the difference between these two lines: >> >>         t1 = Task.objects.create(status=u'3') >>         t2 = Task

Re: Sum for each day? aggregate / annotate

2009-08-08 Thread Alex Gaynor
don't provide a way to work with dates that easily, however I think this task might be accomplishable with a custom Aggregate object, search the mailng list for more information on creating these. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it.&

Re: DeprecationWarning - How can I fix this?

2009-08-08 Thread Alex Gaynor
eprecation warning, however it will continue to work perfectly fine. 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 "Code can always be simpler than you think,

Re: My ModelAdmin customizations don't work

2009-08-08 Thread Alex Gaynor
>    search_fields = ['name'] > > admin.site.register(University) > > > > Your problem is you registered your Model with the admin without telling it about your custom ModelAdmin class, so it used the default one. The last line should be. admin.site.regist

Re: Custom model field and Django-admin -- error

2009-08-10 Thread Alex Gaynor
7;: 1249911607L}, {'time': 1249911607L}, {'time': > 1249911607L}, ...] >>> > > The same thing happens in the Admin when I specify date_hierarchy in > my ModelAdmin a one of these fields.  Why are the standard accessor > methods (namely 'to_python()')

Re: Dumping Large Databases

2009-08-11 Thread Alex Gaynor
lot more >> efficient and robust. Dumpdata is great for the sweet spot, but it isn't >> designed to completely replace all existing database tools. >> >> Regards, >> Malcolm >> >> >> >> > >> > > > > Unless the majority of

Re: unique_together with None

2009-08-11 Thread Alex Gaynor
t; > > You are talking about in the forms/admin validation correct? Thinking to how this is implemented there likely is a bug where this doesn't use the SQL concept of NULL != NULL and uses the Python None == None instead, which of these behaviors is correct I'm not sure of (though I lean t

Re: Django aggregates and having

2009-08-12 Thread Alex Gaynor
u're getting exactly what you've asked for. Your query contains >> filter(l=2) - that is, you're filtering on l, the SUM. >> >> > How can I force using having when I can't define the param in >> > annotate? >> >> I'm afraid I don&#x

Re: Need help with filter, limit and order_by query

2009-08-12 Thread Alex Gaynor
ew attempts but the > results were as above). > > > Your best bet would be to take the items you want. And do items = list(items) items.reverse() to put them in the correct order in Python, this is going to be easier than mucking around with custom SQL. Alex -- "I dis

Re: mass-updating question

2009-08-13 Thread Alex Gaynor
> > > > If you're using django 1.1 you can use the new F() objects so it'd look like: thread.forums.allparents.update(postcount = F('postcount')+1, lastpost=post) Alex -- "I disapprove of what you say, but I will defend to the death your right to say it.&q

Re: QuerySet's cache

2009-08-16 Thread Alex Gaynor
oes not contain new tag >>>> queryset > [, ] > > # hmm, maybe not?? > > Any help on clarifying this would be greatly appreciated! > > David > > > > The issue here is how __repr__ works on QuerySets, specifically it does repr(list(self[:MAX_REPR_SIZE]

Re: Possible to use Django & MySQL with Python 2.6?

2009-08-16 Thread Alex Gaynor
rkaround I can do to make it work? > > > MySQL works fine for me under Python 2.6, you get a warning when you import it, but that doesn't prevent normal execution, it's just annoying ;) Alex -- "I disapprove of what you say, but I will defend to the death your right

Re: Django model register for admin section

2009-08-18 Thread Alex Gaynor
r way to register all class by single register call  like > this >    admin.site.register(Poll,Choice,Vote) > > with thanks > Ajay > > > Yep, admin.site.register([Model1, Moel2, Model3]) Alex -- "I disapprove of what you say, but I will defend to the death your right to

Re: Problem installing Django 1.1 on XP

2009-08-18 Thread Alex Gaynor
\django\utils\__init__.py", line 1 >    Django-1.1/of the Lawrence Journal-World newspaper in Lawrence, > Kansas. >                           ^ > SyntaxError: invalid syntax > > Any ideas? > > > > Your download got messed up somehow, that content does'nt exi

Re: Why using ForeignKey and not OneToOne to extend the user profile?

2009-08-18 Thread Alex Gaynor
ingle object, I could spare a little > bit of code, if I just write: >>>> "User.objects.get(username='Leon').avatar" > instead of >>>> "u = User.objects.get(username='Leon')" >>>> "UserProfileExtension.objects.get(user=

Re: save a form

2009-08-19 Thread Alex Gaynor
- >> DR. > > > On a validated form the values will be in the dictionary form.cleaned_data 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 la

Re: Bulk data insert

2009-08-20 Thread Alex Gaynor
imagine Django is running INSERT and COMMIT each time?). > > Thanks very much. > > > > Django doesn't currently support any form of bulk insert. Using raw SQL is your best option at this point. Alex -- "I disapprove of what you say, but I will defend to the de

Re: How to get an object knowing its content_type and id?

2009-08-20 Thread Alex Gaynor
types.models import ContentType ct = ContentType.objects.get_for_id(content_type_id) obj = ct.model_class()._default_manager.get(pk=obj_id) 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: How to validate image dimensions?

2009-08-21 Thread Alex Gaynor
rt Image > image = Image.open(img) > if image.size[0] > 64: #image.size is a 2-tuple (width, height) >   ... > Or you could resize it down to 64 px if it is bigger. > TiNo > > > If you call django.core.files.images. get_image_dimensions on the file you'll get back a width, height dim

Re: Trouble getting doctests to execute in app with no model...

2009-08-25 Thread Alex Gaynor
your tests in a tests.py file, however you still need to have an empty models.py file, so Django picks up the app correctly. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." -- Voltaire "The peo

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