Re: i18n & server_name

2006-12-04 Thread Ivan Sagalaev
Alexander Solovyov wrote: > Sorry, I found answer - META['HTTP_HOST']. :) Documentation keeps > silence about this. :( Another way is to use 'sites' app and keep domain in a table separately for each site. --~--~-~--~~~---~--~~ You received this message because

Re: How to default checkboxfield in customer manipulator

2006-12-04 Thread Ivan Sagalaev
jeffhg58 wrote: > I am trying to set the checkboxfield default value to checked but not > sure how you do it. > > Here is my formfield for the checkbox > > forms.CheckboxField(field_name="current"), > > I tried ading checked="checked" but that did not work. It's a bit non-obvious... The actual

Re: using manipulators without defining fields again

2006-12-04 Thread Ivan Sagalaev
Milan Andric wrote: > I have a long application form for a workshop (name, employment, > resume, ... 65 fields). The user logs in to the site via > django.contrib.auth.view.login, standard django fare. Then the user is > allowed to apply for workshop xyz. If the user clicks save but does > not

Re: can't figure out how to call a generic view inside my own view

2006-12-06 Thread Ivan Sagalaev
Anton Daneika wrote: > Hello, everyone. > > I am trying to call django.views.generic.list_detail.object_list from my > own view, but I get the error page saying "dict' object has no attribute > '_clone'" > > Here is the function: > def my_gallery_listing(request, gallery_id): > d = dict(qu

Re: Anonymous Sessions

2006-12-06 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > I'd like a simple option to disable this, any plans to implement > something of the sorts? The intended way is to remove SessionMiddleware and those depending on it (AuthenticationMiddleware) from MIDDLEWARE_CLASSES and 'django.contrib.sessions', 'django.contrib.auth'

Re: Anonymous Sessions

2006-12-06 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > Well we obviously need authentication, we just don't need anonymous > session handling. Then it shouldn't be a problem. Sessions are created and hit db only if you store something in it. Or if you have SESSION_SAVE_EVERY_REQUEST = True. Otherwise request.session is ju

Re: Anonymous Sessions

2006-12-06 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > It is a problem. It hits the db if it has to create it. Sorry I still don't understand :-). You say that you do need authentication but don't need anonymous sessions. Then in default Django setup you never hit a database unless you try to store something in session.

Catching m2m chnages

2006-12-11 Thread Ivan Sagalaev
Hello! I have two models linked through m2m relation. I want to hook a code that will be executed on each change in this relation (adding and removing). If it wasn't about m2m then I would just override a save() method of a model but with m2m an intermediate table is not represented as a mode

Re: Duplicate Related Records

2006-12-11 Thread Ivan Sagalaev
Ned wrote: > ==Template== > {% for status in form.status %} > > > {{ status.date }}{% if status.date.errors %} class="error">{{ > status.date.errors|join:", " }}{% endif %} > Somewhere in the first include {{ status.id }}. It's a hidden field that actually different

Re: CSS Basics

2006-12-21 Thread Ivan Sagalaev
Fredrik Lundh wrote: are you trying to say that Django's static server doesn't filter the URL before adding it to the document root ? Sure it doesn't. Mainly because there is no such thing as "Django static server". That view is just a debugging shortcut to let people develop a site when the

Re: How would you implement this?

2006-12-21 Thread Ivan Sagalaev
Eric Floehr wrote: How would you recommend having the first table go against context variable 'table' and the second go against 'secondtable' (for example)? You're looking for inclusion_tag: http://www.djangoproject.com/documentation/templates_python/#inclusion-tags --~--~-~--~~

Re: Types of projects Django is not well suited for?

2006-12-27 Thread Ivan Sagalaev
Kenneth Gonsalves wrote: Why on earth would any web framework make a list of web apps that it is not suitable for? To be kind to a potential user when he might acquire a need to do something the framework *is* suitable for. No framework can do everything. And what is the best place to ask

Re: Types of projects Django is not well suited for?

2006-12-27 Thread Ivan Sagalaev
Kenneth Gonsalves wrote: that has already been answered in the django documentation. Django is not a tool for endusers to create quicky web applications. It is not a ready made CMS/blog/BBs etc. I didn't say anything like this. Your question was why we would list Django's restrictions. I r

Re: dynamically changing URLS

2007-01-08 Thread Ivan Sagalaev
James Bennett wrote: However, in your specific case I wonder if it wouldn't be better to just have a separate settings file Another approach (simpler in my view) is to have a middleware like this: class EmergencyMiddleware: def process_request(request): return render_to_resp

Re: Extending ManyToMany managers

2007-01-08 Thread Ivan Sagalaev
Gulopine wrote: Yeah, I guess I see the biggest obstacle here is the simple fact that the ManyToMany manager is generated each time it's referenced, rather than persisting on the model. I can replace the add() method of the generated manager to get it to work immediately, but the next time I ret

Re: Inner Join

2007-01-08 Thread Ivan Sagalaev
Russell Keith-Magee wrote: table1.objects.filter(table2_attribute_name.field='foo') Did you mean table1.objects.filter(table2_attribute_name__field='foo') (i.e. '__' instead of '.')? --~--~-~--~~~---~--~~ You received this message because you are subscri

Re: Hi! Here's a new Django beginner with a few questions.

2007-01-10 Thread Ivan Sagalaev
Sebastien Armand [Pink] wrote: > class Person(models.Model): > ... > mother = models.ForeignKey('Person') > ... > > Will this work? Use models.ForeignKey('self') > For example if I've got a Body class and a Legs class, I know that I'll > never have a body with more than 2 legs Did

Re: Design Q: Foreign keys from object.values()

2007-01-10 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > Hi guys, > > I'm trying to get a better grip on Django design philosophy, and I'm a > little confused as to why calls to a manager's " values() " function > returns foreign keys as the value of their primary key rather than as > django objects. For example: > > class

Re: Design Q: Foreign keys from object.values()

2007-01-10 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > Thanks; this works for me -- though I have to do > > Author.objects.filter(story__id__isnull=False).distinct() > > Or it repeats each author for each of his stories. > > This still confuses me, because there is no "story" field in the Author > model to specify ho

Re: how to list all Tags for Blog? or simple m2m filtering...

2007-01-16 Thread Ivan Sagalaev
natebeaty wrote: I'd like to throw this in as extra_context along the lines of: "tag_list" : Tag.objects.filter(this_is_where_my_brain_is_shorting) This is in fact pretty standard Django ORM, nothing special to TagsField: blog.tag_set.all() (assuming blog is an instance of Blog). You ca

Re: how to list all Tags for Blog? or simple m2m filtering...

2007-01-17 Thread Ivan Sagalaev
natebeaty wrote: SELECT t.value FROM `blog_blog_tags` b LEFT JOIN `tags_tag` t ON (b.tag_id=t.id) but that feels like cheating.. besides, I'd like to better understand the ORM. Ah... You mean "all tags that have relation to any blog". This is it: Tag.objects.filter(blog__id__isnull=False

Re: how to list all Tags for Blog? or simple m2m filtering...

2007-01-17 Thread Ivan Sagalaev
natebeaty wrote: Tag.objects.filter(blog__id__isnull=False) Perfect! Yeah, "all tags that have relation to any blog" -- that's what I was trying to say! Actually I've forgot 'distinct' yet again: Tag.objects.filter(blog__id__isnull=False).distinct() ...or there would be dupes in

Re: how to list all Tags for Blog? or simple m2m filtering...

2007-01-20 Thread Ivan Sagalaev
natebeaty wrote: > ..but apparently this will only populate the tags once, when I start up > Django, correct? Do I need to add the extra_context in a wrapper around > a generic view in views.py? Or would something like this be best > implemented as a template_tag? > > Am I correct in assuming it

Re: Euro Sign raise UnicodeEncodeError

2007-01-26 Thread Ivan Sagalaev
Christian Schmidt wrote: > Do I have to encode (or decode) the string before I put it into the > database First, it depends on database backend. As far as I know MySQL wants byte strings (and for example psycopg2 lives happily with unicode strings). If you use newforms then you have data in uni

Re: IPython Shell does not see database changes made by views.

2007-01-31 Thread Ivan Sagalaev
Paul Childs wrote: > I wanted to do some checks through the shell, which I was opened > during my unit testing, and found that after making some queries using > Django objects there appeared to be no changes in the database. When I > checked the database using its admin tool the changes were there

Re: Having trouble with my M2M relationship.

2007-02-08 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > sponsor = models.ManyToManyField(Sponsor, > filter_interface=models.HORIZONTAL, related_name="section") > > > What I'm trying to do in a template is show all the sections that > sponsor is in. It seems to me I should be able to do something like > > {% for sec

Re: Model instance identity

2007-02-14 Thread Ivan Sagalaev
David Abrahams wrote: > I just wrote some code that used Model instances as keys in a dict, > and was surprised to find two instances in the dict that represented > the same object in the database. Shouldn't that be impossible? If > you can't guarantee that a given object in the database is alwa

Re: MR: _manipulator_validate_FIELD() methods?

2006-05-06 Thread Ivan Sagalaev
Matthew Flanagan wrote: >Since MR merged the _manipulator_validate_FIELD() methods stopped >working. The solution I came up with was to write custom manipulators >(which was what I was trying to avoid all along). > Can you assign those validators to the validator_list of a field right in a model

Re: order by m2m field?

2006-05-06 Thread Ivan Sagalaev
Luke Plant wrote: >I can't see how this would work -- an entry can have many authors, so >which one do you order by? > > I'm having very hard time explaining this to my current customer :-). 'What can be hard about sorting?', he says... 'In Java you'll get this for every list in a project in

Re: order by m2m field?

2006-05-06 Thread Ivan Sagalaev
pbx wrote: >I've been banging my head against some similar problems recently, >mostly with legacy data that's poorly normalized. One optimization/hack >that was suggested to me was adding a field that's only used for >sorting (or selecting, as the case may be) -- like your hypothetical >concatena

Re: Forms: SelectField with default value

2006-05-10 Thread Ivan Sagalaev
Juancho wrote: >"This is not in the scope of the formfields.py framework. Formfields >just know how to display themselves -- they don't know (or care) about >data. Put this in your business logic." > > This means that SelectField shouldn't care of concept of default data itself. But it surely

Re: 'module' object has no attribute 'urlpatterns'

2006-05-10 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: >Well, I have tried setting urlpatterns in databaseImport.py (copied >from urls.py) but it the error message did not change. > > But why you include this databaseImport.py ??? You should include your applications urls.py where you describe your urls. --~--~-~-

Re: Decoupling fields from forms

2006-05-11 Thread Ivan Sagalaev
George Sakkis wrote: >>I understand that Django maintains two parallel hierarchies of field >>classes, one related to models that correspond to table columns and one >>that maps these fields to forms so that they can be edited in the admin >>interface. This works ok most of the time, but what if

Re: help with view/template data

2006-05-12 Thread Ivan Sagalaev
Rob Hudson wrote: >def list(request): >""" >Sets up a list of tuples: (month, list of events) >[("March", [, ]), ("April", [<>])] >""" > > Malcolm has answered your question but I want to add that with Django templates you can do this thing much simpler without two nested loops

Re: LANGUAGE_CODE and render_to_response?

2006-05-12 Thread Ivan Sagalaev
Jay Parlar wrote: >Is there something about render_to_response that makes it that >LANGUAGE_CODE doesn't get properly populated? > > All those things that are populated in templates automatically work with the help of context processors (http://www.djangoproject.com/documentation/templates_py

Re: help with view/template data

2006-05-12 Thread Ivan Sagalaev
Rob Hudson wrote: >What I'm not clear on is what ifchanged looks at. Does it look at the >for loop and "event", or does it look at what's in the body of >ifchanged? In this case the event.date_from? > > It looks at the string between {% ifchanged %} and {% endifchanged %} no matter how it

Re: Accessing a field's upload_to strftime

2006-05-15 Thread Ivan Sagalaev
Jay Parlar wrote: >However, I need to use this with my own view, which currently looks as follows: > >def upload_file(request): >manipulator = FirmwareUpload.AddManipulator() >if request.POST: >new_data = request.POST.copy() >new_data['firmware'] = _save_file(request.FILES

Re: Accessing a field's upload_to strftime

2006-05-15 Thread Ivan Sagalaev
Jay Parlar wrote: >Ahh, very cool. How should I build the new_data object though? Is >this the *right* way? > >new_data = request.POST.copy() >new_data.update(request.FILES.copy()) > > Well... In general it's a bit tricky. Doing it like this and feeding this new_data to manipulator will valid

Re: Accessing a field's upload_to strftime

2006-05-15 Thread Ivan Sagalaev
Jay Parlar wrote: >I'm still curious though if doing the >new_data.update(request.FILES.copy()) is the best way to do that part >of it. > > Only if you don't care of lost files in your upload :-). Here's the code that I use in my project to handle this. The function receives list of file fiel

Re: Accessing a field's upload_to strftime

2006-05-15 Thread Ivan Sagalaev
Jay Parlar wrote: >Hmm... So let me get this straight... When someone does an upload via >my form, Django *temporarily* stores it in my uploads directory, with >the "_" at the end of the filename, right? > No. It tries to save the file with the given name and appends '_' only when there are alre

Re: Accessing a field's upload_to strftime

2006-05-16 Thread Ivan Sagalaev
Jay Parlar wrote: >Alright, let me see if I understand it this time: If you upload a file >that's already been uploaded, then Django will lose the association to >the old one, and it will essentially be sitting orphaned on the disk? > > Exactly. >For my use case, I actually want to keep every

Re: Trouble resolving URLs

2006-05-17 Thread Ivan Sagalaev
Simon Johnston wrote: >from django.conf.urls.defaults import * >urlpatterns = patterns('', >(r'^accounts/$', include('RealLife.crm.urls')), > > "$" is what breaks your URL. >Using the URLconf defined in RealLife.urls, Django tried these URL >patterns, in this order: > 1. ^accounts/$ >

Re: integrating complex SQL updates with manipulators?

2006-05-18 Thread Ivan Sagalaev
mazurin wrote: >if request.POST: >new_data = request.POST.copy() > > WHERE SHOULD THIS FUNCTIONALITY GO? # >moveOK = moveNode(item.id, new_data['parent']) > >errors = manipulator.get_validation_errors(new_data) > > Is it necessery that moveNode is cal

Re: integrating complex SQL updates with manipulators?

2006-05-19 Thread Ivan Sagalaev
mazurin wrote: >No it's not necessary ... I see, so I should override >manipulator.save() then? Does this mean subclassing manipulator? > > Yes. I didn't quite understand from your email if you are going to write a custom manipulaor anyway or you want to mix new code into an automatic manipul

Re: generic view: list articles by category?

2006-05-23 Thread Ivan Sagalaev
nkeric wrote: >I guess I need to build the 'queryset' of the article_list_dict >dynamically as something like >this: Article.object.filter(category__id__exact=) rather >than Article.objects.all(). > >Is it possible? > > No it's currently not possible. There are two workarounds though. 1. You c

Re: generic view: list articles by category?

2006-05-24 Thread Ivan Sagalaev
nkeric wrote: >btw, how about creating a more generic patch for django's generic view >methods? Since this is really a "generic" scenario - I usually need to >"get some object list by some condition" :) > > Actually I asked on django-dev if this thing would be of any interest if I implement it

Re: generic view: list articles by category?

2006-05-24 Thread Ivan Sagalaev
nkeric wrote: >yep, agree too :) did you ever open a ticket with your patch? > > No I didn't. Feel free to do it and make a patch :-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post t

Re: [PATCH] FileField with custom upload_to

2006-05-24 Thread Ivan Sagalaev
Jay Parlar wrote: >+def save_func(instance, filename, raw_contents, upload_to=""): >+if upload_to: >+self.upload_to = upload_to >+instance._save_FIELD_file(self, filename, raw_contents) >+setattr(cls, 'save_%s_file' % self.name, save_func) >

Re: How fix the "feature" of not serving static files?

2006-05-24 Thread Ivan Sagalaev
Bill de hÓra wrote: >One tip: don't start your path with '/media': it might conflict with the >admin app if you have it installed. > > BTW you can overwrite admin's media path with ADMIN_MEDIA_PREFIX (http://www.djangoproject.com/documentation/settings/#admin-media-prefix) --~--~-~--

Re: 'str' object has no attribute 'write'

2006-05-25 Thread Ivan Sagalaev
mary wrote: >i wrote this view >def index(request): >output=open( '/var/www/xml-python/xmleditor/test.xml','w') >output.write('') >output.write('') >latest_menu_list = Menu.objects.all().order_by('-id') >output = ', '.join([m.menu_text for m in latest_menu_list]) >output.w

Re: Tagging app

2006-05-25 Thread Ivan Sagalaev
Luke Plant wrote: >I've been writing some tagging functionality for my site, and I've >developed it in a way that is reusable and generic, similar in some >ways to the 'comments' app in contrib. > Seems that tags are hot in Django these days :-). Couple of days ago I've done my TagsField as a

Re: Related tags ala del.icio.us

2006-05-25 Thread Ivan Sagalaev
Jay Parlar wrote: >I'm doing a personal app for myself that tracks academic papers I've >read. As is the style these days, I can apply multiple tags to each >paper. My basic model is this: > >class Tag(models.Model): >name = models.CharField(maxlength=200, core=True, unique=True) > >class Pap

Re: 404 and 500 erros

2006-05-26 Thread Ivan Sagalaev
Vladikio wrote: > I know errors 500 and 404 automatically use 404.html and 500.html ... >but is there a way to define a view that handles those errors ? > Yes. http://www.djangoproject.com/documentation/tutorial3/#write-a-404-page-not-found-view > For instance to send an email each time a 500

Re: Related tags ala del.icio.us

2006-05-27 Thread Ivan Sagalaev
Jay Parlar wrote: >Ahh, that's perfect. Is there any way I could use this with the >'object_list' generic view, or will I just have to roll my own view to >get this one going? > Not with the object_list. However you can use object_detail to display a Tag and wrap the query in a custom method of

Re: Templates parameters

2006-05-27 Thread Ivan Sagalaev
Kilian CAVALOTTI wrote: >Currently, I have: >{% for l in list|dictsort:"name" %} >... >{% endfor %} > >I can replace "name" by a variable, but I'd also like to replace 'reversed' by >a variable, to be able to control the sort order from the GET payload. > >Is there a way to achieve this? Or anot

Re: ManyToMany Question

2006-05-27 Thread Ivan Sagalaev
chrisk wrote: >class Post(models.Model): >... > assoc_cats = models.ManyToManyField(Category) >... > >In my template {% for post in latest %}... works fine, but if i try to >use the Many-to-many related lookup {{ post.assoc_cats.all }} i get an >empty list. > > I wast about to answer somethin

Re: Dynamic template extension

2006-05-30 Thread Ivan Sagalaev
tomass wrote: >I don't seem to be able to do {% extends "base_{{ reseller }}_.html" %} >for instance. > > You can use the variable here like this: {% extends some_var %} But without anything fancy like concatenations. You should hence set some_var to a full template name before it gets i

Re: how to use instance method in the validator_list of a field in model?

2006-05-31 Thread Ivan Sagalaev
favo wrote: >class Category(models.Model): >""" Inhert Category """ > >title_en = models.CharField(maxlength=256, null=True) > >parent = models.ForeignKey('self', related_name="direct_children", >null=True, blank=True, validator_list=[self.isValidParent]) # >we want the instan

Re: how to use instance method in the validator_list of a field in model?

2006-05-31 Thread Ivan Sagalaev
favo wrote: >However, how to replace the default changeManipulator used by >django-admin? > > Hm... Then my advice won't help... One thing I can think of is that in your validator you get the object's id from the all_data and get an object itself with another db request. Not very good but it

Re: how to use instance method in the validator_list of a field in model?

2006-05-31 Thread Ivan Sagalaev
Luke Plant wrote: >However, you can override the 'validate' method on a model, and you >might be able to use that to do what you want > Looks like it doesn't get called from manipulators? --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: Can Django template use relative path in 'include' tag?

2006-06-01 Thread Ivan Sagalaev
Wei Litao wrote: > I have a template which reside in 'myapp/tmpl1.html'. In this template > I want to 'include' another template which reside in > 'myapp/tmpl2.html'. But I don't want to use the syntax as '{% include > "myapp/tmpl2.html" %}' . Instead, i want simply use something like '{% > i

Re: Catching a failed response

2006-06-06 Thread Ivan Sagalaev
Jay Parlar wrote: >What I'd like is that if the client closes their browser, >some exception gets raised, and I can cancel the rest of the process >on the server side. > > Ah... This is interesting :-). A web server will know that a client has been disconnected only when it will try to send it

Re: Catching a failed response

2006-06-07 Thread Ivan Sagalaev
Jeremy Dunck wrote: >It sounds to me like "Exception Middleware" needs to be renamed to >"View Exception Middleware" and you should write a patch for "Response >Exception Middleware". ;-) > > I don't think it's possible. In the wsgi.py it's just: return response.iterator .. and the WSGI

Re: newbie: object from maniputor versus set_foo.add( )

2006-06-13 Thread Ivan Sagalaev
Bram de Jong - MTG wrote: > Right now I do: > > def post_comment(request, blog_id): > [snip] > > blog_post = BlogPost.objects.get(id__exact=blog_id) # from URL > > # If data was POSTed, we're trying to create a new Comment. > new_data = request.POST.copy() > > #

FastCGI watcher?

2006-06-14 Thread Ivan Sagalaev
Hello! I know that some people here are running Django under FastCGI. I'm using Hugo's convenient django-fcgi.py script for this (https://simon.bofh.ms/cgi-bin/trac-django-projects.cgi/wiki/DjangoFcgi). However couple of days ago I've found my django app (test version, thankfully) not respond

Re: encoding of form variables in views

2006-06-14 Thread Ivan Sagalaev
Pistahh wrote: > now my question is how do I know the encoding of the variables in > data["something"] ? > This encoding should be the same that you're using for output (settings.DEFAULT_CHARSET). However nothing is preventing some broken user agent (like some badly written script) to send y

Re: FastCGI watcher?

2006-06-14 Thread Ivan Sagalaev
Gábor Farkas wrote: > ! someone also uses fastcgi :-) > This used to be the first thing in Google by "django fastcgi" :-). > we do not have this problem on our system (at least we think so :-) This is good to hear :-). I have the problem on my virtual hosting where don't actually know what exa

