Re: low performance of FastCGI deployment

2007-03-14 Thread Ivan Sagalaev
Alexander Boldakov wrote: > Django deployment documentation claims the need of flup as the FastCGI > library. Are there any flup features that Django relies on? Nothing specific. Flup is recommended because it's pure Python and easier to install. Also documentation *strongly* recommends not to

Re: problem with template {% url string %}

2007-03-19 Thread Ivan Sagalaev
Paul Rauch wrote: > Template: > {% url cvh.view.login %} Here you have "view". > urlpatterns = patterns('mysite.cvh.views', > (r'^$','index'), > (r'^login/$','login'), > ) And here you have "views". {% url %} doesn't find your pattern and returns '' (empty string) that browser translates to

Re: models.ManyToManyField: Multi-relationship in one table

2007-03-20 Thread Ivan Sagalaev
hoamon wrote: > Course|Trainee|Company > C1| T1 | Com1 > C1| T2 | Com1 > C1| T3 | Com1 > C2| T1 | Com2 > C2| T3 | Com1 > C2| T4 | Com2 > C3| T1 | Com2 You really can't do it using standard ManyToManyField. The common way is to create this r

Re: Newbie problem with view/model interaction

2007-03-24 Thread Ivan Sagalaev
Ross Burton wrote: > then in the view: > > {% for paper in object_list|dictsort:"title" %} > {% if paper.has_voted( TODO ) %} > Not related to your question, but this is called 'template' in Django. 'View' means a different thing (a controller). > I then discovered that you can't pass a

Re: Django Set HTTP Error manually

2007-04-09 Thread Ivan Sagalaev
johnny wrote: > What I want to do is set HTTP Error manually in my view, when a > request is made to certain url, without post data. > > At a particular url, my view is looking for XML document to be sent > over http, by post. If a request come in without post, I want to > raise an error "405 Me

Re: Variable value in template

2007-04-11 Thread Ivan Sagalaev
Kai Kuehne wrote: > With this > > Team: > {% for team in object.squad.team_set.all %} > {% appearance_count_for_team team.id %} > > and > > class AppearanceCountForTeamNode(template.Node): > def __init__(self, team_id): > print team_id > ... > > I get "team.i

Re: Implementing OpenID in your Django app

2007-04-24 Thread Ivan Sagalaev
Simon Willison wrote: > Hi all, > > I've just released the first version of an OpenID consumer package for > Django. The idea is to make it ridiculously easy to add OpenID > consumer support to any Django application - and hence allow users of > OpenID to sign in without having to set up a new us

Syntax highlighting

2007-04-28 Thread Ivan Sagalaev
I am developing a non-intrusive javascript syntax highlighter for use in blogs. Recently I've added support for highlighting Django templates and now I feel it can be indeed useful for people writing about Django. Check it out: http://softwaremaniacs.org/soft/highlight/en/ --~--~-~--~-

