Re: formwrappers and manipulators

2006-08-09 Thread Ivan Sagalaev
skullvulture wrote: > Are form wrappers and manipulators only for creating 'change object' > and 'add object' forms? I'm creating a simple form that will have > several drop downs that correspond to fields in the database for one of > my objects, that will serve as a search form. Right now I hav

Re: Partly OT: Authenticating a Script

2006-08-09 Thread Ivan Sagalaev
Paul Sargent wrote: > 3 is reasonably simple, but I want this to have some form of > authorization. Django's normal authorization framework seems rather > awkward, because I'd need my script to go through a login process to > get the right cookie (right?). > > Any other suggestions for authenticat

Re: order_with_respect_to : explanation?

2006-08-11 Thread Ivan Sagalaev
gabor wrote: > i've read the documentation, i checked the group-archives, > but still... i just cannot understand what that setting does. > > could someone explain it to me? I remember me asking the same question some time ago :-) This option creates an invisible field "_order" for manually spe

Re: memcached equivalent in python

2006-08-11 Thread Ivan Sagalaev
a wrote: > is there a memcached equivalent in python If your server is running memcached it can be accessed from other programs including those written in Python. Is this what you mean? If yes, you need a Python library for accessing memcached: ftp://ftp.tummy.com/pub/python-memcached/ Also t

Re: How to make delete() more clever?

2006-08-12 Thread Ivan Sagalaev
一首诗 wrote: > But how can I give some information to user that the delete is not > allowed? > By the codes above, the user just see that the delete was done! This is exactly the case for using exceptions. Define your own exception and raise it where user shouldn't delete an object. Then define a

Re: Converting characteres non-ASCII in the templates

2006-08-13 Thread Ivan Sagalaev
GinTon wrote: > To convert the names to lower or UPPER case in the templates is used {{ > foo.name|lower }} and {{ foo.name|upper }} > > But is possible convert characters non-ASCII? Is there any of use > foo.name.decode('utf-8').upper() in the templates? There is a patch fixing string filters

Re: rewriting urls

2006-08-13 Thread Ivan Sagalaev
a wrote: > http://localhost/todo > > i want to rewrite this automatically as > > http://localhost/todo/ > > is there a easy way to do this Yep. http://www.djangoproject.com/documentation/generic_views/#django-views-generic-simple-redirect-to --~--~-~--~~~---~--~--

Re: Getting properties of parent objects into a template

2006-08-13 Thread Ivan Sagalaev
mediumgrade ÐÉÛÅÔ: > I have a simple blog app that I am working on. In this app, I have > ojects for each entry as well as the author who wrote it. I wrote a > simple view which displays a list of all entrys made, but I want that > list to include the name of the author. Since the author's name i

Re: Creating a "mostly static" site with Django -- dumb idea?

2006-08-15 Thread Ivan Sagalaev
Sean Schertell wrote: > I'd really like to use Django templates and stay DRY by using the > same base template for my static pages as I do for any apps in the > site. But I'm a little bit put-off by the "flatpages" middleware > because it store the content in a database -- seems to complicat

Re: Multiple applications One server Big problem.

2006-08-15 Thread Ivan Sagalaev
Seth Buntin wrote: > When I restart my server, and go to /ncate/manager I get the right > application. But if I log out of that application and go to > /kate/tick/ I get the /ncate/manager application. This will happen > visa-versa. I first go to /kate/tick, logout, go to /ncate/manager and > g

Re: Locking problem with mod_python

2006-08-16 Thread Ivan Sagalaev
Daniel Poelzleithner wrote: > After further investigation, i found out that locking of any kind > doesn't work with apache in prefolk mode, and more or less in the > threaded mode. I haven't found a nice and clean solution yet to do > locking on requests, which worries me a little bit. Locking can

Re: How to build a tree on the page?

2006-08-16 Thread Ivan Sagalaev
Malcolm Tredinnick wrote: > I would also just mention that the simplistic approach (having parent > field) doesn't perform that badly for small structures. For example, I > can construct the whole tree for the tag hierarchy in my blog in only a > few microseconds. For small (say, a few dozen) data

Re: Locking problem with mod_python

2006-08-16 Thread Ivan Sagalaev
Daniel Poelzleithner wrote: > Yes i know. There would be other solutions like shm, or global mutexes, In fact those two don't seem to work for this situation anyway. I was digging this whole field over a month ago and remember that the main problem is that to use anything shared in memory you s