Re: How to do named HTML anchors with Django?

2006-06-14 Thread Ivan Sagalaev
ZebZiggle wrote: > PS> Thx for the tip ... I'll change that! I'm pretty > old-school :) > I want to add that the whole point of referring to an id is to not have for it. If you have an element you want to refer to then instead of: ... you can do just: ... --~--~-~--~

Re: Root URI in templates

2006-06-14 Thread Ivan Sagalaev
ChrisW wrote: > I had thought of doing this, but after not seeing it in anyone elses > code, I wasnt sure if: > a) it was the "right thing to do". b) how to do it properly. > In all (both :-) ) my projects I use a context processor to have {{ style_url }} and {{ js_url }} in templates. This is

Re: FastCGI watcher?

2006-06-14 Thread Ivan Sagalaev
Ivan Sagalaev wrote: > I have the problem on my virtual hosting where > don't actually know what exactly has happened. So may be this was me > making something stupid in /etc/rc.d script to start this up. To remove suspicions from django-fcgi.py I want to confirm that it wa

Re: FastCGI watcher?

2006-06-14 Thread Ivan Sagalaev
Derek Hoy wrote: > These cover use of daemon-monitoring demons: > > http://www.linuxdevcenter.com/lpt/a/1708 > http://ivory.idyll.org/articles/basic-supervisor.html > Thanks! > And this is cool :) > http://www.truepathtechnologies.com/gcal.html > Or fun -- at least :-) --~--~-~--~-

