Re: What causes request.session to be erased?...When you go to different view?

2010-07-09 Thread Javier Guerra Giraldez
On Fri, Jul 9, 2010 at 11:36 PM, Chris Seberino wrote: > elif form.is_valid(): >        ... >        request.session["posts"].append(form.cleaned_data) >         > > I noticed that everytime I revisit this form and rerun this view, the > request.session["posts"] lists gets blown away and is em

Re: Unexpected query behavior

2010-07-09 Thread Skylar Saveland
http://docs.djangoproject.com/en/1.2/topics/db/queries/#spanning-multi-valued-relationships On Jul 10, 12:33 am, Skylar Saveland wrote: > If I chain my .filter()s > > Collection.objects.filter(collection_revisions__articles=article).filter(co > llection_revisions__char_fi="p") > > collection_rev

Re: Unexpected query behavior

2010-07-09 Thread Skylar Saveland
the second query should read: Collection.objects.filter(collection_revisions__articles=article, collection_revisions__revision_tag="p") -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegrou

What causes request.session to be erased?...When you go to different view?

2010-07-09 Thread Chris Seberino
Ever time a web page is visited, a view is called and a NEW request object is passed in right? Then if I'm not mistaken, it appears you can't maintain request.session when you visit a new web page and a new view because a NEW request object is passed in to the new view right? My personal co

Unexpected query behavior

2010-07-09 Thread Skylar Saveland
If I chain my .filter()s Collection.objects.filter(collection_revisions__articles=article).filter(collection_revisions__char_fi="p") collection_revisions is related_name, FK to Collection. articles relname, m2m with collection_revision (with a through table). I get ~20 results with this query::

how to dynamically update model fields?

2010-07-09 Thread zweb
I want to provide a method as follows, def update_some_model_field(key, field_name, value): '''user provides the primary key of row, field name in model and the value and the method updates the field for that row with the value''' 1. model_obj = Some_model.objects.get(pk = key) 2. model_obj."

Deleting sessions without Request object

2010-07-09 Thread Greg Pelly
Is it possible to log out a user manually? The desired result is that after I do this, the user will be forced to log in again. I will not have an active Request object (ie, this will be done from the admin app or a management command, not a view). Can I simply add the Session table to the admin

Re: Question on the Tutorial

2010-07-09 Thread John M
Also check out the paginator view http://docs.djangoproject.com/en/dev/topics/pagination/ On Jul 9, 12:27 pm, rupert wrote: > I'm creating an app based on the tutorial. Is there a way to display > all of the objects that are created on the same page using a view? > Could someone help me with tha

Re: New tutorial added to Django by Example

2010-07-09 Thread John M
WOW, this is very cool, you should see if you can add it to the main django tutorial someway? J On Jul 6, 3:50 pm, Rainy wrote: > I've added a new tutorial: A simple Blog to my Django by Example site. > As > always, feedback is appreciated. > > This tutorial covers display of monthly archive, pa

How to modify many to many data without auto saving to DB?