Re: Newbie generic view query

2006-08-19 Thread Ivan Sagalaev
boglet wrote: > So, the only thing that I can think is that generic views require all > fields for a model to be filed in. Is this correct? No, views (generic or custom) has nothing to do with this. This is the effect of validation by automatic manipulators[1] (that incidentally are indeed us

Re: returning related field as part of __str__() method?

2006-08-23 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > I apologize in advance if this is a stupid question - I'm new to > Django, and a little over my head (but loving it!) > > I'm trying to return a field from a foreign key relationship as part of > my __str__ method. When I do, I get this output in the admin interface: >

Re: Saving ManyToMany relationships in custom manipulator

2006-08-23 Thread Ivan Sagalaev
James Mulholland wrote: > temp.set_teams(data['teams']) > temp.save() This looks like 0.91 syntax that was changed in 'magic-removal' process. Now it should look like this: temp = Message(...) temp.save() for id in data['teams']: temp.teams.add(Team(id)) BTW, sav

Re: Application Prefix

2006-08-23 Thread Ivan Sagalaev
Vance Dubberly wrote: > I'm not really the kind guy to hardcode the prefix into all my > templates and so on. There is not yet officially introduced and documented but working feature (The Right Feature!) for making URLs in your templates to automatically point to your views by their current

Re: Saving ManyToMany relationships in custom manipulator

2006-08-23 Thread Ivan Sagalaev
Russell Keith-Magee wrote: > temp = Message(...) > temp.save() > temp.teams = Team.objects.filter(id__in=data['teams']) > > i.e., there is no need to iterate through the data (which isn't really > efficient, since every add is a separate db operation). Instead, you can > assign an iterable to a

Re: Unicode, unicode, more unicode

2006-08-24 Thread Ivan Sagalaev
Victor Ng wrote: > I was wondering if anyone else is using Django to handle a > multi-language site - and what people thought of getting Django to use > unicode strings everywhere. There is an ongoing effort of converting Django to use unicode internally carried out by Gabor. Search django-devel

Re: Unicode, unicode, more unicode

2006-08-25 Thread Ivan Sagalaev
Sean Schertell wrote: > I'm planning to do two large bilingual sites (english/japanese). Does > django's lack of unicode support mean that I won't be able to collect > form data from utf-8 pages? Oh, no this whole conversion is just about convenience. You can do multilingual things in Django

Re: Extracting arguments to web service methods

2006-08-25 Thread Ivan Sagalaev
magus wrote: > Well, the auth module _requires_ the session stuff. Which in this case > is overkill. All I really need is to return a 401 and get a basic > authentication. I've posted some time ago on this list a simple middleware that does HTTP authorization and sets request.user just like stan

Re: Extracting arguments to web service methods

2006-08-25 Thread Ivan Sagalaev
magus wrote: > I'll have to look at it in more detail but it looks close to what I > want. It does leave one thing out though--creating a 401 response if > authentication is missing. Ah... Yes, I have it in another place since I have a mixed authorization. But it's simple to add where it checks

Re: serving static with mod_python and django

2006-08-26 Thread Ivan Sagalaev
Baurzhan Ismagulov wrote: > Hello, > > I have the following lines in /etc/apache2/sites-available/default: > > DocumentRoot /var/www > > Options FollowSymLinks > AllowOverride None > > > Alias /debian/ /mnt/sda1/ibr/debian/ >

Re: Generic views and reverse url lookup?

2006-08-26 Thread Ivan Sagalaev
Petar Marić wrote: > I'm checking out reverse url resolving and I can't help but wonder: > What happenes when we use generic views? Will it still work? Hm... Looks like they wouldn't :-(. This'll require some thinking... --~--~-~--~~~---~--~~ You received this mes

Re: serving static with mod_python and django

2006-08-26 Thread Ivan Sagalaev
Baurzhan Ismagulov wrote: > Hmm, I've converted to /debian> and put it after : > > DocumentRoot /var/www > > Options FollowSymLinks > AllowOverride None > > > > SetHandler python-program > ... >

Re: Migrating my development environment to Django

2006-08-26 Thread Ivan Sagalaev
Matthias Kestenholz wrote: > * How can I create a new FormField? Where can I specify which > FormField to use for a DB field? Inherit your class from django.forms.FormField and at the very least override render() method. Other methods that you might want to override depending on your field ar

Re: Application Prefix

2006-08-26 Thread Ivan Sagalaev
Adrian Holovaty wrote: > Nice, Ivan! I've been meaning to write something like this...Would you > be willing to contribute it to the framework? Sure, as usually :-) Have you are: http://code.djangoproject.com/ticket/2606 I also added a docstring that may be a bit clumsy and wil

Re: Flatpage content with dynamic navigation toolbar - is it possible?

2006-08-27 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > Flatpages are perfect for the about us, contact us, etc. sections of my > site, but my navigation bar needs this category list, and I'd like to > keep it dynamic. If I understand the problem correctly... Flatpages can use your specified template where you can include t

Re: Flatpage content with dynamic navigation toolbar - is it possible?

2006-08-27 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > Yes, that works, but my base.html needs this called in each view to get > the data from the DB: > > category_list = Category.objects.filter(active__exact=1) This is solved by context processors: http://www.djangoproject.com/documentation/templates_python/#subclassing-

Re: python sets and objects returned in queries

2006-08-28 Thread Ivan Sagalaev
Gary Wilson wrote: > Why can't objects be used in python sets? Example: > [u.username for u in User.objects.all()] > ['bar', 'foo', 'foobar'] a = User.objects.filter(username__contains='foo') b = User.objects.filter(username__contains='bar') set.intersection(set(a), set(b))

Re: ManyToManyField not populated in form

2006-08-30 Thread Ivan Sagalaev
cyberco wrote: > In a form for changing a model instance all fields get correctly filled > with existing values except the ManyToManyField form fields (which > renders as a choice list in a form). It shows the correct list of > options, but none of the options is selected, even though the instance

Re: ManyToManyField not populated in form

2006-08-30 Thread Ivan Sagalaev
cyberco wrote: > ==VIEW= > errors = {} > pizza = > new_data = pizza.__dict__ This is why it doesn't work. There is a method in manipulators 'flatten_data' that correctly fills data for ForeignKeys and ManyToMany: manipulator = Pizza.ChangeManipulator(id) # or whatever

Re: ManyToManyField not populated in form

2006-08-30 Thread Ivan Sagalaev
Kenneth Gonsalves wrote: > i always use it, but for some reason it is not in the official docs - > although it is in the wiki Yes this is it: http://code.djangoproject.com/wiki/NewAdminChanges There is also a small point that is easy to miss: on POST one should call do_html2python both when t

Re: mod_python-3.2.10/Apache-2.2.2/FreeBSD/

2006-08-30 Thread Ivan Sagalaev
Wiktor Grębla wrote: > Unfortunately I'm not the admin of this machine, so I'm a bit restricted > in what I can do. The most general question comes to mind: do you have > similar working configuration? I also have a FreeBSD machine with Apache 2.2 but never tried to install mod_python since fo

Re: Redirect from button event?

2006-08-31 Thread Ivan Sagalaev
Russell Keith-Magee wrote: > Can you make the button an inside a action="myurl" method="post">, where myurl is either: I would say GET here is better instead of POST. Because it's not changing anything. --~--~-~--~~~---~--~~ You received this message because yo

Re: mod_python-3.2.10/Apache-2.2.2/FreeBSD/

2006-08-31 Thread Ivan Sagalaev
Wiktor Grębla wrote: > I have lighttpd+fastcgi configuration on the same host, but apache + > mod_python looked like a good idea (for a change). Interesting I've just made as switch in other direction :-). Lighty+FastCGI just takes less memory... --~--~-~--~~~---~--

Re: django - fastcgi - flup

2006-09-14 Thread Ivan Sagalaev
Picio wrote: > Hello, > I have a very cheap and small home webserver that uses lighttpd + fastcgi. > I've read http://www.djangoproject.com/documentation/fastcgi/ > but I don't understand how to install and use "flup". This is a Python library that you can get here: http://www.saddi.com/software

Re: django - fastcgi - flup

2006-09-14 Thread Ivan Sagalaev
Picio wrote: > Thanks Ivan, just done the install. > Is there a quick way to verify it's ok or do I have just to finish to > read the doc at > http://www.djangoproject.com/documentation/fastcgi/ ? The usual thing for any python library: go to python prompt and run 'impo

Re: __str__ question

2006-09-14 Thread Ivan Sagalaev
Patrick J. Anderson wrote: > class ExchangeRate(models.Model): > company = ForeignKey(Company) > source = ForeignKey(Currency, related_name = 'source') > destination = ForeignKey(Currency, related_name = 'destination') > rate = FloatField(max_digits = 10, decimal_places = 2) >

Re: Charfield maxlength (bug?)

2006-09-18 Thread Ivan Sagalaev
Malcolm Tredinnick wrote: > If I had to guess, I would say this has to do with encoding. When the > form is submitted back to the web server, the content will be encoded > as, say, UTF-8. The length of your input string as bytes is longer than > 10 (since each of those characters is 2 bytes in UT

Re: success: django + fastcgi (flup) + nginx

2005-12-16 Thread Ivan Fedorov
Igor Goryachev пишет: > Hello everybody. > > It seems, I have got a success with django application running under > FastCGI (flup) and nginx web-server. There were no difficults, thanks > to Hugo! :) Anyway I will try to write a small howto this weekend. > I'm start using it some weeks ago. Wor

Re: user information on website

2005-12-19 Thread Ivan Fedorov
patrick kranzlmüller пишет: > > thanks, "context = Context( request )" was the key. The REAL key was "from django.core.extensions import DjangoContext as Context" You must use DjangoContext instead of Context.

Re: Bulk delete?

2006-01-14 Thread Ivan Fedorov
Kenneth Gonsalves пишет: On Saturday 14 Jan 2006 1:11 am, Jacob Kaplan-Moss wrote: Have I overlooked something? Nope - *we've* overlooked something; this totally should be possible. I've opened a ticket so we can keep track of this (http:// code.djangoproject.com/ticket/1219). and, wh

Re: modifying DEFAULT_RESULTS_PER_PAGE

2006-01-29 Thread Ivan Fedorov
Chris Leonello пишет: Is there anyway to change the MAX_SHOW_ALL_ALLOWED and DEFAULT_RESULTS_PER_PAGE variables short of editing the contrib/admin/views/main.py file? Since these are parameters that directly relate to presentation, it seems that they should be controlled at a module level basis

Re: How to make localisation for contrib/comments/templatetags ?

2006-01-29 Thread Ivan Fedorov
cayco пишет: Hi! I want to do polish translation for that file. I couldn' t find anything to translate for that file in conf/locale/en/LC_MESSAGES/django.po What is the command to generato .po file for templatetags/*? I tried: /usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django $ pyt

Re: Template IF statement with <,>,<=,>= (or equvalent)

2006-02-25 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: >Django Template engine seems to be very strate forward yet powerful, >however I can't for the life of me figure out how to check if variable1 >is greater then or smaller then variable2. > > You can't. Django's philosophy is that this is logic is probably a small part

Re: To Truncate a Word to # of chars

2006-02-26 Thread Ivan Sagalaev
Siah wrote: >Please let me know if this feature is available, or else I'll find out >how to implement it as a filter myself. > > A filter would look simple: def truncate(value,arg): return value[0:arg] However it won't work for international characters. This will: from djang

Re: Template IF statement with <,>,<=,>= (or equvalent)

2006-02-27 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: >I have a bank statement for a particular account that I wish to display >as an HTML table. >I have a few statement attributes that come from my RDBMS. One in >particular named 'amount' that can be a positive or negative float >value. If its negative, it must show up in t

Re: Template IF statement with <,>,<=,>= (or equvalent)

2006-02-27 Thread Ivan Sagalaev
Glenn Tenney wrote: >I was thinking about this too... in my case I've got an event starting >date and ending date; in my views I want to be able to view based on >criteria such as: hasn't happened yet, hasn't happened yet but will happen >sometime this month / quarter / year, happened already thi

Re: Django scalability question

2006-02-28 Thread Ivan Sagalaev
ZebZiggle wrote: >I'm sure there are many very large websites using Django, but from what >I see many are newspaper-style (many reads, few if any writes except by >the admins). I'd be curious how may sites are doing dynamic updates by >many concurrent users? > It's still not a problem for a typic

Re: Django in a Load-Balanced environment (ORM issues) ...

2006-02-28 Thread Ivan Sagalaev
Peter Harkins wrote: >I can see why folks would want this, but I'd like to toss in a vote >against it being on by default. > I just started to write the same thing :-) > It strikes me as spooky action at a >distance -- because another process possibly on another machine saved >the state of one o

Re: bug missing first symbol

2006-03-01 Thread Ivan Sagalaev
Grigory Fateyev wrote: >I have strange problem. Project has model and DEFAULT_CHARSET = >'utf-8' with LANGUAGE_CODE = ru. After adding in admin some object via >popup window (ForaignKey), main pagr refresh and first symbol of >translated words look like square. Why it can be? > > Most probably

Re: bug missing first symbol

2006-03-01 Thread Ivan Sagalaev
Ivan Sagalaev wrote: >The slight problem is that this patch is made against trunk code but >adopting it to magic-removal may be just a matter of file name change. > > I've just submitted the patch against magic-remo

Re: IntegrityError, Duplicate key, MySQL 5, blank and unique

2006-03-06 Thread Ivan Sagalaev
johnsu01 wrote: >Using trunk, I have a model that has a number of fields which are >CharFields, that I would like to be optional but if they are filled >out, unique. > > I may be well wrong but I don't think you can express this at DB level. Uniqueness at DB level includes empty value (even NU

Re: IntegrityError, Duplicate key, MySQL 5, blank and unique

2006-03-06 Thread Ivan Sagalaev
Ivan Sagalaev wrote: > if model.get_list(**{'self.field_name'+'__exact':field_data}) > > Ouch :-) Make this 'get_list' to be 'get_count' instead... --~--~-~--~~~---~--~~ You received this message because

Re: IntegrityError, Duplicate key, MySQL 5, blank and unique

2006-03-06 Thread Ivan Sagalaev
Malcolm Tredinnick wrote: >In a correct SQL implementation, NULL is not comparable to anything, > > Yes... It should be :-). And as you said implementation is the whole another businness. johnsu01 talked about MySQL and given its history of not very strong adherence to standard but preferring

Re: Can/Should I place python objects in Django Session?

2006-03-06 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: >hi, >this has been discussed before, >http://groups.google.com/group/django-users/browse_thread/thread/dd83fbfc7657a9da/ >http://groups.google.com/group/django-users/browse_thread/thread/25e60576dcee5d7a/ > >and the conclusion is although you are able to you shouldn't >

Re: possible to keep elements' order while get_list(id__in=[...])?

2006-03-06 Thread Ivan Sagalaev
EricHsu wrote: >is it possible to make sure that >categorys.get_list(id__in=category_id_list) returns category object >list in the same order as category_id_list? > Nope. The order of a result of a query without 'ORDER BY' is undefined. But as soon as you have python list in memory you can sort

Re: why is my view for a submitted form not getting a POST?

2006-03-09 Thread Ivan Sagalaev
Amit Upadhyay wrote: > . is django way of handling form is there is any, makes it more > "portable", one less thing to change when you are relocating your > pages on your site, and your template need not know the actual page > where the form would be deployed. In fact tutorial could easily us

Re: Django on Windows?

2006-03-10 Thread Ivan Sagalaev
Leeuw van der, Tim wrote: > The application is a photo-album like application which stores > directory and image info in a psql database, and creates thumbnails > using PIL. > Ah! This is my beloved threading issue :-). It's not Windows specific. What happens is Django access one connection fr