Re: OneToMany and filters

2006-06-15 Thread Ivan Sagalaev
mathias wrote: > In my view I can retrieve all the tickets: > tickets = Ticket.objects.all() > I can also retrieve the content that matches my search: > contents = Content.object.filter(body__icontains='bla') > > But I can't figure out how to retrieve a QuerySet with all the tickets > from the con

Re: POST to view loses POST data

2006-06-17 Thread Ivan Sagalaev
Adrian Holovaty wrote: > I think we ought > to bite the bullet and add request.method, which would be a shortcut > to a normalized (all caps?) version of request.META['REQUEST_METHOD'], > which is cumbersome to type and might not (?) always be upper case. > Per HTTP all request methods are defi

Cutting output of flup's FastCGI server

2006-06-18 Thread Ivan Sagalaev
Hello! I'm looking for help from someone who is familiar with how FastCGI works. I'm using well-known flup's FastCGI server. The app serves large files (mp3 albums, 100 MB typically) that users download with download managers that often drop connections on client side and start new ones. The

Re: Cutting output of flup's FastCGI server

2006-06-18 Thread Ivan Sagalaev
Ivan Sagalaev wrote: > I'm using well-known flup's FastCGI server. The app serves large files > (mp3 albums, 100 MB typically) that users download with download > managers that often drop connections on client side and start new ones. > The strange thing is that when a c