2010-07-09 Thread zweb
Assume there is many to many between publication and article. (example from django docs) By default following stmt will auto save the relationship between a_publication and article11 in database. a_publication.articles = [article11] how do I get that so that it changes only in memory (for sessio

Re: Cannot connect to #django on irc

2010-07-09 Thread Kenneth Gonsalves
On Friday 09 July 2010 14:34:15 david ally wrote: > I have been trying to join the irc channel for django and it is always > giving me one problem or the other, one time it would respond that i need > to identify with service, other times is etc... > > == #django Cannot join channel (+r) - you ne

Re: list display based on logged-in user

2010-07-09 Thread rahul jain
yup that's 100% correct :) Rahul On Fri, Jul 9, 2010 at 10:27 AM, raj wrote: > You are trying to override change_view instead of changelist_view. > Otherwise your approach must work. > class CustomAdmin(admin.ModelAdmin): >    def changelist_view(whatever_args_are_here): >        if condition: >

defining custom attributes for a model

2010-07-09 Thread Sells, Fred
I've got a model as illustrated below. Is there any way I can define my own attributes that are not columns like the "fredsstuff" below? class A(MDSSection): A0100A= models.CharField(max_length=10, help_text='''Text : Facility National Provider Identifier (NPI)''') A0100B=

Re: New tutorial added to Django by Example

2010-07-09 Thread Rainy
Thanks for great comments, Euan. See a few notes below.. On Jul 7, 6:20 am, "euan.godd...@googlemail.com" wrote: > Hi again, > > I've had a read over your blog tutorial and have the following > suggestions: > > 1) Make it PEP-8 (http://www.python.org/dev/peps/pep-0008/) compliant > - it's a lot e

Re: Get pk before commit

2010-07-09 Thread Andy McKay
> I'd like to save the image file into a folder based on the ID of the > new instance. I wouldn't actually recommend saving your file with the filename being the primary key of your model anyway. It makes it a pain if you do database dumps or loads and need to keep the primary key in sync with y

manager not getting used by User subclass when new User subclass is created in admin interface

2010-07-09 Thread Jacob Fenwick
I want to change the behavior of what happens when you add User objects in the admin. I subclassed the User object and added a custom manager that changes the behavior of create_user. Then I created a ModelAdmin corresponding to this subclassed User and registered them together with the admin. T

Re: Question on the Tutorial

2010-07-09 Thread Daniel Roseman
On Jul 9, 8:27 pm, rupert wrote: > I'm creating an app based on the tutorial. Is there a way to display > all of the objects that are created on the same page using a view? > Could someone help me with that? You can get the full list of objects in the view with MyModel.objects.all(). Send that to

Re: split views & shared tables for apps

2010-07-09 Thread Daniel Roseman
On Jul 9, 3:52 pm, alan-l wrote: > Hi, > > Im looking to use django to merge 2 MS Access databases into one and > was wondering the following: > > Can a front end view support displaying 2 tables in one view? so > having a contact on the top half and the company details on the bottom > half? > Als

Question on the Tutorial

2010-07-09 Thread rupert
I'm creating an app based on the tutorial. Is there a way to display all of the objects that are created on the same page using a view? Could someone help me with that? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: translation for variables

2010-07-09 Thread Börni
On Jul 9, 10:11 am, Lachlan Musicman wrote: > On Fri, Jul 9, 2010 at 07:05, Börni wrote: > > Hello together, > > i'm using the trans tpl tag for translation a value from database. If > > i'm adding this value to my django.po file and run makemessages > > afterwards, my changes got lost. > > Are y

Re: Overwhelmed by File upload instructions

2010-07-09 Thread Lee Hinde
I recently struggled with file transfers. After I was done I discovered django-filetransfers. http://www.allbuttonspressed.com/projects/django-filetransfers On Thu, Jul 8, 2010 at 2:55 PM, Rodion Raskolnikiv wrote: > Soo easy... > Thanks for the tips! > I knew that there had to be a simple solu

Re: list display based on logged-in user

2010-07-09 Thread raj
You are trying to override change_view instead of changelist_view. Otherwise your approach must work. class CustomAdmin(admin.ModelAdmin): def changelist_view(whatever_args_are_here): if condition: self.list_display = custom_list return super(CustomAdmin, self).ch

Django auth/many to many issue?

2010-07-09 Thread zweb
if i do, request.user.groups = [group1] Sometimes it saves this in DB auth_user_group , sometimes it does not. I do not have any save() stmt. What is the expected behavior? I do not want it to save it in DB without explicit save, How do I achieve that? -- You received this message because you

Django auth/many to many issue?

2010-07-09 Thread zweb
if i do, request.user.groups = [group1] Sometimes it saves this in DB auth_user_group , sometimes it does not. I do not have any save() stmt. What is the expected behavior? I do not want it to save it in DB without explicit save, How do I achieve that? -- You received this message because you

Re: Get pk before commit

2010-07-09 Thread TheIvIaxx
that only seems to work on ModelForm, not Model. Or did i miss something? That functionality seems to be what i'm after though :) On Jul 8, 4:07 pm, Kenneth Gonsalves wrote: > On Friday 09 July 2010 03:16:28 TheIvIaxx wrote: > > > I'd like to save the image file into a folder based on the ID of

Re: urllib and writing web service clients

2010-07-09 Thread Javier Guerra Giraldez
On Fri, Jul 9, 2010 at 10:27 AM, irum wrote: > From command prompt, I invoke. curl > http://127.0.0.1:8000/api/hb/bookings/21/rooms/ > It does not respond anything, even if left for long time. However if I > use remote url, i.e. : > req = urllib2.Request('http://www.example.com') , it returns the

urllib and writing web service clients

2010-07-09 Thread irum
Hi, I am relatively new to working with django and web services. I am using django-piston and I posted this on that group as well but got no reply yet. Posting it here since its more active community and my problem is not related to Django-piston in particular but rather Django and web services in

Failed unit test when using client.get()

2010-07-09 Thread tiemonster
I'm attempting to run a test suite. I am able to log in successfully, but when I request the first page, I get a broken unit test in contrib.auth. Here's the code: from django.test import TestCase from django.test.client import Client from django.contrib.auth.models import User class ReportTest(T

Re: Paid support for Django?

2010-07-09 Thread Alexander Jeliuc
Try djangopeople On Fri, Jul 9, 2010 at 6:00 PM, Derek wrote: > Not sure if this is the right place to ask, but... how do I go about > finding Django developers that offer support for development of Django > apps. i.e. not do the development themselves, but be available to > provide answers to

Paid support for Django?

2010-07-09 Thread Derek
Not sure if this is the right place to ask, but... how do I go about finding Django developers that offer support for development of Django apps. i.e. not do the development themselves, but be available to provide answers to key questions (the ones that typically are not answered on this mailing l

split views & shared tables for apps

2010-07-09 Thread alan-l
Hi, Im looking to use django to merge 2 MS Access databases into one and was wondering the following: Can a front end view support displaying 2 tables in one view? so having a contact on the top half and the company details on the bottom half? Also, can the view support read,update & delete all w

Re: Is Django right for what I am trying to do

2010-07-09 Thread derek
On Jul 9, 12:29 am, Martin Tiršel wrote: > On Thu, 08 Jul 2010 23:23:53 +0200, Bradley Hintze   > > wrote: > > I guess I just don't like the model.py, views.py, templates, and > > url.py. In the tutorial you have to edit all of these and THEN you get > > something that you can send to the client.

Re: Django return redirect() with parameters

2010-07-09 Thread Daniel Roseman
On Jul 9, 2:22 pm, jacob-pl wrote: > In my view function I want to call another view and pass data to it : I responded to this question in detail when you posted it on StackOverflow. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To po

Django return redirect() with parameters

2010-07-09 Thread jacob-pl
In my view function I want to call another view and pass data to it : return redirect('some-view-name', backend, form.cleaned_data) , where backend is of registration.backends object, and form.cleaned_data is a dict of form data (but both must be either sent as *args or **kwargs to prevent raising

Re: Tutorial Help

2010-07-09 Thread Gui London
Hi guys, There is an error, I can't remember where it is, I think it's on views. I'll try and find out. Something incompatible with the new version of django. On Jul 8, 6:04 pm, david wrote: > Bradley, > > I think there's a typing error somewhere there, search for where  you > have pollsdjan

Re: db_schema support was broken by Debian upgrade: 'class Meta' got invalid attribute(s): db_schema

2010-07-09 Thread MiddleForkGIS
Thank you, I'm sure you're essentially correct, with one wrinkle. What I believe happened was that the Debian upgrade resulted in a change from python 2.5 to 2.6, and so I believe that what happened was that resulted in the pythonpath changing as well, and pointing to the Debian 'python-django' pac

Re: Accessing context in templatetags

2010-07-09 Thread Miha V
Venkatraman, there was something I was missing, and just found the solution. The tag is defined as (overly simplified) @register.filter @stringfilter def cmstags(value, arg=None): return '%s' % value the value is the HTML content. And I needed another context-related parameter in the filter

Re: Log errors to file

2010-07-09 Thread Sævar Öfjörð
That's something that would be nice to have as a snippet on djangosnippets.org! On Jul 8, 11:34 am, "euan.godd...@googlemail.com" wrote: > I have created a decorator for Django views which handles AJAX > tracebacks and sends the traceback back to the AJAX application as > JSON, e.g. > > {'status'

Re: Accessing context in templatetags

2010-07-09 Thread Venkatraman S
If you are using render_to_response to load a page and are using template tags in that page then pass the context (this in views.py for that app) For eg: def do_something(request): ... ... return render_to_response('multimedia.html', {'videos': videos} , context_instance = RequestContext(reque

Accessing context in templatetags

2010-07-09 Thread Miha V
Hi! Is there a way to access context from within templatetags? Specifically, we only load the templatetags and do the processing when the filters get registered, so we're not using the actual filters or tags {% someting %} in the templates. What we do is we replace some of the markup () with anot

Re: Cannot connect to #django on irc

2010-07-09 Thread Syed Ali Saim
register your nick. #django accepts registered users. try /msg nickserv register On Fri, Jul 9, 2010 at 2:04 PM, david ally wrote: > I have been trying to join the irc channel for django and it is always > giving me one problem or the other, one time it would respond that i need to > identify w

Re: News on every page

2010-07-09 Thread Martin Tiršel
On Thu, 08 Jul 2010 18:07:58 +0200, Martin Tiršel wrote: Hello, I am programming a small CMS on Django, I have editable pages, now I want to add news. I have a website where I want to display these news on every page in right/left column. I have following questions: 1.) Where is the ri

Re: News on every page

2010-07-09 Thread Sævar Öfjörð
That depends entirely on your cache configuration! Caching in django: http://docs.djangoproject.com/en/dev/topics/cache/ Automatic caching modules that rely on memcached exist, like Johnny Cache (http://packages.python.org/johnny-cache/) and Django Cache Machine (http://github.com/jbalogh/django-c

Re: reverse relationships and their creation

2010-07-09 Thread Daniel Roseman
On Jul 9, 11:27 am, Alex wrote: > Hi Daniel, > > Models - > > class Reel(models.Model): >     st = models.DateTimeField(auto_now_add=True) >     et = models.DateTimeField(auto_now=True) >     othermodel= models.ForeignKey(Othermodel) > > class Othermodel(models.Model): >     name = models.CharFiel

Re: How to commit ManyToManyField with ModelForm

2010-07-09 Thread Sævar Öfjörð
Have you tried resetting your database and syncing it again? If there are columns missing it sounds like you added them after you did a manage.py syncdb Django will not alter your tables after they have been created. More info on this here: http://docs.djangoproject.com/en/dev/ref/django-admin/?fro

Re: reverse relationships and their creation

2010-07-09 Thread Alex
Hi Daniel, Models - class Reel(models.Model): st = models.DateTimeField(auto_now_add=True) et = models.DateTimeField(auto_now=True) othermodel= models.ForeignKey(Othermodel) class Othermodel(models.Model): name = models.CharField(max_length=100, blank=False) Code - om = O

Re: reverse relationships and their creation

2010-07-09 Thread Daniel Roseman
On Jul 9, 10:59 am, Alex wrote: > Hi, > I am getting a 'QuerySet' object has no attribute 'reel_set' on a > reverse relationship query. > > I am pretty sure the models are correct which has made me look at what > else might be the problem. So far I have thought of: > > - no relationships instances

reverse relationships and their creation

2010-07-09 Thread Alex
Hi, I am getting a 'QuerySet' object has no attribute 'reel_set' on a reverse relationship query. I am pretty sure the models are correct which has made me look at what else might be the problem. So far I have thought of: - no relationships instances have been created between the two models so ef

Re: Calling remote API

2010-07-09 Thread Tom Evans
On Fri, Jul 9, 2010 at 3:59 AM, james_027 wrote: > hi all, > It will be my first time to create django app that requires calling > remote API. As far as I know django has no built in support for this. > I only way I know is URLLIB2, any good library for this purpose, which > easily send your reque

Re: Cannot connect to #django on irc

2010-07-09 Thread Tom Evans
On Fri, Jul 9, 2010 at 10:04 AM, david ally wrote: > I have been trying to join the irc channel for django and it is always > giving me one problem or the other, one time it would respond that i need to > identify with service, other times is etc... > > == #django Cannot join channel (+r) - you ne

Cannot connect to #django on irc

2010-07-09 Thread david ally
I have been trying to join the irc channel for django and it is always giving me one problem or the other, one time it would respond that i need to identify with service, other times is etc... == #django Cannot join channel (+r) - you need to be identified with services, -NickServ- You failed to

Re: default is_active to true on new users

2010-07-09 Thread Alexandre González
I don't know, but try something as this to the help_text: class RegistrationFormTOSAndUniqueEmail(RegistrationFormTermsOfService, RegistrationFormUniqueEmail): class MyUserAdminForm(forms.ModelForm): def __init__(self, *args, **kwargs): self.fields['is_staff'].help_text = _("Test.")

Re: default is_active to true on new users

2010-07-09 Thread Alexandre González
Hi! Perhaps you can do it easily with signals instead override the save method, take a look to this: http://www.ibm.com/developerworks/opensource/library/os-django-admin/index.html Good luck and ask again if they don

Re: translation for variables

2010-07-09 Thread Lachlan Musicman
On Fri, Jul 9, 2010 at 07:05, Börni wrote: > Hello together, > i'm using the trans tpl tag for translation a value from database. If > i'm adding this value to my django.po file and run makemessages > afterwards, my changes got lost. Are you manually adding the field to your po file? Are you run

save_image_file

2010-07-09 Thread yelbuke
Hi all, I'm building a image-upload based site. And having some problems resizing, renaming, saving. At last i've found save_image_file() method. But i couldnt found a documentation about this method. I think i need some help about that point. Thanks to all, -- You received this message because