Re: is it worth waiting to the 1.0 release?

2006-03-12 Thread Ivan Sagalaev
MarC wrote: >hi, >this is a general question, >I'm planning to use django for a personal-maybe_someday_big database based >project. I saw that >version 1.0 has not been released yet, but sbdy warned me that many things are >changing. >This plus the "Note that, until 1.0, there is no guarantee o

Re: IDE/Dev workflow question

2006-03-13 Thread Ivan Sagalaev
Todd O'Bryan wrote: >Is there any way to run the stuff Django needs from inside Python >interactions, > There is. All those management method are located in django.core.management. You can do it in python prompt like this: import os os.environ['DJANGO_SETTINGS_MODULE']='myproject.sett

Re: Django on Windows?

2006-03-13 Thread Ivan Sagalaev
Leeuw van der, Tim wrote: >Hi Ivan, > >Thanks for your fast answer. I didn't get round to trying the changes >until now and I suspect that the first link you sent me is for the wrong >issue: it's a patch to make the default filters unicode-proof (adding >encode/de

Re: Django on Windows?

2006-03-13 Thread Ivan Sagalaev
Leeuw van der, Tim wrote: >By searching for 'threading' in the ticket-database I've found ticket >1442, which provides a different approach: thread-local storage. (Each >thread it's own connection.) > > Yes, this is the fix that superseeded previous fixes for different backends. It's much clea