Re: Hosting a Django project in Bluehost

2006-06-18 Thread Ivan Sagalaev
Grigory Fateyev wrote: > Somebody use FastCGI on your own server? I do. I have mostly done it using this instruction: https://simon.bofh.ms/cgi-bin/trac-django-projects.cgi/wiki/DjangoFcgi > Can you help me how to setup this? > You can contact me personally if that instruction will not suffic

Re: Many to Many Ordered List

2006-06-19 Thread Ivan Manolov
I am having a similar problem here. having read the m2m_intermediary/ wiki page, I still cant wrap my head around the idea of displaying a multiple select dropdown list of related objects on the admin side. --~--~-~--~~~---~--~~ You received this message because

Re: Cutting output of flup's FastCGI server

2006-06-20 Thread Ivan Sagalaev
PythonistL wrote: > Hello Ivan, > It is intereresting. > But why do you use/prefer FastCGI to mod_python ? I don't prefer it yet, just evaluating. I have some strange problems with server overloading doing about 30 parallel requests all of which sleep() about 90% of time. My fi

Re: Root URI in templates

2006-06-21 Thread Ivan Sagalaev
plungerman wrote: > perfect, just what we needed. one thing i noticed, however, is that > this manoeuvre does not work with 404.html and 500.html type pages. This is because they use a simple Context, not RequestContext. > we > have custom templates for those two errors, and the variable is n