Re: TextInput({'onKeydown': 'some javascript code'} problem

2007-05-01 Thread Ivan Sagalaev
hoamon wrote: > how can i customize the fields in the newforms, or i walk the wrong > way ?? What you described is an issue but I want to advice a different technique that doesn't suffer from this issue and also considered more robust. You shouldn't mix your HTML with Javascript, instead you s

Re: TextInput({'onKeydown': 'some javascript code'} problem

2007-05-02 Thread Ivan Sagalaev
hoamon wrote: > no.setAttribute("onKeydown", 'Element.update("NO_CHECK", " src=http://mydomain/arrows.gif>");'); Instead of assigning a raw onkeydown attribute it's better to attach an event. Look into prototype.js' docs, I bet it can do this in a cross-browser fashion. Something like Event(

Search options

2007-05-11 Thread Ivan Sagalaev
Hello! I'd like to ask everyone's opinion on implementing a search functionality in an app. The app is a forum that tends to be simple and pluggable. Now I'm on a quest of picking a right solution for searching and have stuck. My current thoughts and decision: - Searching using "like" db que

Re: LIKE '%something%' custom queries

2007-05-23 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > I'm reimplementing an in-database tree system and I'm using custom SQL > queries. I want to use % in LIKE but Django doesn't let me. > > The code: > ## > def getBranch(table_name, parent_depth, parent_cutLevel, max_depth): > cursor = connection.cursor(

Re: Unicode-branch: testers wanted

2007-05-24 Thread Ivan Sagalaev
Malcolm Tredinnick wrote: > The unicode branch, [1], is now at a point where it is essentially > feature-complete and could do with a bit of heavy testing from the wider > community. Switched my site today to the branch. Works like a charm (translations, admin, multilingual content). --~--~

Test DB creation parameters

2007-05-28 Thread Ivan Sagalaev
Michal wrote: > It seems like the test database is created in SQL_ASCII encoding. I > looked into psql terminal and found: > > List of databases >Name | Owner| Encoding > -++--- > gr4unicode | pgsql | UNICODE > te

Re: ChangeManipulator and default value not working.

2007-05-30 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > Oh..I meant to mention that this is using the default > ChangeManipulator for the class. Then set to the field 'editable=False' and manipulator won't touch it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: Too many queries generated by ChangeManipulator

2007-05-31 Thread Ivan Sagalaev
Russell Keith-Magee wrote: > On 6/1/07, char <[EMAIL PROTECTED]> wrote: >> Obviously, the performance deteriorates rapidly as the number of >> GamesOfInterest added to a Profile increases. Is there any way to >> avoid this? > > This is a known problem, and one of the many reasons that the forms >

Re: why HTML output in unicode?

2007-10-12 Thread Ivan Sagalaev
Ken wrote: > Sorry if this is a stupid question, but why do forms output HTML as > unicode strings? Is this arbitrary or is there some grand convention > we are all supposed to be following? The general convention is that all strings inside your project are supposed to be unicode. They are only

Re: Reversing a url with a get parameter

2007-10-17 Thread Ivan Sagalaev
Rufman wrote: > hey guys > > I need a little help reversing urls with a get parameter. > > I'm using urlresolvers.reverse() in my view to reverse the url as > follows: > reverse(pageName, kwargs={'page' : page}) > > If i try passing thre request.GET object as so: > > reverse(pageName, args=[re

Re: ascii decode error bites again

2007-11-01 Thread Ivan Sagalaev
Kenneth Gonsalves wrote: > ProgrammingError at /web/admin/web/fosscalendar/add/ > ERROR: character 0xe28099 of encoding "UNICODE" has no equivalent in > "LATIN1" INSERT INTO > "web_fosscalendar" ("name","year","startdate","enddate","city_id","venue > ","organiser","scope","website","contact")

Re: Using {% ifequal %} in my template is not working

2007-11-10 Thread Ivan Sagalaev
Greg wrote: > request.session['info'].update(shape=ProductShape.objects.get(id=request['shape'])) > return render_to_response('search.htm', {'pinfo': > request.session['info']} This might be because of your first line here doesn't work as expected. Session is not exactly a dict and one of the th

Understanding autoescape-aware filters

2007-11-17 Thread Ivan Sagalaev
Hello! I'm about to convert my apps to play well with recently introduced autoescaping but I have to confess that I don't get mark_safe, is_safe and needs_autoescaping. First, I don't get why .is_safe attribute is needed at all. If my filter returns any HTML I should escape it and mark_safe

Re: advice on template shortcomings

2007-11-17 Thread Ivan Sagalaev
Ken wrote: > For instance, I > cant pass a dict or a list of lists to the template. Actually it's not true, you can perfectly pass and access dicts and lists and whatever in templates. Can you describe your specific case that didn't work? --~--~-~--~~~---~--~~ Y

Re: Understanding autoescape-aware filters

2007-11-17 Thread Ivan Sagalaev
SmileyChris wrote: > It's explained here: > http://www.djangoproject.com/documentation/templates_python/#filters-and-auto-escaping Yes, I've asked the group after I've read those docs, twice :-). First time I thought that I was just slow but the second time I didn't understand again and asked f

Re: Understanding autoescape-aware filters

2007-11-18 Thread Ivan Sagalaev
Malcolm, first of all, I should apologies. I actually intended my letter being 'funny' but after your answer I understand that it was just harsh :-(. I'm sorry. And let me again express that I never stopped to wonder how you manage to do so many great things in Django. Thank you very much! Sti

Re: Understanding autoescape-aware filters

2007-11-21 Thread Ivan Sagalaev
Thanks for clarification! I have couple more things to iron out though... Malcolm Tredinnick wrote: > If we didn't have is_safe, every filter that did some kind of string > manipulation such as input = intput + 'x' would need to end with lines > like > > if isinstance(orig_input, SafeDat

Re: just starting out with django along with the tutorial - getting a type error

2007-12-11 Thread Ivan Levchenko
_numb = models.IntegerField(). > > Since 'ticket_numb' is an integer, you cannot return it unadorned form > __unicode__. Return unicode(self.ticket_numb) instead. > > Regards, > Malcolm > > -- > Two wrongs are only the beginning. > http://www.pointy-stick.com/blog/ &

Re: just starting out with django along with the tutorial - getting a type error

2007-12-11 Thread Ivan Levchenko
Thanks to Malcolm for helping me out, and thanks l5x for the help too! On Dec 11, 2007 2:40 PM, l5x <[EMAIL PROTECTED]> wrote: > > Oops, Malcolm answered first :) > > > > -- Best Regards, Ivan Levchenko [EMAIL PROTECTED] --~--~-~--~~~-

Re: Django auth user relation to other connected objects

2007-12-15 Thread Ivan Sagalaev
Przemyslaw Wroblewski wrote: > When I started using django I create sth like this in my views: > > Somemodel.objects.filter(user = request.user) > > But I don't like that scheme, I just want to create something similar > to rails like: > > "current_user.somemodel.find_by_name('x')" You want th

Re: Charfield maxlength (bug?)

2006-09-18 Thread Ivan Sagalaev
Enrico wrote: > Ivan, I think it's not a problem on the DB side, I'm using MySQL and > AFAIK it just crops the string without any warning. Then may be I am mistaken... What I'm talking about is that maxlength is validated properly on manipulator level (method TextFi

Re: Charfield maxlength (bug?)

2006-09-19 Thread Ivan Sagalaev
Enrico wrote: > Hi, > > It raises a "programming error": > > (1064, "You have an error in your SQL syntax. Check the manual that > corresponds to your MySQL server version for the right syntax to use > near 'WARNINGS' at line 1") Oh... Then I'm out, don't know much about MySQL in this regard. B

Re: how do you name the 'main' app?

2006-09-20 Thread Ivan Sagalaev
gabor wrote: > so, how do you name your 'main' app in a django-project? For me it depends on project's type. If a project is autonomous and serves one purpose then, yes, I call the main app 'main' and it could even be the only app in the project. If a project is multi-purpose and just powers a

Re: seeking clarification: custom manipulator foreign key / many-to-many

2006-09-20 Thread Ivan Sagalaev
va:patrick.kranzlmueller wrote: > self.fields = ( > forms.CheckboxSelectMultipleField(field_name="music", > choices=MUSIC_CHOICES), > ... > ) I guess I know what is it... CheckboxSelectMultipleField worksinexplicably different from SelectMultipleField i

Re: seeking clarification: custom manipulator foreign key / many-to-many

2006-09-20 Thread Ivan Sagalaev
patrickk wrote: > thanks. the data is sent now, but > - how do I save the data in my custom manipulator, referring to: > temp.set_music(data['music']) It looks like 0.91 syntax. If you're using contemporary Django it should look like this: temp.music = Music.objects.filter(id__id=data['mus

Re: seeking clarification: custom manipulator foreign key / many-to-many

2006-09-21 Thread Ivan Sagalaev
Aidas Bendoraitis wrote: > Has your Music model a __str__ method? Maybe you get nothing using {{ > form.music }} because it is represented in no way. In fact {{ form.music }} has nothing to do with the model itself. It's a manipulator's field and should be represented as a group of checkboxes

Re: seeking clarification: custom manipulator foreign key / many-to-many

2006-09-21 Thread Ivan Sagalaev
patrickk wrote: > are there any workarounds? > I´m still not able to save and retrieve the m2m-data. and since I > have to meet a deadline I´m getting kind of nervous. In your view code you use flatten_data() but I can't see it defined in your custom manipulator. This must raise an exception b

Re: seeking clarification: custom manipulator foreign key / many-to-many

2006-09-21 Thread Ivan Sagalaev
patrickk wrote: > flatten_data() doesn´t relate to the custom manipulator but to model > resp. the changemanipulator. I see now... And if I'm guessing correctly you're creating a FormWrapper from user_profile_manipulator that just doesn't have that checkbox field. Anyway making two manipulato

Re: seeking clarification: custom manipulator foreign key / many-to-many

2006-09-21 Thread Ivan Sagalaev
patrickk wrote: > well, now I´m totally confused. > I though that´s exactly what custom manipulators are here for: > "You can easily create your own custom manipulators for handling > custom forms." (django documentation). All manipulators handle forms: - prepare initial data - validate data -

Re: seeking clarification: custom manipulator foreign key / many-to-many

2006-09-21 Thread Ivan Sagalaev
patrickk wrote: > I don´t want to stress your help, but do you know where to find an > example on using a custom manipulator for *updating* data. > > question is, where does the custom manipulator gets the data (stored > in the database) from. > the way I did it so far: > 1. using a changmani

Re: seeking clarification: custom manipulator foreign key / many-to-many

2006-09-23 Thread Ivan Sagalaev
patrickk wrote: > thanks, I think I´ve got it now. > > the documentation of custom manipulators really lacks advanced examples. > I don´t know how one should find out what you explained in the last > few mails by reading the documentation. > e.g., I´m quite sure that there´s no explanation of "

Re: how do I tell which revision I'm using

2006-09-23 Thread Ivan Sagalaev
Tamara D. Snyder wrote: > Hi all, > > I'm sorry, I'm sure this is an extremely simple thing that I am just > stupidly missing. But I can't seem to figure out which revision of > the django code I am using. I use subversion to download the "latest > version" - but I only do it every so oft

Re: Creating DB objects from dictionaries

2006-09-26 Thread Ivan Sagalaev
James Mulholland wrote: > Suppose I have a dictionary like this: > > data = { 'a':'1', 'b':'2', 'c':'3' } > > and a model like this: > > class Test(models.Model): > a = models.CharField(maxlength=8) > b = models.CharField(maxlength=8) > b = models.CharField(maxlength=8) > > I would

Re: Making a date_created field work

2006-09-27 Thread Ivan Sagalaev
James Bennett wrote: > Default values are *only* filled in when the field is displayed on an > end-user form. If you don't want to display a field, but still > automatically fill it in, you have two options: > > 1) Have your view code fill it in before doing manipulator validation > 2) Set 'blank

Re: Model-level DB cache

2006-09-27 Thread Ivan Sagalaev
Greg Plesur wrote: > But I would _not_ expect to see this: >>>> x=SomeModel.objects.all() # This gets a QuerySet into x >>>> value = x[0] # Some operation to actually fill x's cache >>>> print len(x) # Verify that there are some entries in the table >2 > >>>> y=SomeMode

Django + FCGI on 1and1 shared hosting

2006-09-28 Thread Ivan Manolov
access to apache's error log and the CGI Output Monitor they have on the control panel simply says "Network Error". Does anyone have an idea why I get a 500 Error on every few requests? Thank you. Ivan --~--~-~--~~~---~--~~ You received this messag

Re: authentication/access control for static files

2006-09-28 Thread Ivan Sagalaev
Bedros Hanounik wrote: > thanks for the quick response; that should work for me for now (low > traffic); but I wonder how it scales with high traffic site. Also, any > idea how this may apply to lighttpd. In Lighty there is a "secure download" module (http://trac.lighttpd.net/trac/wiki/Docs%3A

Re: Project level template tags?

2006-09-28 Thread Ivan Sagalaev
zenx wrote: > Hi, > I was wondering if it was possible to create project level template > tags that can be called by any app template. Create an app specially for such tags, name it like "common_tags", include it in INSTALLED_APPS and then you can use those tags throughout the project using {%

Re: Why I'm giving up on Django

2006-09-29 Thread Ivan Sagalaev
Sean Schertell wrote: > Instead of > providing some simple facility to let you override parts of the > standard manipulators In fact you can do just that. Though it's not clearly documented. I recently wrote about it here: http://groups.google.com/group/django-users/tree/browse_frm/thread/f

Re: Why I'm giving up on Django

2006-09-29 Thread Ivan Sagalaev
DavidA wrote: > I agree that the UI could be tweaked to make it more obvious, like > changing "Local vars" to "Click here to show local vars". This will just make this pile of text look more scary :-). You and Daniel didn't read it in the first place so changing text won't help. But what will h

Re: Why I'm giving up on Django

2006-09-29 Thread Ivan Sagalaev
Wilson Miner wrote: > That was actually a conscious decision to keep from needing support > images for the debug pages. I wanted them to be completely > self-contained, which is why we used the unicode glyph for the > disclosure triangle (a pretty universal UI indicator) to indicate that > those s

Re: problem to solving URL

2006-09-30 Thread Ivan Sagalaev
Marco Amato wrote: > and URL.py > > ### > from django.conf.urls.defaults import * > > urlpatterns = patterns('', > # Example: > (r'^base/$', include('test.selecto.views')), > > # Uncomment this for admin: > (r'^admin/$', include('django.contrib.admin.urls')), > ) > ###

Re: URL config, patterns

2006-09-30 Thread Ivan Sagalaev
Ice9 wrote: > In my app1/urls.py I have something like: > > urlpatterns = patterns('probob.app1.views', > (r'^$', 'index'), > (r'^test/', 'XXX'), > ) > > where XXX I want to refer to 'probob.app2.views.foo'; however django is > going to make it refer to 'probob.app.views.probob.a

Re: Support for static content?

2006-10-04 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > I > need a clean separation between the data that is changed by > interacting with apps and data that isn't. You can store your data in the form of templates and use 'direct_to_template' to bind it to certain urls: http://www.djangoproject.com/documentation/generic_vi

Re: Support for static content?

2006-10-05 Thread Ivan Sagalaev
John M wrote: > Curious, does that give you the full user context too? Yes, all generic views use RequestContext. Which means you have not only 'user' available but everything that your context processors provide. They are listed in settings as TEMPLATE_CONTEXT_PROCESSORS and you can use your

Re: HTML entities

2006-10-05 Thread Ivan Sagalaev
Dirk Eschler wrote: > In theory i can just use utf-8, but what if one participant in the line (os, > db, browser, whatever) can't handle it? Talking about client side, only very old browsers can't handle utf-8 (NN4 and IE4 can). Same goes for email clients. And even such simple and 'legacy'

Re: ChangeManipulator

2006-10-06 Thread Ivan Sagalaev
RajeshD wrote: > See Ivan's example code here for a hint on this: > http://groups-beta.google.com/group/django-users/msg/f1635e9a27c6ae68 For this particular case (where you only need disable, not replace fields) that example is an overkill. For disabling it's better to use 'follow' (James Benn

Re: can't get LANGUAGES to work in the base template

2006-10-08 Thread Ivan Sagalaev
Baurzhan Ismagulov wrote: > I'm using django 0.96 r3709. I have base.html, page1.html, and > page2.html templates. The latter two extend the former one. base.html > creates a box with all supported LANGUAGES. This works as > expected in page1, but not in page2. page1 is a verdjn templatepage > (r

Re: Storing UTC Time Zone Deviations In My Model?

2006-10-09 Thread Ivan Sagalaev
gkelly wrote: > I have been struggling with timezones in my application as well. I've > looked into using the PyTZ module from http://pytz.sourceforge.net/ BTW it weighs about a megabyte :-). The reason is that it's not enough to just store a deviation from UTC to get the right local time. Diff

Re: How do I pass a value through a template?

2006-10-10 Thread Ivan Sagalaev
carlwenrich wrote: > I have a view A that passes values (via dictionary pairs) to template > B, which has a form that posts values to a view C. I'd like to pass a > value from view A to view C through template B without having it appear > as a value in a visual element of the form. There are a co

Re: How do I pass a value through a template?

2006-10-10 Thread Ivan Sagalaev
carlwenrich wrote: > Thanks. I like the hidden input type idea. In practice it's harder. You will clutter your code with unnecessary serialization and deserializations, you will have to always remember to add values both in views and templates. And if you want to pass them not over form submit

Re: TagsField app and m2m bug

2006-10-20 Thread Ivan Sagalaev
()' which is illegal in MySQL (5.0.24a). Ouch... Thanks, I'll fix it shortly. > The reason I'm posting this on django-users instead of just reporting > the bug to Ivan directly, is because I'm curious whether this is > "correct" behavior. If 'IN ()' i

Re: Syntax highlighter

2006-10-27 Thread Ivan Sagalaev
Grigory Fateyev wrote: > http://softwaremaniacs.org/blog/2006/10/18/highlight-js-java/ > You should try Ivan Sagalaev's code! The actual app is here: http://softwaremaniacs.org/soft/highlight/ And until I translate it into English it's usage should be understandable just from

Re: Full table fetches behind the scenes

2006-11-03 Thread Ivan Sagalaev
Andres Luga wrote: > I've set up MySQL to log all queries to the database. In Django I'm > using generic views. I have the following models/tables: > 1. Firm > 2. Person ( ForeignKey( Firm )) I suppose you are using a generic view from 'create_update' package that deals with forms for object? Th

Re: A question about for loop in templates

2006-11-05 Thread Ivan Sagalaev
Vizcayno wrote: > info_dict = { 'data': lst, >'poscol': ( 2,0,11,29,18,..) > return render_to_response('pres_marcaciones.html', info_dict) Instead of passing this two pieces into template and handle them there you should do this right in the view and pass already constructed tabl

Re: Creating one call for most recent entry, and another call for the restI have just set up a blog using the helpful tutorial over at

2006-11-05 Thread Ivan Sagalaev
Andy wrote: > http://paste.e-scribe.com/2598/ > > Check it out! Wouldn't {% ifequal forloop.counter 1 %} ) (without quotes around 1) do the trick? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" gr

Re: A question about for loop in templates

2006-11-05 Thread Ivan Sagalaev
Vizcayno wrote: > but the only idea > that this recommended solution represents a double processing > (accommodate the list) and double use of memory with 'table' restrained > me to continue and send this message 'Premature optimization is the root of all evil' :-). In this case, if only your da

Re: Problems with template IFs and generic views

2006-11-06 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > I'm using django.views.generic.list_detail.object_detail to show a > page. Beside text it has optional "leftmenu" field. What I want to do > is to show it in a html block if it exists (there is somethign in > "leftmenu"). The problem is that it shows always or never. >

Re: how to do complex query which filters on method not database field

2006-11-06 Thread Ivan Sagalaev
Rachel Willmer wrote: > I have a complicated query which should return the subset of a table > whose objects match one of several conditions. > > What's the easiest way of doing this, given that I can't just do a SQL > statement, because some of the conditions require me to feed the > object's va

Re: How would you do this on Django?

2006-11-07 Thread Ivan Sagalaev
Carlos Yoder wrote: > As to URLs, I'd need to support at least the following three schemes: > > * Language codes mapped to directories (http://maindomain.com/en/ and > http://maindomain.com/sl/ and http://maindomain.com/es/) > * Language codes mapped to subdomains (http://en.maindomain.com/ an

Re: UnicodeEncodeError with templatetags

2006-11-07 Thread Ivan Sagalaev
David Abrahams wrote: > I've been running into a problem that seems very similar to > http://code.djangoproject.com/ticket/170, although I see that that > issue was fixed so I am betting the bug is on my end somewhere. > Unfortunately, I'm a little green w.r.t. unicode issues so I'm hoping > someo

Re: UnicodeEncodeError with templatetags

2006-11-08 Thread Ivan Sagalaev
David Abrahams wrote: > Oh, wow; I may well be doing that all over. Is it possible to > instruct Python to make that an error rather than silently succeeding > to do something that I shouldn't do? I'm not sure but I remember reading that in Python 2.5 it becomes a Warning... >> The question is

Re: tabindex HTML attribute: any way to assign to form fields in Generic Views?

2006-11-10 Thread Ivan Sagalaev
Twitchmedia wrote: > Does anyone know if it's possible to assign tabindex values to forms in > a Generic View within the template? Since the INPUT fields are > automatically generated Yet still you have access to raw data. Instead of: {{ form.myfield }} you can write something like:

Re: have mltiple different models ForeignKey the same model and still conveniently get all the data from all other models?

2006-11-12 Thread Ivan Sagalaev
> class Container(models.Model): > # This is my container model. It will later be displayed as its > # title and a list of *Thing instances which all are formatted > # in a different fashion. > # ofc each Container can contain any number of any *Thing model > # instance >

Re: Django lighttpd concepts question

2006-11-13 Thread Ivan Sagalaev
Tom Smith wrote: > For example, I have made a change to my models.py file and I am > logging all sql to a log file... But when I sit and watch it, the OLD > sql is still getting executed... > > Could it be that having caching turned on is causing this? > > Does Django automatically reload py

Re: Wrapper around a Generic View

2006-11-13 Thread Ivan Sagalaev
Merric Mercer wrote: > I'm still a little uncertain of how to put a wrapper around a generic > view. Given the following code below how does one handle pagination and > other > work that generic views does automatically. > > from django.views.generic.list_detail import object_list > > def gen

Re: Django lighttpd concepts question

2006-11-13 Thread Ivan Sagalaev
Tom Smith wrote: > So.. when doing a ps -ux I get... > > tomsmith 22106 0.0 0.0 6836 8 ?? SN Thu11AM 0:03.42 [python] > tomsmith 22107 0.0 0.0 14772 8 ?? SN Thu11AM 0:06.32 [python] > tomsmit h 22108 0.0 0.0 15352 8 ?? SN Thu11AM 0:04.84 [python] > tomsmith 23

Re: My own auth backend

2006-11-14 Thread Ivan Sagalaev
Grigory Fateyev wrote: > If I undastand, your MIDDLEWARE code checks any permissions through any > view, right? You and Andrew use different approaches. Your backend is checking a password against a foreign database and then creates a new Django user corresponding to that account. You don't nee

Re: error: default date submitted as integer?

2006-11-15 Thread Ivan Sagalaev
James Bennett wrote: > The fact that the model defines some default > values doesn't actually mean you can leave those out -- default values > are *only* used when displaying a form to the user, they're not > "auto-filled" by Django in other cases. James, the code says otherwise (or I am really l

Re: Pagination with Custom Views

2006-11-16 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > Hey, > > I was just wondering if someone could help me out. I want to paginate > some views, but they are not generic. This is one of the views I want > to paginate: > > def category_list(request): > categories = Category.objects.order_by('name') > > retur

Re: have mltiple different models ForeignKey the same model and still conveniently get all the data from all other models?

2006-11-16 Thread Ivan Sagalaev
Karsten W. Rohrbach wrote: > > > This is a very neat idea. > Two questions arise for me as a Django newbie: > - How do I convince django.contrib.admin to edit "*thing" contents > inline? > - What's the preferred method to implement a tree view for the > resulting structure in admin (for example

Re: Pagination with Custom Views

2006-11-16 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > Specifically: > > unsupported operand type(s) for -: 'str' an Oh... I've forgot to cast a string to an int :-). The line: int(request.GET.get('page', '1')) In fact you should also check for errors here because user can submit something with "page=blah" and it w

Re: Search question

2006-11-16 Thread Ivan Sagalaev
Giorgio Salluzzo wrote: > I've got some Organization, where each one has some User. A User can > write a Ticket. > > How can I filter all the Ticket for a single Organization? Ticket.objects.filter(user__organization__name='SomeOrg') ('user' and 'organization' should be the names of foreign key

Re: have mltiple different models ForeignKey the same model and still conveniently get all the data from all other models?

2006-11-16 Thread Ivan Sagalaev
Karsten W. Rohrbach wrote: > Thanks for the quick reply. However, configurable containers with > configurable collections of content is one of the more prominent use > cases for a publishing platform (IMVHO) and I somehow took the "Django > is for creating CMSes" phrase too literally, it seems. T

Re: Status of Oracle support in Django (trunk?)

2006-11-17 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > What is the exact status of Oracle support with Django? > Is it fully supported? With caveats? In trunk branch? Today was a call for test of this backend in django-developers list. So I'd say it's roughly equivalent to "beta". > In other words, can I finally tell my b

Re: Template for a calendar?

2006-11-18 Thread Ivan Sagalaev
Guillermo Fernandez Castellanos wrote: > In that case, people tend to hardcode teh /event/ part into the > get_absolute_url function of the model. There's a better (IMHO) way to do this with reverse url lookup for a given view that Adrian has added not long before 0.95. Usually an app knows its

Re: Template for a calendar?

2006-11-18 Thread Ivan Sagalaev
Guillermo Fernandez Castellanos wrote: > But then, is this not going against the DYR principle? In my case, if > I have to change my mind I simply have to change a varialbe, while in > your case I've to change the whole lot of templates, even if your > option might be 'cleaner'. No you shouldn't.

Re: Template for a calendar?

2006-11-18 Thread Ivan Sagalaev
Guillermo Fernandez Castellanos wrote: > And what about the admin "view on site" and the feeds? They both > depend on the get_absolute_url. How could this be 'integrated' as well > into your solution? Reverse is not designed to replace get_absolute_url. It's just a more general solution because

Re: Duplication of inline objets y custom template

2006-11-19 Thread Ivan Sagalaev
ElGranAzul wrote: > Hi all. > > I'm creating a custom template and I'm following the instructions in > http://www.pointy-stick.com/blog/2006/07/03/django-tips-forms-multiple-inline-objects/. > Al works good, but when i modify the main model, the children are > duplicated. You're probably don't i

Re: related model in an order_by clause

2006-11-27 Thread Ivan Sagalaev
Benedict Verheyen wrote: > There are about 7 possible risks types and every risk is coupled to a > patient. Every patient has a room. > When i display all the risks of a certain type, i also need the patient > info and the room, sorted by the room. > That's why is was trying to get the roomnumber

Re: How to get request.user in templatetag?

2006-11-27 Thread Ivan Sagalaev
Rob Hudson wrote: > The place I need it is the: > class CommentFormNode(template.Node): You probably need it in this node's 'render' method. There you have a context passed to it and this context is exactly the thing that holds all the variables including 'user'. So this is it: class

Re: manage.py webserver

2006-11-28 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > Now with django, I am trying to run through the "Are you generic" > tutorial. When I go out to the URL, I get a 404 "Page not found" > message, but absolutely no more information as to where to look! I > thought by using the devel version with the verbosity flag, i

Re: best place to put dispatcher.connect code?

2006-11-29 Thread Ivan Sagalaev
Le Roux Bodenstein wrote: > Surely if I put it > in a model or a view or whatever somewhere it will only be called the > first time that module gets loaded? The settings module is always imported so you can import your handling code there and put dispatch.connect beside the handling code. --~--

Re: import problems?

2006-12-01 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > Sorry if this is poorly explained, but how do you efficiently get > around circular dependency problems like this in Python? I'd hate to > have to drop my import of functions_db to the individual methods on > "Object" to avoid whatever collision is happening. Another (i

Re: [validators] - access to object.id field

2006-12-01 Thread Ivan Sagalaev
Marcin Jurczuk wrote: > Hello, > I'm writing my own validator based on shipped with django and wondering > how get validated object.id field ? Validators come in two varieties: those linked to field definitions in models and those that linked to field definitions in custom manipulators. With fi

Re: using manipulators without defining fields again

2006-12-01 Thread Ivan Sagalaev
Milan Andric wrote: > I was told in IRC to extend AutomaticManipulator. But I don't really > know what this means in terms of Django/Python code. Basically you create a manipulator class inherited from an automatic manipulator of a model. It will create all the needed FormFields based on model

Re: Auto-login with REMOTE_USER

2006-12-01 Thread Ivan Sagalaev
dchandek wrote: > I've looked at authentication backends and middleware, but it looks > like the default Django installation expects users to login through a > Django form. Default system insist on storing logged user credentials in a session (though they can be of any nature). In your case you

Re: Auto-login with REMOTE_USER

2006-12-01 Thread Ivan Sagalaev
Ivan Sagalaev wrote: > request.user = User.objects.get_or_create( >username=username, >defaults={...}) This one should be: request.user, created = User.objects.get_or_create(...) `get_or_create` returns an object and a flag if it was newl

Re: Auto-login with REMOTE_USER

2006-12-01 Thread Ivan Sagalaev
Brian Beck wrote: > I just wanted to add that if you want to use this method in combination > with the bundled admin interface, you're gonna have to intercept any > admin requests and do the authentication ... which is achieved by placing this middleware before standard auth middleware. --~--~-

Re: Auto-login with REMOTE_USER

2006-12-01 Thread Ivan Sagalaev
Brian Beck wrote: > I don't understand how this is related to the admin interface. Admin interface won't display a login page if you already have request.user set to an existing user. (if I'm not mistaken :-) ). > Anyway, > shouldn't it go after the standard auth middleware, so that > django.co

Re: Calling model-functions in template

2006-12-03 Thread Ivan Sagalaev
Kai Kuehne wrote: > models.py: > def genres_title_list(self, separator=', '): > return separator.join([x.title for x in self.genres]) If I reconstruct the case correctly and `genres` is a relation to child objects with ForeignKey to a Movie then `self.genres` by default should look

Re: File downloads

2006-12-03 Thread Ivan Sagalaev
marksibly wrote: > I couldn't find a 'HttpResponseStaticFile' class or anything, so what > other options do I have? You can pass an open file to a usual HttpResponse: f = open(filename, 'rb') return HttpResponse(f, mimetype='application/octet-stream') > Also, how efficient would it be

<    1   2   3   4   5   6   >