Re: LIKE operator

2006-03-18 Thread Ivan Sagalaev
PythonistL wrote: >Is LIKE operator supported in Django? > >I would like to perform a pattern match. > >For example something like this: > >SELECT name FROM metal WHERE name LIKE '%er%', > > metals.get_list(name__contains='er') --~--~-~--~~~---~--~~ You receiv

Re: Joining foreign keys backwards?

2006-03-18 Thread Ivan Sagalaev
Ned Batchelder wrote: > polls.get_list(choice__choice__exact="overeasy") # Doesn't work. > >Am I wrong? Please tell me there is a way to accomplish what I want. >This is all in .91. > AFAIK this is one of the thing that magic-removal is solving. There you would have Poll.choice_set which

Re: magick-removal: Suggestion

2006-03-20 Thread Ivan Sagalaev
Viktor Kerkez wrote: >The suggestion is to rename the classes from django/db/models/fields to, >for example: IntegerColumn, TextColumn or IntegerCol, CharCol... (thats >what they really are... columns in tables...) > > I'd rather rename form field classes to *FormField. They are used less fr

Re: Slice - built-in filter

2006-03-21 Thread Ivan Sagalaev
PythonistL wrote: >I use SLICE filter. I t works ok, but when I try e.g. > >{{ some_list|slice:":2" }} > >where some_list is >some_list=[1,2,3,4] > >I will get [1, 2]. > >Is it possible, via templates, to remove brackets? > > Yes. After "slice" you get back a Python list which is converted to