Re: if >, if >= in templates?

2006-06-25 Thread Ivan Sagalaev
Don Arbow wrote: > Not sure if it works, but off the top of my head, what I would try is this: > > {% if reference_set.all|slice:"5:" %} Not exactly this. Here a DB (Postgres at least) will complain that it can't set OFFSET without LIMIT. This would work: {% if reference_set.all|slice:"5:

Re: Exclusion by a many-to-many field to self

2006-06-28 Thread Ivan Sagalaev
Russell Keith-Magee wrote: > Interesting... this could be interpreted as a bug in exclude(). It might > be worth checking to see if this has been identified before, and if not, > raising this as a bug. Sounds like it could be a problem with a join > that should be OUTER, but is LEFT INNER (or s

Re: Exclusion by a many-to-many field to self

2006-06-29 Thread Ivan Sagalaev
Ivan Sagalaev wrote: > This change might lead to some well hidden bugs. If someone was > deliberately using the behavior of join that doesn't get records that > don't have their related counterparts then those queries would suddenly > yield much more results than they use

Re: after_acreate after_change

2006-07-03 Thread Ivan Sagalaev
Malcolm Tredinnick wrote: > However, I suspect that is not what you want (since I don't use Rails, I > have to guess a bit from the names). We don't currently have any > post_update and post_create signals being emitted. This sort of > functionality will eventually be possible, but some reworking

Re: running django fcgi process as a normal user

2006-07-03 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > I am a bit nervous running my fcgi django server as root. Is there a > way of downgrading the process to another user id ? As I understand, > execution does not run through the web server anymore (which is running > as nobody) I'm not a unix admin but I've managed to mak

Re: Django & Apache 1.x

2006-07-04 Thread Ivan Sagalaev
Carlos Yoder wrote: > Hello people! > > Since I only found *one* place stating that Django "requires Apache > 2.x and mod_python 3.x", I felt I should check :-) > > Just to be absolutely sure... Django does NOT work under Apache 1.x, correct? Not correct. This 2.0 thing is mentioned because Dja

Re: Django & Apache 1.x

2006-07-04 Thread Ivan Sagalaev
Carlos Yoder wrote: > I wonder if more people were/are confused by that sentence (found > here: http://www.djangoproject.com/documentation/install/)...? Well... Mod_python is the easiest method of running django, FastCGI setup is more advanced and usually requires basic knowledge about forking

Re: Partial change manipulator

2006-07-10 Thread Ivan Sagalaev
Greg wrote: > Is there a way to specify a _subset_ of the fields in a model for > the ChangeManipulator to operate on? You can set editable=False on those fields. Alternatively, if you use your custom views is to pass "follow" parameter in a manipulator constructor: manipulator = Model.Ch

Re: Limiting file size before upload?

2006-07-10 Thread Ivan Sagalaev
Malcolm Tredinnick wrote: > I'm not 100% certain either. However, of the only hope you (Apache) have > to avoid being hit by a truck is to hope that the guy behind you > (Django) hold up a stop sign in time, then I would start looking for a > plan B. AFAIK mod_python's handler is called very earl

Re: Bug in login method?

2006-07-10 Thread Ivan Sagalaev
mamcxyz wrote: > However user.backend not exist in the user model definition. This is because request.user is not exactly a User instance. It's a wrapper that is available from authenticate(username=username, password=password). This one is what should be passed to login(). --~--~-~--~

Re: Extending pluralize?

2006-07-14 Thread Ivan Sagalaev
Carlos Yoder wrote: > How would a newbie to both Python and Django such as me be able to > extend pluralize? Has anyone already faced this? Being Russian, a lot! Russian has 3 basic forms of pluralizing nouns with many variants of these forms for different declinations. So to solve this problem

Re: Extending pluralize?

2006-07-14 Thread Ivan Sagalaev
Russell Keith-Magee wrote: > This should be fairly easy to extend to a 1,2,3,4,... case; in your > dolphin case, something like delfin{{ num_delfinov|pluralize:",a,i,ov"}} > > (excuse my Slovenian if I've messed up your example :-) The problem is that it's not 1, 2, 3, 4 and others :-). For Rus

Re: Extending pluralize?

2006-07-14 Thread Ivan Sagalaev
y and is a big task in itself. > Then, if Ivan wants to contribute a 'declention' template tag that > supports Russian pluralization (and is flexible enough to handle other > languages with 'complex' pluralization, e.g., Latin), I'd be happy to > add it. It

Re: unbuffered output to client/end-user

2006-07-15 Thread Ivan Sagalaev
Nick wrote: > Martin, > > Cool, this actually works with yielding, thank you very much. By the way remember that this response generation happens after the moment when Django considers the response handled. This means that if you, say, use any DB related functionality when generating response

Re: unbuffered output to client/end-user

2006-07-16 Thread Ivan Sagalaev
Nick wrote: > Martin, Well, not exactly :-) > You mean if I access the model? Yes. By the time your response iterator starts working Django has already closed the database connection used in the request. If you try to access a model a connection will be automatically opened again but never c

Re: cherokee server and django - fast-cgi/scgi rumble

2006-07-17 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > if settings.APPEND_SLASH and (old_url[1][-1] != '/') and ('.' not > in old_url[1].split('/')[-1]): > IndexError: string index out of range > -- > and in the browse flup shows a simillar bigger... What am I doing > wrong? :)

