Re: subversion and staying up to date
On 02-Feb-07, at 12:16 AM, mtnpaul wrote: > It seems that if I do this every day, every morning *after* coffee - you may need the stimulant, but joking aside, the commits are usually so responsible that you could do it before coffee -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Forms inheritance
On 2/2/07, aaloy <[EMAIL PROTECTED]> wrote: > > Hello, > > I'm trying use form inheritance to render the form, but it seems > Django just renders the child fields and not the parent ones. Is this > a feature or a bug? > > > class Pare(forms.Form): >...: referencia = forms.CharField(max_length=12) > > class Fill(Pare): >...: test = forms.IntegerField() if you rewrite this like class Pare(forms.Form): def __init__( self, *args, **kwargs ): forms.Form( self, *args, **kwargs ) self.fields['referencia'] = forms.CharField(max_length=12) class Fill(Pare): ...: test = forms.IntegerField() it should work its just a workaround, but it works for me > > x = Pare() > y = Fill() > > x.as_table() > u' for="id_referencia">Referencia: id="id_referencia" type="text" name="referencia" maxlength="12" > />' > > y.as_table() > u'Test: type="text" name="test" id="id_test" />' > > What I would like to have on y.as_table() is > > u' for="id_referencia">Referencia: id="id_referencia" type="text" name="referencia" maxlength="12" > />' > u'Test: type="text" name="test" id="id_test" />' > > Is this possible? > > -- > Antoni Aloy L�pez > Binissalem - Mallorca > http://www.trespams.com > Soci de Bulma - http://www.bulma.cat > > > > -- Honza Kr�l E-Mail: [EMAIL PROTECTED] ICQ#: 107471613 Phone: +420 606 678585 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Forms inheritance
Hello, I'm trying use form inheritance to render the form, but it seems Django just renders the child fields and not the parent ones. Is this a feature or a bug? class Pare(forms.Form): ...: referencia = forms.CharField(max_length=12) class Fill(Pare): ...: test = forms.IntegerField() x = Pare() y = Fill() x.as_table() u'Referencia:' y.as_table() u'Test:' What I would like to have on y.as_table() is u'Referencia:' u'Test:' Is this possible? -- Antoni Aloy López Binissalem - Mallorca http://www.trespams.com Soci de Bulma - http://www.bulma.cat --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: order_by not working with foreign keys:
On 2/1/07, Michael Radziej <[EMAIL PROTECTED]> wrote: > > is there a > > HOWTO somewhere on how to write a test which does the whole model, > > database sync, etc etc cycle? > > http://www.djangoproject.com/documentation/testing/ > > explains how tests and fixtures work. Look for an existing test for > this and extend it. Just to clarify - the testing documentation refers to tests that you write for your own projects (i.e., unit testing your own Django application). The Django internal tests use the same doctest and unittest framework as your own application tests, but are executed using an internal testing framework. Django's internal tests are in the /tests directory, and are executed by running /tests/runtests.py. /tests/modeltests are tests that double as documentation (they get automagically turned into the online documentation at http://djangoproject.com/documentaion/models/); /tests/regressiontests contains more extensive tests, and tests to make sure that a particular bug never surfaces again. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: help with queryset and ManytoMany
On 2/1/07, Giorgio Salluzzo <[EMAIL PROTECTED]> wrote: > > class Project > ... > staff = models.ManyToMany(User) > > My concern is the fact that I should loop over all my projects and get > the staff for each ot them. If Project has a ManyToMany field, then Users will have a field called project_set. frank = User.objects.get(name='Frank') print frank.project_set will print all of the projects that Frank is involved in. The name project_set is automatically generated - you can override it if you want using the 'related_name' argument on the ManyToMany definition. See http://djangoproject.com/documentation/model_api/#relationships for more details. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django Admin throws exception when deleting object, many to many field
On 2/2/07, uğurdevriL <[EMAIL PROTECTED]> wrote: > > i added a new 'verb' object, using the django admin, when i want to > delete that object, django admin throws exception below: Look like this might be related to ticket #2828. The message is certainly familiar. If you can add any details to the ticket that might help us out, please do. Alternatively, if #2828 doesn't look like the same problem, please open a new ticket with your instructions on how to replicae the problem. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
noobie first project
I made it through the tutorial, finally :). Now, I want to attempt my first semi-real project (outside of the tutorial). I'm going to require registration to my site. Therefore, I will need some way to authenticate users. Is there something built- in that I'm supposed to be able to use for this? I'm not thinking the administrative interface I used in the tutorial is what I want. I don't want users to be able to see such a variety of stuff. Maybe I'm misunderstanding the utility of the built-in Administrative interface I saw in the tutorial. To me, it looks like something only for site administrators, as opposed to end users. And, while I'm thinking about it. When creating your own fields in the model, is there a password field type? I found the list of types in the documentation, but I couldn't find that. TIA, backdoc --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ImproperlyConfigured: Error importing middleware django.contrib.sessions.middleware: "No module named mysite"
Henrik, I've been stuck in a a place like Ron's all morning. I thought I had gotten to a later problem when I started getting Django errors indication that there was 'no module mysite.urls', but I just gave it another try, and I'm back to the mod-python error 'no module named mysite'. I seem to be at a point where I get to choose between the mod-python and Django errors about non-existence of modules. At least I no longer have Apache 'no such place' errors. Do you know why there is such a lag in response to configuration file changes? When I change httpd.conf and restart Apache, it seems to see new settings fairly quickly, but when I change settings.py, Django does not "catch up" for quite a while. I tried deleting everything I could find with a .pyc extension, but that does not seem to help, (and may be causing some actual harm?) I have gotten the full tutorial to work (WinXP, Python 2.4.1/mod- python3.2.8 /Django 0.95) with the development web server, and the next place to go is Apache (2.0.59, at least for now). I intend to move to Linux, but for reasons of practicality I am currently working in Windows. Thanks for any light you can shed on this. John. On Feb 1, 7:09 am, "HenrikG" <[EMAIL PROTECTED]> wrote: > Hi Ron! > > Try changing > '/home/rsie/projects/mysite' > to > '/home/rsie/projects' > > and also change > SetEnv DJANGO_SETTINGS_MODULE settings > to > SetEnv DJANGO_SETTINGS_MODULE mysite.settings > > regards, > /Henrik --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Uploading large files via http FORM
You have to config your apache, I think it's 10mo max by default --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multiple views on one page
Probably the easiest thing would be to send the form as you're doing, then bring the other stuff in with template tags. On Feb 1, 3:06 pm, "adamr" <[EMAIL PROTECTED]> wrote: > Yeah I think I get what you're saying now. I found a few tutorials > that used template tags to get data out of a model. Do you know if > there are any examples of how to do this with a form? > > On Feb 1, 2:56 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > Adamr, I still think you're looking for template tags. My index page, > > for example, just goes direct_to_template, then is filled up with > > various things from all over... login form, and at least three other > > apps. > > > On Feb 1, 1:45 pm, "ashwoods" <[EMAIL PROTECTED]> wrote: > > > > as far as i get it, its 1 view per url. - a view is a response to a > > > request, you ALWAYS get only one request, and for each posible request > > > (url) you make one view. > > > so if there is something you want to use over and over again in more > > > than one view (as a form), you just make a custom tag or a context > > > processor. this creates a "variable", in your case a form, that will > > > be available for all your "template-views". the form _should_ redirect > > > to 1 view that processes the form, and then redirects you where ever > > > you want. > > > > On Feb 1, 8:38 pm, "adamr" <[EMAIL PROTECTED]> wrote: > > > > > I still don't really grasp how that applies. > > > > > For example, my url processor will use the included view which auto- > > > > generates the login form when I go to "accounts/login/" > > > > > Alternatively, when someone goes to the index page, the url processor > > > > uses the "news" view so it can display the recent news from the > > > > database. > > > > > In my base.html template, I've made room for the login form. When > > > > someone goes to the index page, all I want django to do is use the > > > > view that generates the news, as well as use the view that will insert > > > > the login form. > > > > > On Feb 1, 2:04 pm, "ashwoods" <[EMAIL PROTECTED]> wrote: > > > > > > i might not be understanding exactly what you mean, but i think what > > > > > you want is > > > > > this:http://www.b-list.org/weblog/2006/06/14/django-tips-template-context-... > > > > > > On Feb 1, 7:54 pm, "adamr" <[EMAIL PROTECTED]> wrote: > > > > > > > Sorry, django.contrib.admin.urls is the wrong view, I am trying to > > > > > > use > > > > > > the correct login view. > > > > > > > On Feb 1, 1:51 pm, "adamr" <[EMAIL PROTECTED]> wrote: > > > > > > > > This seems like it should be a pretty easy concept, but I cannot > > > > > > > figure it out. I've spent the past day searching for how to > > > > > > > incorporate multiple views on the same page with absolutely no > > > > > > > luck. > > > > > > > This seems like a topic that would be crucial to incorporate into > > > > > > > the > > > > > > > documentation and/or tutorials. > > > > > > > > On my website I want to have a persistent login form that's on one > > > > > > > side of the page. So for example, my index page uses a view to > > > > > > > display > > > > > > > "news" posts from the database. How do I then also include the > > > > > > > built- > > > > > > > in authentication form on the side which uses the > > > > > > > django.contrib.admin.urls view? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multiple views on one page
Yeah I think I get what you're saying now. I found a few tutorials that used template tags to get data out of a model. Do you know if there are any examples of how to do this with a form? On Feb 1, 2:56 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Adamr, I still think you're looking for template tags. My index page, > for example, just goes direct_to_template, then is filled up with > various things from all over... login form, and at least three other > apps. > > On Feb 1, 1:45 pm, "ashwoods" <[EMAIL PROTECTED]> wrote: > > > as far as i get it, its 1 view per url. - a view is a response to a > > request, you ALWAYS get only one request, and for each posible request > > (url) you make one view. > > so if there is something you want to use over and over again in more > > than one view (as a form), you just make a custom tag or a context > > processor. this creates a "variable", in your case a form, that will > > be available for all your "template-views". the form _should_ redirect > > to 1 view that processes the form, and then redirects you where ever > > you want. > > > On Feb 1, 8:38 pm, "adamr" <[EMAIL PROTECTED]> wrote: > > > > I still don't really grasp how that applies. > > > > For example, my url processor will use the included view which auto- > > > generates the login form when I go to "accounts/login/" > > > > Alternatively, when someone goes to the index page, the url processor > > > uses the "news" view so it can display the recent news from the > > > database. > > > > In my base.html template, I've made room for the login form. When > > > someone goes to the index page, all I want django to do is use the > > > view that generates the news, as well as use the view that will insert > > > the login form. > > > > On Feb 1, 2:04 pm, "ashwoods" <[EMAIL PROTECTED]> wrote: > > > > > i might not be understanding exactly what you mean, but i think what > > > > you want is > > > > this:http://www.b-list.org/weblog/2006/06/14/django-tips-template-context-... > > > > > On Feb 1, 7:54 pm, "adamr" <[EMAIL PROTECTED]> wrote: > > > > > > Sorry, django.contrib.admin.urls is the wrong view, I am trying to use > > > > > the correct login view. > > > > > > On Feb 1, 1:51 pm, "adamr" <[EMAIL PROTECTED]> wrote: > > > > > > > This seems like it should be a pretty easy concept, but I cannot > > > > > > figure it out. I've spent the past day searching for how to > > > > > > incorporate multiple views on the same page with absolutely no luck. > > > > > > This seems like a topic that would be crucial to incorporate into > > > > > > the > > > > > > documentation and/or tutorials. > > > > > > > On my website I want to have a persistent login form that's on one > > > > > > side of the page. So for example, my index page uses a view to > > > > > > display > > > > > > "news" posts from the database. How do I then also include the > > > > > > built- > > > > > > in authentication form on the side which uses the > > > > > > django.contrib.admin.urls view? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Parameters list
Hi I need some advice about this: In the app I'm developping, there are many parameters like country names, activity domains for entreprises etc... I wanted to put all these parameters in a db table so I created a class Parameters with two fields : category (country,activity) and value (Holland, USA, Telecom ...) If I use class Entreprise(Model): country = ForeignKey(Param) activity = ForeignKey(Param) then when I use the form_for_model function, I have to filter the country choices afterwards, checking the "category" of the param, and this means that I make a second call to the DB end that the 1st one takes lots of data for nothing. On the other hand, I didn't want to create a class for each of these parameters. On my third hand (???), I tried to use dynamic choice fields: class Entreprise(Model): country = IntegerField(choices = [p.id, p.value for p in Param.objects.filter(category="country")]) activity = IntegerField(choices = [p.id, p.value for p in Param.objects.filter(category="activity")]) but in this case, I don't have a direct access from my entreprise object to the country value, only the key Is there a better way to do what I want? Seb --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multilingual content - yet another idea
On 1 Lut, 20:30, "ashwoods" <[EMAIL PROTECTED]> wrote: > im having problems making the testproject work. i get a > 'multilingual_tags' is not a valid tag library: Could not load > template library from django.templatetags.multilingual_tags, cannot > import name get_language_code Make sure you have the current source code :) I fixed this problem yesterday. > although i copied mult..tags to django.templatetags. never used > templatetags myself, i might be missing something. You should not copy the file anywhere, the problem was caused by my cleaning up the code and not doing enough testing before commits. Remember to remove the copy you made or you might run into problems with Django not picking the right version of multilingual_tags. > although, i just commited to svn a patch for reading the languanges > from the settings.py file :) Thanks! Although I do think we will have to improve the configuration, as Aidas suggested. The more I think about it the more I like the idea with storing language IDs in the database, but only reading (or creating) them during application startup. I have to fix the admin page first, though. -mk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: looking for a django contractor (Chicago area) - clarification
clarification: not strictly "40hrs a week"; this is flexible. On 1/31/07, Kumar McMillan wrote: > Dear Djangoists, > > the company I work for is looking for a new contractor to work on a > "phase 2" of a django app now in production. You are the captain of > the ship but will be working alongside a team of pythonists and > rubyists, a handful of whom will be available to conduct code reviews. > _ > > Company: Leapfrog Online > Location: Evanston, IL (Chicago) > Budget: $75 - $135 / hour > Time frame: Immediate need. 1 to 3 month contract. > > Description > We have immediate need for a Python/Django programmer to help develop > and maintain a new public-facing web application (first generation > already in production). This is a 40-hour/week contract commitment, > working on-site in our Evanston office with our project manager, DBA, > sys admin, design shop and business stakeholders in an Agile, open > source environment. You must be demonstrably well-versed in Python > programming, database usage (PostgreSQL), unit testing and test-driven > development and Subversion. Demonstrable experience with the Django > web framework is a big plus. You don't need to have any web design > experience beyond the familiarity with HTML, CSS, Javascript and > graphics needed by any web-based application developer. We will only > consider contracting with a local developers who can work on-site for > this contract. Please send sample code, hourly rates and references. > > To apply > Send email to [EMAIL PROTECTED] (you can CC me as well) > > > thanks for reading, > Kumar > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: New Forms + Validation
On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Jan 31, 1:19 pm, "MerMer" <[EMAIL PROTECTED]> wrote: > > I have a form where a user needs to enter a 8 digit code. I want to > > check the user's input against a database and return an error if the > > code has already been entered by another user. > > > > If I use New Forms, do I need to write a custom Field to do this > > validation? > > No, just implement your clean_YOURFIELDNAME method of the form. A clarification to Lorenzo's response: You can either implement a custom Field class *or* implement a clean_* method. Adrian -- Adrian Holovaty holovaty.com | djangoproject.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: django book remaining chapters
On 2/1/07 2:08 PM, ihomestore wrote: > I am reading the django book. It is great. When do we expect the roll > out of Chapter 7: Form processing and Chapter 13: Comments. When they're done :) Jacob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
django book remaining chapters
I am reading the django book. It is great. When do we expect the roll out of Chapter 7: Form processing and Chapter 13: Comments. thx. ihome --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Help using rowcolor with cycle command
jeffhg58 wrote: > When I display a row, I am trying to display a row in a specific > color. > But, I am a bit confused as to how it should work within the cycle > command. > > Here is my line of code. > > {% for item in result %} > {{ item }}{% endfor %} If you want a new row for each "item", you'll need to move the loop: {% for item in result %} {{ item }} {% endfor %} If "result" is a list of elements, perhaps you want something like this: {% for item in result %}{{ item }}{% endfor %} {% for item in other_result %}{{ item }}{% endfor %} # [...] But the former seems more likely. -Zak --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multiple views on one page
Adamr, I still think you're looking for template tags. My index page, for example, just goes direct_to_template, then is filled up with various things from all over... login form, and at least three other apps. On Feb 1, 1:45 pm, "ashwoods" <[EMAIL PROTECTED]> wrote: > as far as i get it, its 1 view per url. - a view is a response to a > request, you ALWAYS get only one request, and for each posible request > (url) you make one view. > so if there is something you want to use over and over again in more > than one view (as a form), you just make a custom tag or a context > processor. this creates a "variable", in your case a form, that will > be available for all your "template-views". the form _should_ redirect > to 1 view that processes the form, and then redirects you where ever > you want. > > On Feb 1, 8:38 pm, "adamr" <[EMAIL PROTECTED]> wrote: > > > I still don't really grasp how that applies. > > > For example, my url processor will use the included view which auto- > > generates the login form when I go to "accounts/login/" > > > Alternatively, when someone goes to the index page, the url processor > > uses the "news" view so it can display the recent news from the > > database. > > > In my base.html template, I've made room for the login form. When > > someone goes to the index page, all I want django to do is use the > > view that generates the news, as well as use the view that will insert > > the login form. > > > On Feb 1, 2:04 pm, "ashwoods" <[EMAIL PROTECTED]> wrote: > > > > i might not be understanding exactly what you mean, but i think what > > > you want is > > > this:http://www.b-list.org/weblog/2006/06/14/django-tips-template-context-... > > > > On Feb 1, 7:54 pm, "adamr" <[EMAIL PROTECTED]> wrote: > > > > > Sorry, django.contrib.admin.urls is the wrong view, I am trying to use > > > > the correct login view. > > > > > On Feb 1, 1:51 pm, "adamr" <[EMAIL PROTECTED]> wrote: > > > > > > This seems like it should be a pretty easy concept, but I cannot > > > > > figure it out. I've spent the past day searching for how to > > > > > incorporate multiple views on the same page with absolutely no luck. > > > > > This seems like a topic that would be crucial to incorporate into the > > > > > documentation and/or tutorials. > > > > > > On my website I want to have a persistent login form that's on one > > > > > side of the page. So for example, my index page uses a view to display > > > > > "news" posts from the database. How do I then also include the built- > > > > > in authentication form on the side which uses the > > > > > django.contrib.admin.urls view? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multiple views on one page
as far as i get it, its 1 view per url. - a view is a response to a request, you ALWAYS get only one request, and for each posible request (url) you make one view. so if there is something you want to use over and over again in more than one view (as a form), you just make a custom tag or a context processor. this creates a "variable", in your case a form, that will be available for all your "template-views". the form _should_ redirect to 1 view that processes the form, and then redirects you where ever you want. On Feb 1, 8:38 pm, "adamr" <[EMAIL PROTECTED]> wrote: > I still don't really grasp how that applies. > > For example, my url processor will use the included view which auto- > generates the login form when I go to "accounts/login/" > > Alternatively, when someone goes to the index page, the url processor > uses the "news" view so it can display the recent news from the > database. > > In my base.html template, I've made room for the login form. When > someone goes to the index page, all I want django to do is use the > view that generates the news, as well as use the view that will insert > the login form. > > On Feb 1, 2:04 pm, "ashwoods" <[EMAIL PROTECTED]> wrote: > > > i might not be understanding exactly what you mean, but i think what > > you want is > > this:http://www.b-list.org/weblog/2006/06/14/django-tips-template-context-... > > > On Feb 1, 7:54 pm, "adamr" <[EMAIL PROTECTED]> wrote: > > > > Sorry, django.contrib.admin.urls is the wrong view, I am trying to use > > > the correct login view. > > > > On Feb 1, 1:51 pm, "adamr" <[EMAIL PROTECTED]> wrote: > > > > > This seems like it should be a pretty easy concept, but I cannot > > > > figure it out. I've spent the past day searching for how to > > > > incorporate multiple views on the same page with absolutely no luck. > > > > This seems like a topic that would be crucial to incorporate into the > > > > documentation and/or tutorials. > > > > > On my website I want to have a persistent login form that's on one > > > > side of the page. So for example, my index page uses a view to display > > > > "news" posts from the database. How do I then also include the built- > > > > in authentication form on the side which uses the > > > > django.contrib.admin.urls view? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multiple views on one page
I still don't really grasp how that applies. For example, my url processor will use the included view which auto- generates the login form when I go to "accounts/login/" Alternatively, when someone goes to the index page, the url processor uses the "news" view so it can display the recent news from the database. In my base.html template, I've made room for the login form. When someone goes to the index page, all I want django to do is use the view that generates the news, as well as use the view that will insert the login form. On Feb 1, 2:04 pm, "ashwoods" <[EMAIL PROTECTED]> wrote: > i might not be understanding exactly what you mean, but i think what > you want is > this:http://www.b-list.org/weblog/2006/06/14/django-tips-template-context-... > > On Feb 1, 7:54 pm, "adamr" <[EMAIL PROTECTED]> wrote: > > > Sorry, django.contrib.admin.urls is the wrong view, I am trying to use > > the correct login view. > > > On Feb 1, 1:51 pm, "adamr" <[EMAIL PROTECTED]> wrote: > > > > This seems like it should be a pretty easy concept, but I cannot > > > figure it out. I've spent the past day searching for how to > > > incorporate multiple views on the same page with absolutely no luck. > > > This seems like a topic that would be crucial to incorporate into the > > > documentation and/or tutorials. > > > > On my website I want to have a persistent login form that's on one > > > side of the page. So for example, my index page uses a view to display > > > "news" posts from the database. How do I then also include the built- > > > in authentication form on the side which uses the > > > django.contrib.admin.urls view? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
subversion and staying up to date
I'm developing a new project based off one of the recent trunks. I did this because I wanted to use newforms. Since the project is in a constant state of flux should I checkout a new version every day, every week, or month. It seems that if I do this every day, that maybe the least painful in the long run, as there should be just a few changes, but perhaps it would be easier to do this just once a month or week. Your thoughts and suggestions on this would be great. Thanks, Paul --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multilingual content - yet another idea
im having problems making the testproject work. i get a 'multilingual_tags' is not a valid tag library: Could not load template library from django.templatetags.multilingual_tags, cannot import name get_language_code although i copied mult..tags to django.templatetags. never used templatetags myself, i might be missing something. i am a newbie after all. although, i just commited to svn a patch for reading the languanges from the settings.py file :) take care, ashley On Jan 28, 11:39 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 28 Sty, 17:23, "ashwoods" <[EMAIL PROTECTED]> wrote: > > > i'll be testing it tonight :) > > Cool :) > > I just committed a version that does ordering and sorting > on the translated fields using the database api, so now it > is possible to: > > * order_by('name'), > * order_by('name_en'), > * filter(name__contains='blah'), > * filter(name_pl__contains='blah'), > > and so on. There is still a lot to do, though -- in particular, > I think that making sorting work in admin will require > patching the admin views after all. > > -mk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multiple views on one page
i might not be understanding exactly what you mean, but i think what you want is this: http://www.b-list.org/weblog/2006/06/14/django-tips-template-context-processors On Feb 1, 7:54 pm, "adamr" <[EMAIL PROTECTED]> wrote: > Sorry, django.contrib.admin.urls is the wrong view, I am trying to use > the correct login view. > > On Feb 1, 1:51 pm, "adamr" <[EMAIL PROTECTED]> wrote: > > > This seems like it should be a pretty easy concept, but I cannot > > figure it out. I've spent the past day searching for how to > > incorporate multiple views on the same page with absolutely no luck. > > This seems like a topic that would be crucial to incorporate into the > > documentation and/or tutorials. > > > On my website I want to have a persistent login form that's on one > > side of the page. So for example, my index page uses a view to display > > "news" posts from the database. How do I then also include the built- > > in authentication form on the side which uses the > > django.contrib.admin.urls view? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Help with Last Seen (why doesn't this work???)
Honza, if I ever meet ya, I'm buying you a cookie. Here's what I ended up with. Hopefully it'll help someone else. import datetime class LastSeen (object): def process_request(self, request): now = datetime.datetime.now() last_request = request.session.get( 'last_request', now ) if (now - last_request).seconds > (60 * 60): # don't bother updating unless they've been gone awhile request.session['last_seen'] = last_request request.session['last_request'] = now On Feb 1, 10:21 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Thanks. I've been working my way through diveintopython as well as > some other materials, but obviously have a long way to go. > That, and request.session.get() makes a bit more sense! > > On Feb 1, 10:18 am, "Honza Král" <[EMAIL PROTECTED]> wrote: > > > btw, some literature about python and programming in general would > > perhaps be in order... > > > I recommend diveintopython.org > > > On 2/1/07, Honza Kr?l <[EMAIL PROTECTED]> wrote: > > > > On 2/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > I like that brevity and simplicity, but could you clarify what's going > > > > on with this line: > > > > last_request = request.get( 'last_request', now ) > > > > get() is method on python dictionaries: > > > Help on built-in function get: > > > > get(...) > > > D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. > > > > it returns the value stored under key k, if it cannot find it, it > > > returns d, so in this case > > > > # oops, I missed the 'session' last time: > > > last_request = request.session.get( 'last_request', now ) > > > > is equivalent to > > > try: > > > last_request = request.session['last_request'] > > > except KeyError: > > > last_request = now > > > > > After all I've gone through, and with it appearing to work, I want to > > > > make sure I understand any changes! > > > > > On Jan 31, 5:49 pm, "Honza Kr?l" <[EMAIL PROTECTED]> wrote: > > > > > this seems more accurate: > > > > > > def process_request( self, request ): > > > > > now = datetime.datetime.now() > > > > > # get last_request, defaults to now, when he was never seen > > > > > before > > > > > # you may wish to omit setting last_seen in that case (he > > > > > wasn't ever seen) > > > > > last_request = request.get( 'last_request', now ) > > > > > # when did you last see him? when he last requested > > > > > something! :: > > > > > # if you really want to, you can add the 4-hour waiting time > > > > > here (only for this line though !!) > > > > > request.session['last_seen'] = last_request > > > > > # now is the time he is making his last request > > > > > request.session['last_request'] = now > > > > > > no tries, no catches... > > > > > > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > I think this MAY be working now and I think I even finally wrapped > > > > > > my > > > > > > head around what's going on. So, in hopes of helping someone else > > > > > > some > > > > > > day (or, alternately, someone pointing out any trouble spots > > > > > > remaining), the last_visit middleware: > > > > > > > import datetime > > > > > > > class LastSeen (object): > > > > > > def process_request(self, request): > > > > > > now = datetime.datetime.now() > > > > > > try: > > > > > > last_request = request.session['last_request'] > > > > > > # don't update it too often, every 4 hours should be ok > > > > > > if (now - last_request).seconds > (60 * 60 *4): > > > > > > request.session['last_seen'] = last_request > > > > > > request.session['last_request'] = now > > > > > > except KeyError: > > > > > > request.session['last_request'] = > > > > > > datetime.datetime.now() > > > > > > request.session['last_seen'] = datetime.datetime.now() > > > > > > except TypeError: > > > > > > request.session['last_request'] = > > > > > > datetime.datetime.now() > > > > > > > And I'd like to thank Honza, Doug, and everyone else who tried so > > > > > > hard > > > > > > to pound this simple thing through my thick skull. > > > > > > > On Jan 31, 8:42 am, "Honza Kr?l" <[EMAIL PROTECTED]> wrote: > > > > > > > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > > > I know I'm dense, and I'm just not seeing this, but isn't that > > > > > > > > what > > > > > > > > I'm doing? > > > > > > > > > now = datetime.datetime.now() > > > > > > > > last_request = request.session['last_request'] > > > > > > > > > if (now - last_request).seconds > (60 * 60 *4): > > > > > > > > ... > > > > > > > > but this line: > > > > > > > > > request.session['last_request'] = now > > > > > > > > is only executed when last_request is lder than 4 hours... hardly > > > > > > > seems like always, does it? > > > > > > > >
Re: Multiple views on one page
Why not use template tags? On Feb 1, 12:54 pm, "adamr" <[EMAIL PROTECTED]> wrote: > Sorry, django.contrib.admin.urls is the wrong view, I am trying to use > the correct login view. > > On Feb 1, 1:51 pm, "adamr" <[EMAIL PROTECTED]> wrote: > > > This seems like it should be a pretty easy concept, but I cannot > > figure it out. I've spent the past day searching for how to > > incorporate multiple views on the same page with absolutely no luck. > > This seems like a topic that would be crucial to incorporate into the > > documentation and/or tutorials. > > > On my website I want to have a persistent login form that's on one > > side of the page. So for example, my index page uses a view to display > > "news" posts from the database. How do I then also include the built- > > in authentication form on the side which uses the > > django.contrib.admin.urls view? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multiple views on one page
Sorry, django.contrib.admin.urls is the wrong view, I am trying to use the correct login view. On Feb 1, 1:51 pm, "adamr" <[EMAIL PROTECTED]> wrote: > This seems like it should be a pretty easy concept, but I cannot > figure it out. I've spent the past day searching for how to > incorporate multiple views on the same page with absolutely no luck. > This seems like a topic that would be crucial to incorporate into the > documentation and/or tutorials. > > On my website I want to have a persistent login form that's on one > side of the page. So for example, my index page uses a view to display > "news" posts from the database. How do I then also include the built- > in authentication form on the side which uses the > django.contrib.admin.urls view? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Multiple views on one page
This seems like it should be a pretty easy concept, but I cannot figure it out. I've spent the past day searching for how to incorporate multiple views on the same page with absolutely no luck. This seems like a topic that would be crucial to incorporate into the documentation and/or tutorials. On my website I want to have a persistent login form that's on one side of the page. So for example, my index page uses a view to display "news" posts from the database. How do I then also include the built- in authentication form on the side which uses the django.contrib.admin.urls view? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
use forloop.counter0 as index?
Hello, Is it possible to use forloop.counter0 as an index into a list? For example: in my view I have: array=[10,11,12,13] in my template I have: {% for item in items %} counter = {{ forloop.counter0 }} 1st val of array = {{ array.0 }} nothing appears here: {{array.forloop.counter0 }} --- {% endfor %} This is what comes out the browser: counter = 0 1st val of array = 10 nothing appears here: --- counter = 1 1st val of array = 10 nothing appears here: --- Thanks in advance, Brandon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: 2 Questions!
The patch provided for ticket 3387 works perfectly! 2007/2/1, Michael Radziej <[EMAIL PROTECTED]>: > > > Sebastien Armand [Pink]: > > This time it's done. The ticket is here: > > http://code.djangoproject.com/ticket/3412 I hope it's enough documented. > > Merci! I finally realized that it's not about a ForeignKey, sorry > for the confusion. Can you check if you can work around it with a > > entreprise_list=entreprise_list.filter(domaine=data['domaine'].encode( > settings.DEFAULT_CHARSET)) > > etc.? > > Hope that helps! > > Michael > > > -- > noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg - > Tel +49-911-9352-0 - Fax +49-911-9352-100 > > http://www.noris.de - The IT-Outsourcing Company > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Custom validation in Django admin
Hi, I want to do some custom validation in the django admin. I have a model which looks like: class Message(models.Model): name = models.CharField(maxlength=30) date = models.DateField() speaker = models.CharField(maxlength=30) path = models.FileField(upload_to='messages/%Y/%m/%d') overview = models.TextField() I want to validate the FileField in particular. The file uploaded should be a 'music' type file - mp3 or ogg-vorbis. I've figured out that I'll probably need to override the save() method, but I'm a bit stuck as to how to continue. I tried using validators_list=[] and writing a validating method, but it didn't work. All of the examples I've looked at so far have only dealt with validating custom forms (not the admin). Maybe this could be included as an example in the docs... Anyway, pointers and suggestions would be much appreciated. Please help, many thanks. Isaac --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
How to make your web-application more secure
Hi there, I wrote recently a short summary on common vulnerabilities of web applications, with examples in Python (but TurboGears). Obviously, this is relevant for Django users as well. http://www.thesamet.com/blog/2007/01/16/prepare-for-attack%e2%80%94making-your-web-applications-more-secure/ Nadav --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: textarea - autoamtic line break
Why do you need to break the lines? It's hard to give you a good solution without knowing the reason. Do you need your text to be broken along a certain max-char-width parameter? It would be pretty simple to write a python function to dice up the field's value on the server side, post-submittal. I do that with one of my own forms (in order to fit the text in a box in a pdf). On Feb 1, 9:25 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I tested this css tag on different browser (ie, firefox etc.). But das > automatic line break would not be set. > > Is there any way to fix this on server side? > > For PHP i found any functions to fix this problem... > > On 29 Jan., 11:34, "Aidas Bendoraitis" <[EMAIL PROTECTED]> > wrote: > > > Line-break CSS property should help you > > here:http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/... > > > However, it may not be supported by most browsers at the moment. > > > Regards, > > Aidas Bendoraitis aka Archatas > > > On 1/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > i have a fixed textarea, rows and cols are defined. > > > if the user write a text and run out of a line without a break, it > > > should set a new line. > > > But a new line is only set if the user press line break. > > > > i test following: > > > > css {white-space:pre} > > > > but this dont't help, > > > > is there a possibillity to solve this problem? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Custom template tags: object does not support item assignment
greetings, i am attempting to fetch an object or all objects from a model and make the data available at the template level via a custom template tag. it seems like you cannot return an object or all objects from the template tag, as django throws the error: "object does not support item assignment". the template tag is quite simple: from myproject.models import Project from django.template import Library,Node register = Library() def build_project_list(parser, token): """ {% get_project_list %} """ return ProjectListObject() class ProjectListObject(Node): def render(self, context): context['project_list'] = Project.objects.all() return '' register.tag('get_project_list', build_project_list) in the end, we would like pass a value to the template tag, like an ID or slug, and receive back a specific object and make it availabe to the template for display without using a for loop or anything. for example. project.name, project.slug, project.description, etc. can anyone confirm for me that the custom template tags cannot return an object? if that is the case, what do folks do to display data in such a way that does not depend on a view? we are using django revision 4455, the latest svn build i think. thanks, steve --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Help with Last Seen (why doesn't this work???)
Thanks. I've been working my way through diveintopython as well as some other materials, but obviously have a long way to go. That, and request.session.get() makes a bit more sense! On Feb 1, 10:18 am, "Honza Král" <[EMAIL PROTECTED]> wrote: > btw, some literature about python and programming in general would > perhaps be in order... > > I recommend diveintopython.org > > On 2/1/07, Honza Kr?l <[EMAIL PROTECTED]> wrote: > > > > > On 2/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > I like that brevity and simplicity, but could you clarify what's going > > > on with this line: > > > last_request = request.get( 'last_request', now ) > > > get() is method on python dictionaries: > > Help on built-in function get: > > > get(...) > > D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. > > > it returns the value stored under key k, if it cannot find it, it > > returns d, so in this case > > > # oops, I missed the 'session' last time: > > last_request = request.session.get( 'last_request', now ) > > > is equivalent to > > try: > > last_request = request.session['last_request'] > > except KeyError: > > last_request = now > > > > After all I've gone through, and with it appearing to work, I want to > > > make sure I understand any changes! > > > > On Jan 31, 5:49 pm, "Honza Kr?l" <[EMAIL PROTECTED]> wrote: > > > > this seems more accurate: > > > > > def process_request( self, request ): > > > > now = datetime.datetime.now() > > > > # get last_request, defaults to now, when he was never seen > > > > before > > > > # you may wish to omit setting last_seen in that case (he > > > > wasn't ever seen) > > > > last_request = request.get( 'last_request', now ) > > > > # when did you last see him? when he last requested something! > > > > :: > > > > # if you really want to, you can add the 4-hour waiting time > > > > here (only for this line though !!) > > > > request.session['last_seen'] = last_request > > > > # now is the time he is making his last request > > > > request.session['last_request'] = now > > > > > no tries, no catches... > > > > > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > I think this MAY be working now and I think I even finally wrapped my > > > > > head around what's going on. So, in hopes of helping someone else some > > > > > day (or, alternately, someone pointing out any trouble spots > > > > > remaining), the last_visit middleware: > > > > > > import datetime > > > > > > class LastSeen (object): > > > > > def process_request(self, request): > > > > > now = datetime.datetime.now() > > > > > try: > > > > > last_request = request.session['last_request'] > > > > > # don't update it too often, every 4 hours should be ok > > > > > if (now - last_request).seconds > (60 * 60 *4): > > > > > request.session['last_seen'] = last_request > > > > > request.session['last_request'] = now > > > > > except KeyError: > > > > > request.session['last_request'] = > > > > > datetime.datetime.now() > > > > > request.session['last_seen'] = datetime.datetime.now() > > > > > except TypeError: > > > > > request.session['last_request'] = > > > > > datetime.datetime.now() > > > > > > And I'd like to thank Honza, Doug, and everyone else who tried so hard > > > > > to pound this simple thing through my thick skull. > > > > > > On Jan 31, 8:42 am, "Honza Kr?l" <[EMAIL PROTECTED]> wrote: > > > > > > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > > I know I'm dense, and I'm just not seeing this, but isn't that > > > > > > > what > > > > > > > I'm doing? > > > > > > > > now = datetime.datetime.now() > > > > > > > last_request = request.session['last_request'] > > > > > > > > if (now - last_request).seconds > (60 * 60 *4): > > > > > > > ... > > > > > > > but this line: > > > > > > > > request.session['last_request'] = now > > > > > > > is only executed when last_request is lder than 4 hours... hardly > > > > > > seems like always, does it? > > > > > > > > On Jan 31, 7:47 am, "Honza Kr?l" <[EMAIL PROTECTED]> wrote: > > > > > > > > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > > > > Ok, but if I update last_request at every request, then won't > > > > > > > > > (now - > > > > > > > > > last_request) ALWAYS be more or less 0? > > > > > > > > > not if you update it AFTER the comparison... > > > > > > > > > > On Jan 31, 4:16 am, "Honza Kr?l" <[EMAIL PROTECTED]> wrote: > > > > > > > > > > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > There's some conceptual thing I'm apparently just not > > > > > > > > > > > getting. I > > > > > > > > > > > attempted to follow Doug's advice and came up with: > > > > > > > > > > > > class LastSeen (object): > > > > > > > > > > > """Mi
Re: Help with Last Seen (why doesn't this work???)
btw, some literature about python and programming in general would perhaps be in order... I recommend diveintopython.org On 2/1/07, Honza Kr�l <[EMAIL PROTECTED]> wrote: > On 2/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > I like that brevity and simplicity, but could you clarify what's going > > on with this line: > > last_request = request.get( 'last_request', now ) > > get() is method on python dictionaries: > Help on built-in function get: > > get(...) > D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. > > it returns the value stored under key k, if it cannot find it, it > returns d, so in this case > > # oops, I missed the 'session' last time: > last_request = request.session.get( 'last_request', now ) > > is equivalent to > try: > last_request = request.session['last_request'] > except KeyError: > last_request = now > > > > > > After all I've gone through, and with it appearing to work, I want to > > make sure I understand any changes! > > > > > > > > On Jan 31, 5:49 pm, "Honza Kr�l" <[EMAIL PROTECTED]> wrote: > > > this seems more accurate: > > > > > > def process_request( self, request ): > > > now = datetime.datetime.now() > > > # get last_request, defaults to now, when he was never seen before > > > # you may wish to omit setting last_seen in that case (he > > > wasn't ever seen) > > > last_request = request.get( 'last_request', now ) > > > # when did you last see him? when he last requested something! :: > > > # if you really want to, you can add the 4-hour waiting time > > > here (only for this line though !!) > > > request.session['last_seen'] = last_request > > > # now is the time he is making his last request > > > request.session['last_request'] = now > > > > > > no tries, no catches... > > > > > > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > > > > > > > I think this MAY be working now and I think I even finally wrapped my > > > > head around what's going on. So, in hopes of helping someone else some > > > > day (or, alternately, someone pointing out any trouble spots > > > > remaining), the last_visit middleware: > > > > > > > import datetime > > > > > > > class LastSeen (object): > > > > def process_request(self, request): > > > > now = datetime.datetime.now() > > > > try: > > > > last_request = request.session['last_request'] > > > > # don't update it too often, every 4 hours should be ok > > > > if (now - last_request).seconds > (60 * 60 *4): > > > > request.session['last_seen'] = last_request > > > > request.session['last_request'] = now > > > > except KeyError: > > > > request.session['last_request'] = > > > > datetime.datetime.now() > > > > request.session['last_seen'] = datetime.datetime.now() > > > > except TypeError: > > > > request.session['last_request'] = > > > > datetime.datetime.now() > > > > > > > And I'd like to thank Honza, Doug, and everyone else who tried so hard > > > > to pound this simple thing through my thick skull. > > > > > > > On Jan 31, 8:42 am, "Honza Kr?l" <[EMAIL PROTECTED]> wrote: > > > > > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > > > I know I'm dense, and I'm just not seeing this, but isn't that what > > > > > > I'm doing? > > > > > > > > > now = datetime.datetime.now() > > > > > > last_request = request.session['last_request'] > > > > > > > > > if (now - last_request).seconds > (60 * 60 *4): > > > > > > ... > > > > > > > > but this line: > > > > > > > > > request.session['last_request'] = now > > > > > > > > is only executed when last_request is lder than 4 hours... hardly > > > > > seems like always, does it? > > > > > > > > > On Jan 31, 7:47 am, "Honza Kr?l" <[EMAIL PROTECTED]> wrote: > > > > > > > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > Ok, but if I update last_request at every request, then won't > > > > > > > > (now - > > > > > > > > last_request) ALWAYS be more or less 0? > > > > > > > > > > not if you update it AFTER the comparison... > > > > > > > > > > > On Jan 31, 4:16 am, "Honza Kr?l" <[EMAIL PROTECTED]> wrote: > > > > > > > > > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > There's some conceptual thing I'm apparently just not > > > > > > > > > > getting. I > > > > > > > > > > attempted to follow Doug's advice and came up with: > > > > > > > > > > > > > class LastSeen (object): > > > > > > > > > > """Middleware that adds various objects to thread local > > > > > > > > > > storage > > > > > > > > > > from the request object.""" > > > > > > > > > > def process_request(self, request): > > > > > > > > > > now = datetime.datetime.now() > > > > > > > > > > try: > > > > > > > > > > last_request = request.ses
Re: Help with Last Seen (why doesn't this work???)
On 2/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I like that brevity and simplicity, but could you clarify what's going > on with this line: > last_request = request.get( 'last_request', now ) get() is method on python dictionaries: Help on built-in function get: get(...) D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. it returns the value stored under key k, if it cannot find it, it returns d, so in this case # oops, I missed the 'session' last time: last_request = request.session.get( 'last_request', now ) is equivalent to try: last_request = request.session['last_request'] except KeyError: last_request = now > > After all I've gone through, and with it appearing to work, I want to > make sure I understand any changes! > > > > On Jan 31, 5:49 pm, "Honza Kr�l" <[EMAIL PROTECTED]> wrote: > > this seems more accurate: > > > > def process_request( self, request ): > > now = datetime.datetime.now() > > # get last_request, defaults to now, when he was never seen before > > # you may wish to omit setting last_seen in that case (he > > wasn't ever seen) > > last_request = request.get( 'last_request', now ) > > # when did you last see him? when he last requested something! :: > > # if you really want to, you can add the 4-hour waiting time > > here (only for this line though !!) > > request.session['last_seen'] = last_request > > # now is the time he is making his last request > > request.session['last_request'] = now > > > > no tries, no catches... > > > > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > I think this MAY be working now and I think I even finally wrapped my > > > head around what's going on. So, in hopes of helping someone else some > > > day (or, alternately, someone pointing out any trouble spots > > > remaining), the last_visit middleware: > > > > > import datetime > > > > > class LastSeen (object): > > > def process_request(self, request): > > > now = datetime.datetime.now() > > > try: > > > last_request = request.session['last_request'] > > > # don't update it too often, every 4 hours should be ok > > > if (now - last_request).seconds > (60 * 60 *4): > > > request.session['last_seen'] = last_request > > > request.session['last_request'] = now > > > except KeyError: > > > request.session['last_request'] = > > > datetime.datetime.now() > > > request.session['last_seen'] = datetime.datetime.now() > > > except TypeError: > > > request.session['last_request'] = > > > datetime.datetime.now() > > > > > And I'd like to thank Honza, Doug, and everyone else who tried so hard > > > to pound this simple thing through my thick skull. > > > > > On Jan 31, 8:42 am, "Honza Kr?l" <[EMAIL PROTECTED]> wrote: > > > > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > I know I'm dense, and I'm just not seeing this, but isn't that what > > > > > I'm doing? > > > > > > > now = datetime.datetime.now() > > > > > last_request = request.session['last_request'] > > > > > > > if (now - last_request).seconds > (60 * 60 *4): > > > > > ... > > > > > > but this line: > > > > > > > request.session['last_request'] = now > > > > > > is only executed when last_request is lder than 4 hours... hardly > > > > seems like always, does it? > > > > > > > On Jan 31, 7:47 am, "Honza Kr?l" <[EMAIL PROTECTED]> wrote: > > > > > > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > > > Ok, but if I update last_request at every request, then won't > > > > > > > (now - > > > > > > > last_request) ALWAYS be more or less 0? > > > > > > > > not if you update it AFTER the comparison... > > > > > > > > > On Jan 31, 4:16 am, "Honza Kr?l" <[EMAIL PROTECTED]> wrote: > > > > > > > > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > There's some conceptual thing I'm apparently just not > > > > > > > > > getting. I > > > > > > > > > attempted to follow Doug's advice and came up with: > > > > > > > > > > > class LastSeen (object): > > > > > > > > > """Middleware that adds various objects to thread local > > > > > > > > > storage > > > > > > > > > from the request object.""" > > > > > > > > > def process_request(self, request): > > > > > > > > > now = datetime.datetime.now() > > > > > > > > > try: > > > > > > > > > last_request = request.session['last_request'] > > > > > > > > > # don't update it too often, every 4 hours should > > > > > > > > > be ok > > > > > > > > > if (now - last_request).seconds > (60 * 60 *4): > > > > > > > > > request.session['last_seen'] = > > > > > > > > > last_request > > > > > > > > > request.session['last_request'] = now > > > > > > > > > > you have to u
embedded SVG isnt displayed
Hi, im embedding a SVG in a template like this: [div] [embed id="embedded_svg" src="/site_media/test.svg" /] [/div] [img src="/site_media/test.gif" /] both, svg and gif are in my static content directory. gif is displayed, svg isnt. when i open the html directly, both files are displayed (after changing the urls) (im using the django webserver) any pointers? thx in advance, Seabstian --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django Admin throws exception when deleting object, many to many field
hi all, i have a model like this: class Verb(models.Model): name = models.CharField(maxlength=20) related_verbs = models.ManyToManyField('self',null=True, blank=True) def __str__(self): return self.name class Admin: pass i added a new 'verb' object, using the django admin, when i want to delete that object, django admin throws exception below: TypeError at /admin/lists/verb/1/delete/ getattr(): attribute name must be stringRequest Method: GET Request URL:http://127.0.0.1:8000/admin/lists/verb/1/delete/ Exception Type: TypeError Exception Value:getattr(): attribute name must be string Exception Location: /usr/lib/python2.4/site-packages/django/contrib/ admin/views/main.py in _get_deleted_objects, line 464 and, in shell, object add and delete methods works as expected. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Help with Last Seen (why doesn't this work???)
I like that brevity and simplicity, but could you clarify what's going on with this line: last_request = request.get( 'last_request', now ) After all I've gone through, and with it appearing to work, I want to make sure I understand any changes! On Jan 31, 5:49 pm, "Honza Král" <[EMAIL PROTECTED]> wrote: > this seems more accurate: > > def process_request( self, request ): > now = datetime.datetime.now() > # get last_request, defaults to now, when he was never seen before > # you may wish to omit setting last_seen in that case (he > wasn't ever seen) > last_request = request.get( 'last_request', now ) > # when did you last see him? when he last requested something! :: > # if you really want to, you can add the 4-hour waiting time > here (only for this line though !!) > request.session['last_seen'] = last_request > # now is the time he is making his last request > request.session['last_request'] = now > > no tries, no catches... > > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > I think this MAY be working now and I think I even finally wrapped my > > head around what's going on. So, in hopes of helping someone else some > > day (or, alternately, someone pointing out any trouble spots > > remaining), the last_visit middleware: > > > import datetime > > > class LastSeen (object): > > def process_request(self, request): > > now = datetime.datetime.now() > > try: > > last_request = request.session['last_request'] > > # don't update it too often, every 4 hours should be ok > > if (now - last_request).seconds > (60 * 60 *4): > > request.session['last_seen'] = last_request > > request.session['last_request'] = now > > except KeyError: > > request.session['last_request'] = > > datetime.datetime.now() > > request.session['last_seen'] = datetime.datetime.now() > > except TypeError: > > request.session['last_request'] = > > datetime.datetime.now() > > > And I'd like to thank Honza, Doug, and everyone else who tried so hard > > to pound this simple thing through my thick skull. > > > On Jan 31, 8:42 am, "Honza Kr?l" <[EMAIL PROTECTED]> wrote: > > > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > I know I'm dense, and I'm just not seeing this, but isn't that what > > > > I'm doing? > > > > > now = datetime.datetime.now() > > > > last_request = request.session['last_request'] > > > > > if (now - last_request).seconds > (60 * 60 *4): > > > > ... > > > > but this line: > > > > > request.session['last_request'] = now > > > > is only executed when last_request is lder than 4 hours... hardly > > > seems like always, does it? > > > > > On Jan 31, 7:47 am, "Honza Kr?l" <[EMAIL PROTECTED]> wrote: > > > > > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > Ok, but if I update last_request at every request, then won't (now - > > > > > > last_request) ALWAYS be more or less 0? > > > > > > not if you update it AFTER the comparison... > > > > > > > On Jan 31, 4:16 am, "Honza Kr?l" <[EMAIL PROTECTED]> wrote: > > > > > > > On 1/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > > > There's some conceptual thing I'm apparently just not getting. I > > > > > > > > attempted to follow Doug's advice and came up with: > > > > > > > > > class LastSeen (object): > > > > > > > > """Middleware that adds various objects to thread local > > > > > > > > storage > > > > > > > > from the request object.""" > > > > > > > > def process_request(self, request): > > > > > > > > now = datetime.datetime.now() > > > > > > > > try: > > > > > > > > last_request = request.session['last_request'] > > > > > > > > # don't update it too often, every 4 hours should > > > > > > > > be ok > > > > > > > > if (now - last_request).seconds > (60 * 60 *4): > > > > > > > > request.session['last_seen'] = last_request > > > > > > > > request.session['last_request'] = now > > > > > > > > you have to update last request at every request, not only when > > > > > > > its > > > > > > > too old... if you do it like this it is EXACTLY what you did > > > > > > > before > > > > > > > > > except KeyError: > > > > > > > > request.session['last_request'] = > > > > > > > > datetime.datetime.now() > > > > > > > > request.session['last_seen'] = > > > > > > > > datetime.datetime.now() > > > > > > > > except TypeError: > > > > > > > > request.session['last_request'] = > > > > > > > > datetime.datetime.now() > > > > > > > > request.session['last_seen'] = > > > > > > > > datetime.datetime.now() > > > > > > > > > Which appears to do the exact same thing I was doing before. > > > > > > > > > On Jan 30, 1:07 pm,
Re: Help using rowcolor with cycle command
I think you've got it, other than setting the css for .row1 or .row2 to background:#0f0 or whatever On Feb 1, 7:39 am, "jeffhg58" <[EMAIL PROTECTED]> wrote: > When I display a row, I am trying to display a row in a specific > color. > But, I am a bit confused as to how it should work within the cycle > command. > > Here is my line of code. > > {% for item in result %} > {{ item }}{% endfor %} > > How do you set rowcolors where you want the background of the line to > display in green. > > Thanks, > Jeff --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ImproperlyConfigured: Error importing middleware django.contrib.sessions.middleware: "No module named mysite"
Hi Ron! Try changing '/home/rsie/projects/mysite' to '/home/rsie/projects' and also change SetEnv DJANGO_SETTINGS_MODULE settings to SetEnv DJANGO_SETTINGS_MODULE mysite.settings regards, /Henrik --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: not receiving error email
Like JRS, I'm on webfaction, and found them to be very particular about what's in setttings.py. I'd double- or triple-check all that. If it's not SERVER_EMAIL, then maybe it's something else. Like you, I had account activation and other emails working fine, but error emails weren't going through until I really looked hard at settings.py On Feb 1, 7:56 am, James Tauber <[EMAIL PROTECTED]> wrote: > In my dev environment, I was able to reproduce the error - it was a > typo in a method on a model object being called from a view. With > DEBUG = True, Django displayed a useful message so I suspect Django > had a chance to send the email. > > Nothing in my postfix logs points to a problem. > > I've since turned on SEND_BROKEN_LINK_EMAILS and tried accessing a > non-existent page but no email is received in that case either. > > And, yes, SERVER_EMAIL is set. > > Is there any way to have error emails sent even when DEBUG = True? > That would enable me to see if the mail sending is throwing any > exception. > > James > > On 31/01/2007, at 6:49 PM, James Bennett wrote: > > > > > On 1/31/07, James Tauber <[EMAIL PROTECTED]> wrote: > >> I just got an unhandled exception error on my production site but > >> didn't receive an email. > > > There are some cases where this will happen; for example, the code > > which would send the email lives in the handler class, so if the > > handler never gets fully instantiated before an exception pops up, > > then Django has no chance to send an email or try to recover > > gracefully. Generally, when this happens under mod_python you get a > > blank white page with some pithy error messages from mod_python > > itself, and under FastCGI you'll get errors out of flup instead of > > Django. > > > Beyond that, I've seen plenty of weird interactions of spam filters > > and other mail-oriented weirdness causes delays or even drop the > > emails outright. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multilingual content - yet another idea
On 1 Lut, 14:15, "Aidas Bendoraitis" <[EMAIL PROTECTED]> wrote: > Regarding the list of available languages, I think that the > translation system should use the settings, provided by default > (LANGUAGE_CODE and LANGUAGES) instead of ids or other list > variables.http://www.djangoproject.com/documentation/settings/#language-code This might be a good idea. Partially. The library still needs to have language IDs internally to make all the joins fast, but they should probably be hidden from application developer. I already started changing the code in this direction: it supports using language codes everywhere now, including set_default_language and .for_language functions. My plan is to add a model similar to ContentType that would map language codes to IDs. It would be managed completely by the library, because any changes to it should happen during application initialization to be effective. Right now changing the list of languages might break things, as language IDs are based on language position in the list, but with such a mapping it would be possible to add and remove languages without losing information. It would also allow for different sites using the same data presented in different languages. But I am not so sure that the two lists of languages should be identical. The Django setting is for interface translations and mine is for content. It is very common to have interface available in more languages than content. There are also performance concerns: each language handled by D-M means another join in every query and another set of fields added to every instance of a translatable model. Another thing to consider is the admin interface. I want to create an editor for translated content that is easy to use; this means different things for sites with small number of translations (2-4 languages, which probably means most multilingual sites) and for sites with 30 languages or so (which is the default length of the LANGUAGES setting). Perhaps I should just add another tuple, say, MODEL_LANGUAGES, that would just contain codes of languages that should be handled by django- multilingual. The language names would be taken from Django LANGUAGES setting and the mapping to IDs would be hidden from user. Adding or removing a language code to MODEL_LANGUAGES would just work like you would expect: all translations for that model would simply appear or hide. How does it sound? I do appreciate all suggestions. -mk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Threaded versus forked how can I tell?
Hi, Is there a way to detect in my code if I'm running in prefork or threaded mode? Jakub --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: textarea - autoamtic line break
I tested this css tag on different browser (ie, firefox etc.). But das automatic line break would not be set. Is there any way to fix this on server side? For PHP i found any functions to fix this problem... On 29 Jan., 11:34, "Aidas Bendoraitis" <[EMAIL PROTECTED]> wrote: > Line-break CSS property should help you > here:http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/... > > However, it may not be supported by most browsers at the moment. > > Regards, > Aidas Bendoraitis aka Archatas > > On 1/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > i have a fixed textarea, rows and cols are defined. > > if the user write a text and run out of a line without a break, it > > should set a new line. > > But a new line is only set if the user press line break. > > > i test following: > > > css {white-space:pre} > > > but this dont't help, > > > is there a possibillity to solve this problem? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: not receiving error email
In my dev environment, I was able to reproduce the error - it was a typo in a method on a model object being called from a view. With DEBUG = True, Django displayed a useful message so I suspect Django had a chance to send the email. Nothing in my postfix logs points to a problem. I've since turned on SEND_BROKEN_LINK_EMAILS and tried accessing a non-existent page but no email is received in that case either. And, yes, SERVER_EMAIL is set. Is there any way to have error emails sent even when DEBUG = True? That would enable me to see if the mail sending is throwing any exception. James On 31/01/2007, at 6:49 PM, James Bennett wrote: > > On 1/31/07, James Tauber <[EMAIL PROTECTED]> wrote: >> I just got an unhandled exception error on my production site but >> didn't receive an email. > > There are some cases where this will happen; for example, the code > which would send the email lives in the handler class, so if the > handler never gets fully instantiated before an exception pops up, > then Django has no chance to send an email or try to recover > gracefully. Generally, when this happens under mod_python you get a > blank white page with some pithy error messages from mod_python > itself, and under FastCGI you'll get errors out of flup instead of > Django. > > Beyond that, I've seen plenty of weird interactions of spam filters > and other mail-oriented weirdness causes delays or even drop the > emails outright. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
textarea - autoamtic line break
hi, I use a textarea which size is set by row and cols. If I write text into the field until the line ends, the text continue automaticly in the next row. But after post, the line break isn't set in text by "\n" If have set by css -> { white-space:pre} Is there a way to solve this problem? thanks ...pex --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Help using rowcolor with cycle command
When I display a row, I am trying to display a row in a specific color. But, I am a bit confused as to how it should work within the cycle command. Here is my line of code. {% for item in result %} {{ item }}{% endfor %} How do you set rowcolors where you want the background of the line to display in green. Thanks, Jeff --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
help with queryset and ManytoMany
Hi all, Please, can you help me work out a queryset to get all the Users of all projects I belong to. from django.contrib.auth.models import User class Project ... staff = models.ManyToMany(User) My concern is the fact that I should loop over all my projects and get the staff for each ot them. Thanks in advance, Giorgio --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: order_by not working with foreign keys:
Bram - Smartelectronix: > Michael Radziej wrote: >> Bram - Smartelectronix: >> >> >>> I'll be updating the ticket, but I was wondering when the ticket would >>> be merged with trunk. >> Someone needs to writes tests for this. As soon as this has been >> done, the ticket can be promoted to "ready for checkin", which means >> added core developer attention ;-) > > I would be a prime candidate for writing this test, I guess Not necessarily. It's not trivial, but we really appreciate if you take the time to do it. Just to warn you, it still isn't a guarantee that the patch will be applied soon, that's completely dependent on the committers and their schedule, which I have no information about. If you really really need it soon, I'd recommend to patch your Django installations in the meantime for yourself, and watch carefully how it behaves after an update. > is there a > HOWTO somewhere on how to write a test which does the whole model, > database sync, etc etc cycle? http://www.djangoproject.com/documentation/testing/ explains how tests and fixtures work. Look for an existing test for this and extend it. It shouldn't be too difficult to find out how to organize the tests by looking at the existing tests. There are two main categories, one for tests that may be used as examples, too, and the other ("regression tests") that sort out all the hard edge cases and that would be too hairy as example. If you have a problem and still want to contribute the tests (which is very welcome!), don't hesitate to ask, better on the developer list. Michael -- noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg - Tel +49-911-9352-0 - Fax +49-911-9352-100 http://www.noris.de - The IT-Outsourcing Company --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: 2 Questions!
Sebastien Armand [Pink]: > This time it's done. The ticket is here: > http://code.djangoproject.com/ticket/3412 I hope it's enough documented. Merci! I finally realized that it's not about a ForeignKey, sorry for the confusion. Can you check if you can work around it with a entreprise_list=entreprise_list.filter(domaine=data['domaine'].encode(settings.DEFAULT_CHARSET)) etc.? Hope that helps! Michael -- noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg - Tel +49-911-9352-0 - Fax +49-911-9352-100 http://www.noris.de - The IT-Outsourcing Company --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multilingual content - yet another idea
Regarding the list of available languages, I think that the translation system should use the settings, provided by default (LANGUAGE_CODE and LANGUAGES) instead of ids or other list variables. http://www.djangoproject.com/documentation/settings/#language-code Regards, Aidas Bendoraitis On 2/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > On 1 Lut, 09:52, "daev" <[EMAIL PROTECTED]> wrote: > > Thanks. But i still have this problem. Even after update my work copy > > of code > > Strange. Could you send me your model? > > Also, could you try the Category model from testproject? It works for > me > and shows fields' verbose_names in column headers. > > > I want to say some word about usage of your workaround: > > -i move LANGUAGES into settings file and make it tuple of tuble not > > lists. Why do you not do so?:) > > Frankly, it is because I did not find a good name for it and did not > want > to create something temporary. But you are right, I should do that > soon :) > > Same goes for tuples vs lists. To me the difference here is mainly > cosmetic, but I agree that tuples are a bit better choice for data > that > should not be modified. > > > -i write MultilangualMiddleware. It check request language code and > > set default language. It helps me not to rewrite my existing code. > > Great. That was the purpose of set_default_language since the > beginning, > I just did not get to writing the middleware yet. I do want to add > something > like this to the library, would you mind sharing your solution? > > Which reminds me, I need to change set_default_language to use > threadlocals. Right now the library is broken for multithreaded > applications. > > > And i want to thank you. Your code very helps me > > Glad to hear that. Now help me test it :) > > -mk > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multilingual content - yet another idea
On 1 Lut, 09:52, "daev" <[EMAIL PROTECTED]> wrote: > Thanks. But i still have this problem. Even after update my work copy > of code Strange. Could you send me your model? Also, could you try the Category model from testproject? It works for me and shows fields' verbose_names in column headers. > I want to say some word about usage of your workaround: > -i move LANGUAGES into settings file and make it tuple of tuble not > lists. Why do you not do so?:) Frankly, it is because I did not find a good name for it and did not want to create something temporary. But you are right, I should do that soon :) Same goes for tuples vs lists. To me the difference here is mainly cosmetic, but I agree that tuples are a bit better choice for data that should not be modified. > -i write MultilangualMiddleware. It check request language code and > set default language. It helps me not to rewrite my existing code. Great. That was the purpose of set_default_language since the beginning, I just did not get to writing the middleware yet. I do want to add something like this to the library, would you mind sharing your solution? Which reminds me, I need to change set_default_language to use threadlocals. Right now the library is broken for multithreaded applications. > And i want to thank you. Your code very helps me Glad to hear that. Now help me test it :) -mk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: 2 Questions!
This time it's done. The ticket is here: http://code.djangoproject.com/ticket/3412 I hope it's enough documented. 2007/2/1, Sebastien Armand [Pink] <[EMAIL PROTECTED]>: > > Oooops didn't read enaough from the #3387 ticket. So I'll open one! > Thanks a lot for your explanations. > > 2007/2/1, Michael Radziej <[EMAIL PROTECTED] >: > > > > > > Sebastien Armand [Pink]: > > > No problem, thanks! > > > > > > There's already a ticket, it's here: > > > http://code.djangoproject.com/ticket/3387 > > > > No, thanks for searching, but it's not. #3387 was triggered by using > > > > queryset.filter(unicode_string) > > > > You didn't use a unicode_string within filter(), though the > > traceback is similar. It happened because Django's ORM internal code > > looks up the related records to a foreign key with filter(), and > > uses a unicode string because because newforms put it in the model. > > > > It's a new bug, but the patch in the #3387 should heal it. Funny. > > Please *do* open a ticket. #3387 is closed. I'm now pretty sure that > > your case has not been reported before. > > > > > But though, is there another encoding I could use and how do I specify > > it? > > > > Short answer: No, unless you want to patch Django or python ;-) > > > > The concept of a default encoding is doomed, and python has finally > > learned the lesson. I guess that you can use unicode(bytestring) > > without giving an encoding at all is a trap that stems from times > > when python had a settable default encoding. ASCII is used as a > > default encoding in these circumstances. The same applies for > > str(unicode_string) or for (bytestring == unicode_string). All these > > are traps, traps, traps. > > > > There is a hook in site.py, but this was left in for experiments. If > > you use it, you'll probably get into devil's kitchen. > > > > > > Michael > > > > > > -- > > noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg - > > Tel +49-911-9352-0 - Fax +49-911-9352-100 > > > > http://www.noris.de - The IT-Outsourcing Company > > > > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: 2 Questions!
Oooops didn't read enaough from the #3387 ticket. So I'll open one! Thanks a lot for your explanations. 2007/2/1, Michael Radziej <[EMAIL PROTECTED]>: > > > Sebastien Armand [Pink]: > > No problem, thanks! > > > > There's already a ticket, it's here: > > http://code.djangoproject.com/ticket/3387 > > No, thanks for searching, but it's not. #3387 was triggered by using > > queryset.filter(unicode_string) > > You didn't use a unicode_string within filter(), though the > traceback is similar. It happened because Django's ORM internal code > looks up the related records to a foreign key with filter(), and > uses a unicode string because because newforms put it in the model. > > It's a new bug, but the patch in the #3387 should heal it. Funny. > Please *do* open a ticket. #3387 is closed. I'm now pretty sure that > your case has not been reported before. > > > But though, is there another encoding I could use and how do I specify > it? > > Short answer: No, unless you want to patch Django or python ;-) > > The concept of a default encoding is doomed, and python has finally > learned the lesson. I guess that you can use unicode(bytestring) > without giving an encoding at all is a trap that stems from times > when python had a settable default encoding. ASCII is used as a > default encoding in these circumstances. The same applies for > str(unicode_string) or for (bytestring == unicode_string). All these > are traps, traps, traps. > > There is a hook in site.py, but this was left in for experiments. If > you use it, you'll probably get into devil's kitchen. > > > Michael > > > -- > noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg - > Tel +49-911-9352-0 - Fax +49-911-9352-100 > > http://www.noris.de - The IT-Outsourcing Company > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
django and tramline integration
Hi Someone please help me how to integrate tramline with django. Are there any example for this? Thank --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: order_by not working with foreign keys:
Michael Radziej wrote: > Bram - Smartelectronix: > > >> I'll be updating the ticket, but I was wondering when the ticket would >> be merged with trunk. > > Someone needs to writes tests for this. As soon as this has been > done, the ticket can be promoted to "ready for checkin", which means > added core developer attention ;-) I would be a prime candidate for writing this test, I guess, is there a HOWTO somewhere on how to write a test which does the whole model, database sync, etc etc cycle? - bram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: order_by not working with foreign keys:
Bram - Smartelectronix: > I'll be updating the ticket, but I was wondering when the ticket would > be merged with trunk. Someone needs to writes tests for this. As soon as this has been done, the ticket can be promoted to "ready for checkin", which means added core developer attention ;-) Michael -- noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg - Tel +49-911-9352-0 - Fax +49-911-9352-100 http://www.noris.de - The IT-Outsourcing Company --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: order_by not working with foreign keys:
Michael Radziej wrote: > Hi, > > there's a ticket with a patch about the order_by-Problem: > > http://code.djangoproject.com/ticket/2210. > > Does it help? I just figured out that this problem also exists, even if the name ISN'T different: class Book(models.Model): title = models.TextField() class BookStat(models.Model): book = models.OneToOneField(Book) times_read = models.PositiveIntegerField() Book.objects.all().order_by("bookstat__times_read") gives the same error(s). So it's not just for relations with other names, but any relation defined in another table. I'll be updating the ticket, but I was wondering when the ticket would be merged with trunk. - bram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: 2 Questions!
Sebastien Armand [Pink]: > No problem, thanks! > > There's already a ticket, it's here: > http://code.djangoproject.com/ticket/3387 No, thanks for searching, but it's not. #3387 was triggered by using queryset.filter(unicode_string) You didn't use a unicode_string within filter(), though the traceback is similar. It happened because Django's ORM internal code looks up the related records to a foreign key with filter(), and uses a unicode string because because newforms put it in the model. It's a new bug, but the patch in the #3387 should heal it. Funny. Please *do* open a ticket. #3387 is closed. I'm now pretty sure that your case has not been reported before. > But though, is there another encoding I could use and how do I specify it? Short answer: No, unless you want to patch Django or python ;-) The concept of a default encoding is doomed, and python has finally learned the lesson. I guess that you can use unicode(bytestring) without giving an encoding at all is a trap that stems from times when python had a settable default encoding. ASCII is used as a default encoding in these circumstances. The same applies for str(unicode_string) or for (bytestring == unicode_string). All these are traps, traps, traps. There is a hook in site.py, but this was left in for experiments. If you use it, you'll probably get into devil's kitchen. Michael -- noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg - Tel +49-911-9352-0 - Fax +49-911-9352-100 http://www.noris.de - The IT-Outsourcing Company --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: 2 Questions!
No problem, thanks! There's already a ticket, it's here: http://code.djangoproject.com/ticket/3387 But though, is there another encoding I could use and how do I specify it? 2007/2/1, Michael Radziej <[EMAIL PROTECTED]>: > > > Hi Sebastien, > > I don't see where the exact problem is and whether there's already a > ticket, but this is a bug within the newforms package. It is caused > due to newforms putting unicode into the models, but most parts of > Django are not unicode ready. You can search in the existing tickets > (with category == 'newforms') whether there's already a patch. > > If not, could you please open a new ticket and provide exactly the > information from the mail I'm replying to? If you put {{{ and }}} > around the traceback and the code, it won't look as bad as in email > (it's always like this in mail). And please put a link to this > thread's google archive, if you can. > > Sebastien Armand [Pink]: > > So the exact unicode error is: > > > > UnicodeEncodeError at /entreprise/search/ 'ascii' codec can't encode > > character u'\xe9' in position 1: ordinal not in range(128) Request > Method: > > POST Request URL: http://localhost/entreprise/search/ Exception Type: > > UnicodeEncodeError Exception Value: 'ascii' codec can't encode > character > > u'\xe9' in position 1: ordinal not in range(128) Exception Location: > > c:\Python25\lib\site-packages\django\db\models\fields\__init__.py > > in , line 25 > > > > with the following traceback: > > > > Traceback (most recent call last): > > File "c:\Python25\lib\site-packages\django\template\__init__.py" in > > render_node > > 712. result = node.render(context) > > File "c:\Python25\lib\site-packages\django\template\defaulttags.py" in > > render > > 100. len_values = len(values) > > File "c:\Python25\lib\site-packages\django\db\models\query.py" in > __len__ > > 100. return len(self._get_data()) > > File "c:\Python25\lib\site-packages\django\db\models\query.py" in > _get_data > > 430. self._result_cache = list(self.iterator()) > > File "c:\Python25\lib\site-packages\django\db\models\query.py" in > iterator > > 171. select, sql, params = self._get_sql_clause() > > File "c:\Python25\lib\site-packages\django\db\models\query.py" in > > _get_sql_clause > > 444. joins2, where2, params2 = self._filters.get_sql(opts) > > File "c:\Python25\lib\site-packages\django\db\models\query.py" in > get_sql > > 574. joins2, where2, params2 = val.get_sql(opts) > > File "c:\Python25\lib\site-packages\django\db\models\query.py" in > get_sql > > 622. return parse_lookup(self.kwargs.items(), opts) > > File "c:\Python25\lib\site-packages\django\db\models\query.py" in > > parse_lookup > > 743. joins2, where2, params2 = lookup_inner(path, lookup_type, value, > > opts, opts.db_table, None) > > File "c:\Python25\lib\site-packages\django\db\models\query.py" in > > lookup_inner > > 915. params.extend(field.get_db_prep_lookup(lookup_type, value)) > > File "c:\Python25\lib\site-packages\django\db\models\fields\__init__.py" > in > > get_db_prep_lookup > > 172. return ["%%%s%%" % prep_for_like_query(value)] > > File "c:\Python25\lib\site-packages\django\db\models\fields\__init__.py" > in > > 25. prep_for_like_query = lambda x: str(x).replace("\\", > > "").replace("%", "\%").replace("_", "\_") > > the str(x) throws this exception when x is not an ASCII character. > > > > > UnicodeEncodeError at /entreprise/search/ > > 'ascii' codec can't encode character u'\xe9' in position 1: ordinal > not in > > range(128) > > Michael > > -- > noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg - > Tel +49-911-9352-0 - Fax +49-911-9352-100 > > http://www.noris.de - The IT-Outsourcing Company > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multilingual content - yet another idea
> <[EMAIL PROTECTED]> wrote: > > Well, I was wrong and there was a way around it. I just committed > a new version that displays correct column headers in admin list view. > It does not require any workarounds anymore. > > -mk Thanks. But i still have this problem. Even after update my work copy of code I want to say some word about usage of your workaround: -i move LANGUAGES into settings file and make it tuple of tuble not lists. Why do you not do so?:) -i write MultilangualMiddleware. It check request language code and set default language. It helps me not to rewrite my existing code. And i want to thank you. Your code very helps me PS: Sorry for my English --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---