Re: Advice on using model to bulk/batch load database

2006-03-22 Thread Ivan Sagalaev
DavidA wrote: >I am prepopulating my database with data from a number of flat files. > > BTW, if you do this repeatedly and format of those flat files is not a requirement it is possible to have all initial data in a form of SQL script. If you place it in /sql/.sql then Django will include i

Re: Help getting admin and non-admin app running in Apache

2006-03-22 Thread Ivan Sagalaev
DavidA wrote: >NameVirtualHost * > >ServerName data >DocumentRoot "C:/Dev/Source/Web/data" >SetHandler mod_python >PythonHandler django.core.handlers.modpython >SetEnv DJANGO_SETTINGS_MODULE data.settings >PythonPath sys.path+['C:/Dev/Source/Web'] >PythonDebug On >

Re: Help getting admin and non-admin app running in Apache

2006-03-23 Thread Ivan Sagalaev
DavidA wrote: >TemplateSyntaxError: Caught an exception while rendering. > > Ah! Most of the time it means that it's an exception raised in some of your object's __repr__. Django fails here trying to reproduce error page which also uses __repr__ to print objects. --~--~-~--~~

Re: apache threading - 'QueryDict' object has no attribute '_mutable'

2006-03-24 Thread Ivan Sagalaev
Eugene Lazutkin wrote: >Alex: I'll look into this problem. Most probably there is a racing >condition in multithreaded Django. It doesn't look like it is related to >database backends. > I think so too... I was investigating Alex's report and it looks like somewhere onr thread is creating a Qu