Re: Related tags query, many-to-many double join

2006-07-19 Thread Ivan Sagalaev
Maciej Bliziński wrote: > Hello djangoers, > > Having documents and tags with many-to-many relationship, I'd like to > take a tag and find its related tags. In other words, what other tags > are associated with documents that are associated to my tag? > > A small(est I could make it) example: >

Re: Model for uppercase CharField ?

2006-07-23 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > Hi all, > > I had the need for a CharField which stores the values always in uppercase > form. Is there a solution out there ? > > Maybe the follwing simple generic solution would be fine: > > class UpperCase(models.Model): >uppercase_field = models.CharField(max

Re: Simple: How do you organize your directories?

2006-07-25 Thread Ivan Sagalaev
Sean Schertell wrote: > In the tutorial, it says to not keep your app in the document root > for security reasons. Okay that makes sense. But what *does* go in > the document root? I keep all my code off the webroot including js and css (I have aliases for them to be visible from the web). I

Re: Render HTML in choices

2006-08-07 Thread Ivan Sagalaev
skullvulture wrote: > In my model I have a field that has choices and in the display of those > choices I need the degrees symbol, so I put in '°' however the > admin page does not render the html in my choice set in the drop down > menu. Is there a way to get it to render the html? Thanks. I ca

Re: Best way to construct an email - attach a html file and send

2006-08-09 Thread Ivan Sagalaev
a wrote: > What is the best way to construct an email in python and also attach a > html file You can use 'email' package from Python's standard library to create MIME message with an attachment. > the html file to be attached is not on disk, but should be dynamically > constructed in the pytho

<    1   2   3   4   5   6   >