Re: Extreme file uploading

2006-03-24 Thread Ivan Sagalaev
arthur debert wrote: >Regarding memory usage on the server, AFAIK this is something related >to cgi.FieldStorage. more about this here: >http://groups.google.com/group/django-developers/browse_frm/thread/2c379ec0fa30804a/# > >It would be great to have a streaming option, but aparentely this is >t

Re: ImageField nightmares

2006-03-25 Thread Ivan Sagalaev
sparkydeville wrote: >I'm new to Django, and I'm seeing various complaints about the >ImageField, specifically it's basic inability to work as advertised. > Could you, please, clarify what exactly doesn't work in regard to image fields? My experience is that they are succesfully storing and shoi

Re: ManyToManyField corrupts headers

2006-03-25 Thread Ivan Sagalaev
burivuh wrote: >We're planning to use Django on all web projects - large and small, so >sometimes the only platform for the small site is shared-hosting >without mod_python or python2.4 at all. Python in Russia is not a >widespread language. > > Looking at how many russian names are in this lis

Re: Grabbing values from project settings

2006-03-25 Thread Ivan Sagalaev
mateja wrote: >As you can see, I load the mediaurl filter, and then inject the >media_url value. My question is, is this the right way to do this? > One of the ways, at least. I'm doing it another way using context processor to populate template's context with selected values from settings tha

Re: FileField permissions

2006-03-25 Thread Ivan Sagalaev
sam wrote: >I want to use FileField to upload files but I don't want the file URIs >directly visible to the user. > Simple way is just to no tell them the URL (i.e. not using {{ object.get_field_url }} in templates). Another way is to copy files to the directory inaccessible from web upon file

Re: Memory leak (db connection related?) with apache/postgres and magic-removal

2006-03-26 Thread Ivan Sagalaev
Alex Brown wrote: >I have a test script that repeatedly POSTs to a generic_view >create_object form. > >The problem, is that apache's memory usage just goes up and up, and >never releases. > > It's a feature :-) With DEBUG = True Django logs all executed SQL statements in db.queries. This is

Re: follow relationship

2006-03-27 Thread Ivan Sagalaev
Todd O'Bryan wrote: >The tutorial explains how to get objects based on field values, but I >need to get a subset of the objects in a OneToMany relationship based >on one of their values. Here's an example: > >BRANCH_KINDS = ((0, 'Main'), (1, 'Auxiliary'), (2, 'Dead'),) > >class Trunk(meta.Mod

Re: Overthinking urls.py?

2006-03-27 Thread Ivan Sagalaev
Adrian Holovaty wrote: >The convention is to put the URL-creation logic in your models, in a >get_absolute_url() method. > Thank you Adrian and others for this info! All this time I was honestly thinking that hard-coded urls in templates are some kind of evil that need to be dealt with in futur

Re: follow relationship

2006-03-29 Thread Ivan Sagalaev
Todd O'Bryan wrote: >Your comment at the end got me thinking, though. Writing > >trunk.get_branch(kind__exact=2) > >is not very illuminating, but you're correct that the value 'Dead' >could get changed later. In Java, I'd use constants for the integer >values > >public static final int DEAD =

Re: apache threading - 'QueryDict' object has no attribute '_mutable'

2006-03-29 Thread Ivan Sagalaev
Eugene Lazutkin wrote: >Woot! 1539 and 1442 are both committed! Now all multithreaded guys, and >MySQL users can start up projects right out of the box without digging >for "magic incantations" in tickets, mail lists, and blogs! > > Woots and thanks to Adrian and Eugene from me too :-) I hop

Re: Where does the request.user get set?

2006-04-03 Thread Ivan Sagalaev
shredwheat wrote: >Is that in magic-removal? I am working off of SVN trunk > Then it's in HTTP handlers (core/handlers/wsgi.py and core/handlers/modpython.py). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Djang

Re: django-admin and manage.py without shell-access

2006-04-05 Thread Ivan Sagalaev
Roman wrote: >I need to place my django-powered web site on a server which haven't >SSH-access (ftp only). Can I execute analogues of "django-admin" and >"manage.py" through web interface? > > There is no web interface but you can write a script with something like this: from django.core

Re: will apps created with django run on a shared host that has mod_python loaded?

2006-04-11 Thread Ivan Sagalaev
walterbyrd wrote: >Or is there anything else required to run django created apps on a >shared host? > > It depends on more than just mod_python. Basically for Django you should have mod_python or FastCGI (or, theoretically, any WSGI-compliant server), PostgreSQL or MySQL or SQLite. Shell acce

Re: possible to filter ManyToMany results?

2006-04-11 Thread Ivan Sagalaev
nkeric wrote: >class ArticleType: >name = ... > >class Article: >title = ... >article_type = meta.ForeignKey(ArticleType) > >class Game: >name = ... >articles = meta.ManyToManyField(Article) > >how can I retrive the articles of a certain article type of a given >game? > > >

Re: check for none

2006-04-12 Thread Ivan Sagalaev
Jiri Barton wrote: >I want to be able to discern among None, empty list, and non-empty >list; then, I want to tell the user - say nothing, "nothing found", >"found the following:" resp. > > I had a similar (but a bit more complex) thing solved for me by wrapping a list in a dict: result={} -

Re: possible to filter ManyToMany results?

2006-04-12 Thread Ivan Sagalaev
nkeric wrote: >hello, could anybody pls help? I don't want to write dirty sql if I >could do it via django ORM... > > Well... The only thing I could work out is this: articles = [a for a in g.get_article_list() if a.article_type_id == 1] Drawbacks are obvious: it's always selects all articles

Re: possible to filter ManyToMany results?

2006-04-13 Thread Ivan Sagalaev
nkeric wrote: >Ivan, thanks a lot for your reply :) >well, I guess I have to take the "dirty" sql approach :p > > You might want to look into magic-removal branch where things like this are made possible with ORM. --~--~-~--~~~---~--~-

Re: possible to filter ManyToMany results?

2006-04-14 Thread Ivan Sagalaev
nkeric wrote: >Really? That's cool! > > Yes. One of the great new features of m-r branch is that relation queries work similary for M-M and 1-M relations and in both directions: game.articles.filter(article_type__pk=1) # all articles for one game of one type article.game_set.all() #

Re: possible to filter ManyToMany results?

2006-04-14 Thread Ivan Sagalaev
Luke Plant wrote: >As I understand it, Django should be able to do this query no problem. > > I also thought so :-). I created a test project with this model and tried to get this query to work. "get_article_list" is indeed there but it doesn't like 'article_type__id__exact' as an argument.

Re: UNICODE database API How to

2006-04-17 Thread Ivan Sagalaev
yml wrote: > I guess that I should add something to my script called >loader_departments.py in order to support this. > > Yes. You are getting contents of your file in unicode but Django's ORM expect strings to be in byte strings. So you have to encode them into whatever encoding your DB is

Re: UNICODE database API How to

2006-04-17 Thread Ivan Sagalaev
yml wrote: >Ivan hi, >I try your recommandation but unfortunatly it is not working I am >getting the following error message: > >In [38]: r=Department(department=matches[1].encode('utf-8'), >department_number=matches[0].enco

Re: UNICODE database API How to

2006-04-17 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: >(I haven't used mysql with Django, but I'm quite sure that the Django >ORM handles Unicode correctly). > > It depends very much on the definition of "correctly". Django's ORM expect single-byte strings which for unicode means utf-8. --~--~-~--~~--

Re: UNICODE database API How to

2006-04-17 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: from django.models.page import pages p = pages.Page(path=u"/föö", source=u"/bär") p.save() Interesting. I get here a 'Segmentation fault'. Both in in m-r and trunk... q = pages.get_object(path__exact=u"/föö") q.path

Re: UNICODE database API How to

2006-04-18 Thread Ivan Sagalaev
yml wrote: >f = open("departments.txt") >regexobj = re.compile("([0-9]+)\s+([\w\s?]+)",re.UNICODE) > > >for l in f.readlines(): >fileencoding = "iso-8859-1" > > Ah! I was just about to suggest this. Your file seems to be not in utf-8 actually. And since you were opening it with codecs.open

Re: ExtendedUserModel in m-r branch?

2006-04-20 Thread Ivan Sagalaev
FX wrote: >Hi Folks, >Our application (we believe it's the first public launched web site >powered by django in China, http://www.ifaxian.com/) makes use of the >Extended User Model as described in the wiki, but I can't find the >"replaces_module" option anymore in the m-r branch. Could it still

Re: Passing variables to include?

2006-04-20 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: >Say I want to have a reusable component, included via {% include %}, >which renders a product. So I only have to deal with layout, >formatting, images, etc., once (I'm a big fan of re-use and DRY). The >template fragment will have a lot of {{product.price}}, >{{product.p

Re: Passing variables to include?

2006-04-21 Thread Ivan Sagalaev
tonemcd wrote: >I don't understand why a more generic form of this tag isn't available; > >{% datatofillinthetemplate "templates/macrosnippet.html" %} > >Is there a philosophical reason why this doesn't exist > > Inclusion tag doesn't always just renames context vars. It can (and very often do

For what is useful order_with_respect_to?

2006-04-26 Thread Ivan Sagalaev
Being not native English speaker I can't really get the purpose or order_with_respect_to just by reading docs. Looking at how it's implemented I see that related objects get some sort index unique within one parent record and can be ordered in creation order. But why it is needed? Can someone

<    1   2   3   4   5   6   >