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 empty again!?!?
>
>
> Am I misunderstanding something about requests and sessions?


from the docs 
(http://docs.djangoproject.com/en/1.2/topics/http/sessions/#when-sessions-are-saved):

  # Gotcha: Session is NOT modified, because this alters
  # request.session['foo'] instead of request.session.
  request.session['foo']['bar'] = 'baz'
  In the last case of the above example, we can tell the session
object explicitly that it has been modified by setting the modified
attribute on the session object:

  request.session.modified = True


that's exactly your case.  the session object is saved automatically
only when it's marked as modified.  but when you modify an object
inside the session and not the session itself; it doesn't gets
notified of the change, so you have to tell it explicitly.



-- 
Javier

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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_revisions is related_name, FK to Collection.
> articles relname, m2m with collection_revision (with a through table).
>
> I get ~20 results with this query::
>
> SELECT "catalog_collection"."id",
>         ...
>
>        "catalog_collection"."collection_type_id"
> FROM "catalog_collection"
> INNER JOIN "catalog_collection_revision" ON ("catalog_collection"."id"
> = "catalog_collection_revision"."collection_id")
> INNER JOIN "catalog_collection_revision_item" ON
> ("catalog_collection_revision"."id" =
> "catalog_collection_revision_item"."collection_revision_id")
> INNER JOIN "catalog_collection_revision" T5 ON
> ("catalog_collection"."id" = T5."collection_id")
> WHERE ("catalog_collection"."is_archived" = False
>        AND "catalog_collection_revision_item"."article_id" = 3
>        AND T5."revision_tag" = p)
>
> When I put the two queries within the same call to filter, I thought
> it would be the same.  But, there is not the 3rd INNER JOIN and it
> only returns 1 object::
>
> Collection.objects.filter(collection_revisions__articles=article,
> filter(collection_revisions__revision_tag="p")
>
> SELECT "catalog_collection"."id",
>         ...
>
>        "catalog_collection"."collection_type_id"
> FROM "catalog_collection"
> INNER JOIN "catalog_collection_revision" ON ("catalog_collection"."id"
> = "catalog_collection_revision"."collection_id")
> INNER JOIN "catalog_collection_revision_item" ON
> ("catalog_collection_revision"."id" =
> "catalog_collection_revision_item"."collection_revision_id")
> WHERE ("catalog_collection"."is_archived" = False
>        AND "catalog_collection_revision_item"."article_id" = 3
>        AND "catalog_collection_revision"."revision_tag" = p)
>
> Is this the expected behavior?  Can someone explain what's going on?

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 code visits a certain form multiple times to create new
"posts".  I was trying to collect them in a list I store in the
session as follows

...
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 empty again!?!?


Am I misunderstanding something about requests and sessions?

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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::


SELECT "catalog_collection"."id",
...

   "catalog_collection"."collection_type_id"
FROM "catalog_collection"
INNER JOIN "catalog_collection_revision" ON ("catalog_collection"."id"
= "catalog_collection_revision"."collection_id")
INNER JOIN "catalog_collection_revision_item" ON
("catalog_collection_revision"."id" =
"catalog_collection_revision_item"."collection_revision_id")
INNER JOIN "catalog_collection_revision" T5 ON
("catalog_collection"."id" = T5."collection_id")
WHERE ("catalog_collection"."is_archived" = False
   AND "catalog_collection_revision_item"."article_id" = 3
   AND T5."revision_tag" = p)



When I put the two queries within the same call to filter, I thought
it would be the same.  But, there is not the 3rd INNER JOIN and it
only returns 1 object::

Collection.objects.filter(collection_revisions__articles=article,
filter(collection_revisions__revision_tag="p")

SELECT "catalog_collection"."id",
...

   "catalog_collection"."collection_type_id"
FROM "catalog_collection"
INNER JOIN "catalog_collection_revision" ON ("catalog_collection"."id"
= "catalog_collection_revision"."collection_id")
INNER JOIN "catalog_collection_revision_item" ON
("catalog_collection_revision"."id" =
"catalog_collection_revision_item"."collection_revision_id")
WHERE ("catalog_collection"."is_archived" = False
   AND "catalog_collection_revision_item"."article_id" = 3
   AND "catalog_collection_revision"."revision_tag" = p)


Is this the expected behavior?  Can someone explain what's going on?

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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."field_name" = value  ## HOW to make this line generic??
I do not want to do lots of If as shown below.
3. model_obj.save()


For line 2 another way to write it is  as follows, which I want to
avoid:

if field_name == "field_a":
model_obj.field_a = value
elif field_name == "field_b":
   model_obj.field_b = value
and so on... for 20 fields of 20 models

Any suggestions?

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 app and manually delete a
user's entry?

Thanks,
Greg

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 that?

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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, pagination, a simple,
> basic comment system, notification when comments are posted and a
> flexible
> interface for deletion of spammy comments.
>
> Hope you enjoy it! -ak

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 session) but
does not get saved in DB unless explicitly told to save?

[I cannot change the table structure  to remove many to many]

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 need to be identified with
> services,
> 
> -NickServ- You failed to identify in time for the nickname david
> 
> Also, where do I setup the password for the django channel? I thought it is
> supposed to be the same password i setup in the google group?
> 

you need a password for registering which will work on all freenode channels. 
Get onto freenode and do:
/msg nickserv register  

this will register your nick if it is not already registered. Once registered, 
to identify:
/msg nickserv identify 

and for help:
/msg nickserv help


-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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:
>                self.list_display = custom_list
>       return super(CustomAdmin, self).changelist_view(...)
>
> On Jul 9, 6:16 am, rahul jain  wrote:
>> anyone on this ?
>
> --
> 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...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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= models.CharField(max_length=12, help_text='''Text  :
Facility CMS Certification Number (CCN)''') 
A0100C= models.CharField(max_length=15, help_text='''Text  :
State provider number''') 
A0200 = models.CharField(max_length= 1, help_text='''Code  :
Type of provider''') 
A0310A= models.CharField(max_length= 2, help_text='''Code  :
Type of assessment: OBRA''')
...
class Meta:
db_table = 'A'
fredsstuff = "xy"

def validate(self):
errors = self.checkThis(fredsstuff)
return errors

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 easier to read.

I fixed some things, I'm a bit ambivalent about 79 char limit. I feel
that with monitors getting larger, I think a lot of people use wider
windows, even if you have two 100-char windows side by side, you'll
still have some space left on many monitors. And there's a lot less
wrapping going from 79 to 99.

I also think code like:

if: ..
else: ..

..

looks more readable in most cases (depending on how long the clauses
are), than:

if:
..
else:
..
..

In other words, I always try to add a line after this type of
construct. (I know I missed it in a few places in current tutorial.)

> 2) Except only the error that might occur in the paginatior example.
> Bare excepts are BAD.

True, will fix.

> 3) Maybe consider enabling the context processor that adds the current
> user to the context

That's something I haven't done before so I'm not sure how to do it.

> 4) Consider using @login_required since all your views will break for
> logged out users

Hmm, all views work fine for me when logged out..

> 5) Consider using {% url %} instead of hard-coding your URLs

I'm running into problems with this tag in some cases. For example, in
admin's template, if I say {% url dbe.blog %} or just {% blog %}, or
add '.urls' to either, it's unable to reverse and throws an error. The
same thing happens when I try to do {% blog.urls post.id %} for the
"comments" link that goes on front page. I haven't used reverse before
so I might be missing something here.. In all other links in this
tutorial, reverse works fine.

> 6) It isn't necessary to coerce the pk to an int as Django takes care
> of it in: Post.objects.get(pk=int(pk))

Thanks! will fix..

> 7) I think the naming of variables in the add_comment view are
> confusing. The comment object is given a single letter name "c", but
> the comment form is confusingly given the name "comment". I'd suggest
> using more descriptive names,

Actually comment form is called cf, and on save it returns comment
object. But you're right, it shouldn't be called 'c' at first, will
fix..

> 8) In the same section you assume that the POST data will always have
> the key. Either use form validation here or allow for the POST to have
> missing data.

True, will fix.

> 9) The mkmonth_list could largely be taken care of by the builtin
> calendar module

I don't see how this function can be simplified with calendar. I'm
pretty familiar with it, I used it in a few projects recently.
Calendar is mostly helpful for days / weeks.

>
> Hope you find this helpful.

Very much so! Keep 'em coming!

>
> Euan

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 your files. I would 
recommend making a UID field on your model (which also doesn't require a 
transaction) and using that for your filename.
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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.

The trouble is, when I create a user, nothing different happens.

The message "In MyUserManager" should be printed out, but it's not.

I've posted the code below.

Does anyone see any mistakes? Or is there any hooks I'm missing or
holes in my logic?


Thanks,

Jacob


=models.py
from django.contrib.auth.models import User
from django.contrib.auth.models import UserManager
from django.utils.translation import ugettext_lazy as _

class MyUserManager(UserManager):
def create_user(self, username, email, password=None):
"""
Creates and saves a User with the given username, e-mail and password.
"""
print "In MyUserManager"
now = datetime.datetime.now()

# Normalize the address by lowercasing the domain part of the email
# address.
try:
email_name, domain_part = email.strip().split('@', 1)
except ValueError:
pass
else:
email = '@'.join([email_name, domain_part.lower()])

user = self.model(username=username, email=email, is_staff=True,
 is_active=True, is_superuser=False, last_login=now,
 date_joined=now)

if password:
user.set_password(password)
else:
user.set_unusable_password()
user.save(using=self._db)
return user

class MyUser(User):
objects = MyUserManager()


=admin.py
from django.utils.translation import ugettext_lazy as _
from myapp.models import MyUser

class MyUserAdmin(MyUserAdmin):
pass

admin.site.register(MyUser, MyUserAdmin)

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 the template context and then
iterate through with {% for item in myobjects %}.
--
DR.

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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?
> Also, can the view support read,update & delete all within the one
> page? I wouldn't expect it to update both tables at the same time,
> although if the forigen key for the company changed in the contact
> table within this view, i would like to see the company table half of
> the view refresh to the changed company.
>
> If anyone would be so kind to show me the particular django
> documentation page that explores the above or if i could have a very
> basic example, it would be most appreciated.
>
> Kind regards,
>
> Alan

The question doesn't really make sense. Django isn't a table-based
relational db manager, like Access is. It's a tool for creating full-
featured web applications. As such a page can do whatever you want to
program it to do: display as many tables as you want, update them,
whatever. But you need to write the code to do that. There isn't any
documentation about that particular thing, because that's only one use
case out of an infinite number of possible uses.
--
DR.

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 you manually adding the field to your po file?
>
> Are you running "django-admin.py compilemessages" to create the
> relevant django.mo file after the event?

Yes, i've tried it with the existing django.po file. And my other try
was to create an additional file called database.po

makemessages  removes my manualy added entries from django.po

compilemessages creates mo files from my database.po and django.mo
file, but django seems to ignore translations from any other files
than django.mo?

> Are there other strings in the same template that _are_ being translated?

Yes, as i wrote im using an already existing django.po file of my app.

> Which version of django are you using?

1.2

> Which language are you translating too?

de, en

> cheers

Have a nice day and thank you very much for help,
Börni

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 solution!!
>
> On Jul 8, 2:02 pm, Daniel Roseman  wrote:
>> On Jul 8, 6:28 pm, Rodion Raskolnikiv  wrote:
>>
>>
>>
>>
>>
>> > Good morning!
>> > I have been wanting to design a model (to be administered via the
>> > admin area) which would allow for file uploads. I have not been able
>> > to grasp a singular, simple approach to this. Perhaps things are
>> > complicated by Django's preference for serving media files under a
>> > different domain, but this is pretty crucial to my project and I was
>> > hoping that someone could point me in the right direction.
>>
>> > This post seems most 
>> > helpful:http://groups.google.com/group/django-users/msg/02cf3d1a838e7e46
>>
>> > but I don't want to blindly copy it and end up with a batch system! I
>> > am just looking to make a simple file uploader.
>>
>> > The model might look like this:
>>
>> > class UploadedFile(models.Model):
>> >     title = models.CharField(max_length=250)
>> >     file = forms.FileField() # I don't know if this is how to define
>> > it
>> >     file_type = models.CharField(max_length=25)
>> >     date_created = models.DateTimeField()
>>
>> > I am a huge fan of Python and Django, and I am often surprised by how
>> > simple and elegant the solutions are, my problem is usually that I am
>> > trying to do things the difficult way...
>>
>> > Any assistance would be greatly appreciated!
>>
>> The documentation for file uploads is indeed complicated, but in order
>> to enable file uploads in the admin you don't need to worry about any
>> of that.
>>
>> However you seem to be trying to declare a form field within a model.
>> You should of course use the models.FileField, which is fully
>> documented 
>> here:http://docs.djangoproject.com/en/1.2/ref/models/fields/#filefield
>> Note that the only thing you *need* to do is to set a value for
>> upload_to.
>> --
>> DR.

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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).changelist_view(...)

On Jul 9, 6:16 am, rahul jain  wrote:
> anyone on this ?

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 the
> > new instance.  The only thing i can think of is to create the new
> > folder mid transaction.  I guess another way to do it would be to save
> > a new instance with a temp file or set it to null=True, then create
> > the folder, but that seems bad to me.
>
> there is a save(commit=False) which should do the trick.
> --
> Regards
> Kenneth Gonsalves
> Senior Associate
> NRC-FOSS at AU-KBC

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 html
> file. Where am I going wrong?


are you trying to do the request from Django? to the same server? on
the development server?

the development server is single-request.  it won't answer to a new
request until the current one has been completed.  if you need to do a
request to yourself, use a real server.

of course, if you're requesting to yourself, you shouldn't have to go
through HTTP, it would far better to directly access the underlying
resources.



> Thirdly, how do I implement conditions in my client to invoke a
> certain method of a resource, i.e. before invoking POST on a 'payment'
> resource, I want to perform a GET on 'booking' and 'room' resource,
> only if I get response code of 200 (i.e. booking and room resource is
> created), I should be able to invoke POST on 'payment' resource else
> it should set a flag to false.

HATEOAS: http://blogs.sun.com/craigmcc/entry/why_hateoas

in short, the server shouldn't bother with policy.  you should strive
to create your resources so that everything that's allowable is
acceptable.

in your example: when you POST a new 'payment', you have to refer to
the 'booking' and 'room' resources involved.  these references should
be URLs in the POST data.  remember that REST is not CRUD, you have to
do fairly extensive validations and sanitizations on POSTed data
before accepting it.  so, the 'payment' resource should verify that
the 'booking' and 'room' URLs referenced by the client actually exist
and are in the correct state (i.e. the room isn't paid yet).

if anything is wrong with the data, don't write anything and respond
with a client error, like 400, 406, 409, 412 or similar (check
http://en.wikipedia.org/wiki/List_of_HTTP_status_codes). only answer
with a 200 (or better, with a 302 to the new resource) if everything
was correctly verified and created.

that way, you don't care if the client has just GET the related
resources, or if that was a week ago, or if the user copied from a
napkin. if the reference is valid, accept it; if it's not, don't.



-- 
Javier

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 general. Hoping to get a reply from here:)

I am trying to implement a small
example of a RESTful web service i.e a hotel booking service. I have
implemented my resources successfully with read, update and delete
methods according to my specifications. I can invoke them successfully
using 'curl' and get the desired status codes. The problem now I am
stuck in implementing full behavior of my service that invokes a
particular resource after performing a certain method on a resource.
For example, after invoking successfully a POST method on 'booking'
resource, I want to invoke a POST on 'payment' resource.

My main problem is :
- where do I implement all the specifications for my RESTful web
service that invokes methods on these resources in a specific sequence
as desired. Is it in the 'view.py' file that I create in the 'api'
folder? Can someone give me any example on how to write web service
clients in django / django-piston? I googled but found no good result.

- Secondly, my main problem is how do I invoke these methods with in
my code? I have tried urllib/ urllib2. When I invoke a remote address
like 'http://www.example.com', it returns the html file but when I
invoke local host, i.e. http://127.0.0.1:8000/api/hb/bookings/21/ ,
curl does not respond when I invoke that handler from curl on command
prompt. My code is like this:

class RoomHandler(BaseHandler):
   allowed_methods = ('GET', 'PUT', 'POST', 'DELETE')
   model = room
   fields = ('rType', 'floor')

   def read(self, request, id=0):
.
 if b:
  b = booking.objects.get(id=id)
  response = room.objects.filter(id = b.room_id)
  req = urllib2.Request('http://127.0.0.1:8000/api/hb/
bookings/21/')
  #req = urllib2.Request('http://www.example.com')
  response = urllib2.urlopen(req)
  the_page = response.read()
  type(the_page)
  return the_page

>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 html
file. Where am I going wrong?

Thirdly, how do I implement conditions in my client to invoke a
certain method of a resource, i.e. before invoking POST on a 'payment'
resource, I want to perform a GET on 'booking' and 'room' resource,
only if I get response code of 200 (i.e. booking and room resource is
created), I should be able to invoke POST on 'payment' resource else
it should set a flag to false.  I will be implementing an algorithm,
but I was thinking can we put conditions on invoking methods of
resource like we would do with JML for java interfaces?

I have been stuck with these problems for almost two weeks, googling
and trying different things but I am still stuck. Hoping to hear
something from here.

Thankyou for your time and looking forward,
Irum

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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(TestCase):

def test_report(self):
"""Render and download a sample report"""
bob = User.objects.create_user("bob_the_tester",
"b...@example.com", "b0...@$$")

client = Client()
login = client.login(username="bob_the_tester",
password="b0...@$$")
self.assertTrue(login)  # passes, so login is good

response = client.get('/')   # adding this line causes the
failures below

and here are the failed tests:

==
FAIL: Doctest: django.contrib.auth.tests.__test__.FORM_TESTS
--
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/
django/test/_doctest.py", line 2180, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for
django.contrib.auth.tests.__test__.FORM_TESTS
  File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/
django/contrib/auth/tests/__init__.py", line unknown line number, in
FORM_TESTS

--
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/
django/contrib/auth/tests/__init__.py", line ?, in
django.contrib.auth.tests.__test__.FORM_TESTS
Failed example:
form.save()
Expected:

Got:



--

Any ideas on what is causing this? Disabling custom auth backends
doesn't fix the problem? I am aware of 
http://code.djangoproject.com/ticket/13394
but that is not what is causing this error.

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 key questions (the ones that typically are not
> answered on this mailing list), provide suggestions, code reviews and
> so on.  (I assume that such support would be paid for, of course.)
>
> Thanks
> Derek
>
> --
> 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...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 list), provide suggestions, code reviews and
so on.  (I assume that such support would be paid for, of course.)

Thanks
Derek

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 within the one
page? I wouldn't expect it to update both tables at the same time,
although if the forigen key for the company changed in the contact
table within this view, i would like to see the company table half of
the view refresh to the changed company.

If anyone would be so kind to show me the particular django
documentation page that explores the above or if i could have a very
basic example, it would be most appreciated.


Kind regards,

Alan

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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. It's very confusing! How do
> > they tie together? I probably need to do the tutorial again. It seems
> > to me getting info from the user should be strait foreword but its not
> > as displayed by the rather lengthy tutorial. But than I'm new to
> > this...
>
> Hi, I am a Django beginner too. If you don't have experiences with MVC  
> programming pattern, it could be a lot harder, but as soon as you  
> understand it, you will not see many things so complicated. Django is a  
> framework which helps you to save time by not inventing a wheel again and  
> again, you don't need to know how Django's blackboxes works, you only need  
> to know how to use them to work for you. Forms are perfect example - you  
> specify what fields a form should have, what data should every field  
> contain and the boring part - displaying, validating and redisplaying you  
> can let to Django. If there is something you need to do differently as  
> default behaviour is, you can override it. Django is a little harder to  
> learn as I expected, but my advice is not to give up and try to read  
> documentation again and again until every part begins to fit together.
>
> What I am missing on Django, are high quality or complex tutorials.

More complex or more detailed?  (I would argue that The Django Book is
about as high quality as you are ever going to get for a free
tutorial)

Try: http://www.hoboes.com/NetLife/pytown/django-beyond-sql/

or: http://opensourcebridge.org/2009/wiki/Django%3A_Thinking_Outside_The_Blog

or: http://www.slideshare.net/jacobian/django-in-the-real-world-175

The real issue is that, because Django is a framework, designed to
meet N number of possible needs, once you get "beyond the basics", the
specifics start to diverge more and more from what _you_ actually need
to do.

My 2c
Derek

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 Don't mix *args and **kwargs
in call to reverse()! error). From what I've found in the docs :

def my_view(request):
...
return redirect('some-view-name', foo='bar')

It looks like I need to provide 'some-view-name' argument, but is it
just the name of the view function, or the name of the url ? So I
would like to make it similar to the way it's done in django-
registration, where :

to, args, kwargs = backend.post_registration_redirect(request,
new_user)
return redirect(to, *args, **kwargs)

def post_registration_redirect(self, request, user):
return ('registration_complete', (), {})

Ok so now, can I call directly my view function or do I need to
provide a url for it ? And what more important, how my function
declaration (and a url if needed) should look like ? Both backend, and
cleaned_data are just passed through this view for a later usage. I've
tried this, but it's improper :

url(r'^link/$', some-view-name)
def some-view-name(request, *args):
As well as this :

return redirect('some_url', backend=backend, dataform.cleaned_data)
url(r'^link/$', some-view-name)
def some-view-name(request, backend, data):

still NoReverseMatch . But in django-registration, I've seen something
like this :

url(r'^register/$',register,{'backend':
'registration.backends.default.DefaultBackend'},
name='registration_register'),

def register(request, backend, success_url=None, form_class=None,
 disallowed_url='registration_disallowed',
 template_name='user/login_logout_register/
registration_form.html',
 extra_context=None):

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 pollsdjango within your script, you might have mistakenly join
> some text together.
>
> David
>
> On Jul 6, 4:56 pm, Bradley Hintze  wrote:> Hi 
> all,
>
> > I am following the tutorial part 2
> > (http://docs.djangoproject.com/en/dev/intro/tutorial02/#intro-tutorial02)
> > and I am stuck. I uncommented the 'django.contrib.admin' as directed
> > and ran 'python manage.py syncdb' and got the following error:
>
> > Error: No module named pollsdjango.contrib.admin
>
> > Any ideas?
>
> > --
> > Bradley J. Hintze

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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' package rather than my local copy, which
as you noted contained the patch.

Good advice of course about using volatile and testing packages in a
production environment
as this of course proves.

For what it's worth, I have (er - had) been using the ticket 6148
patch since January and found it
to work without incident in pulling and delivering data from multiple
schemas.

Thanks again,
-
Steve


On Jul 4, 3:22 pm, Ramiro Morales  wrote:
>
> The meta.db_schema hast never been supported by Django.  The version
> you were using most surely was one locally patched to add it. When the
> system was updated, you got a pristine Django 1.2.1 via the python django
> .deb package and that would explain what you are seeing.
>
> You can try to use the latest patch attached to ticket 6148 so you can
> help us with to test and enhance it.
>
> Warning: The patch, as every patch not merged in the official tree
> shouldn't be used  on a production system, but the OS version and
> sysadmin practices you describe seems to indicate this isn't the case.
>
> Regards,
>
> --
> Ramiro Morales  |  http://rmorales.net

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 as well.

And actually, I just found a way to pass an argument that I need to
filter.

So, where we're rendering,

{{ document.content|default_if_none:""|cmstags:document.id|textile|
safe }}

I just add ":document.id" to pass an argument in, and that's it. I
could also pass the whole context, but the ID is what I needed,
really.

Thanks!

On Jul 9, 2:15 pm, Venkatraman S  wrote:
> 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(request)  )
>
> And in the template tag use something similar to:
> @register.inclusion_tag('news.html', takes_context = True)
> def show_news_sidebar(context):
>   request = context['request']
>   news = getNewsrequest)
>   return {'news': news}
>
> Was that your problem or did i just misunderstood you?
>
> -V-http://twitter.com/venkasub

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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':'error', 'message': }
>
> It uses the traceback module to output the full traceback. Obviously
> you need to have a handler that receives this data and displays in on
> the page (although you can inspect it in firebug).
>
> If you'd like the code for it, I can ask my company whether they'd be
> happy with me publishing it.
>
> Cheers, Euan
>
> On Jul 7, 10:35 pm, Jonathan Hayward
>
>
>
>  wrote:
> > I'm working on a view made to output JSON for Ajax use. My log has:
>
> > [07/Jul/2010 17:47:13] "POST /ajax/login HTTP/1.1" 500 50678
>
> > That looks like Django gave a helpful and detailed stacktrace page, albeit
> > to jQuery expecting JSON.
>
> > How can I ask Django to log uncaught exceptions to a file or equivalent? The
> > test server has no MTA so I can't really ask it to email me exceptions.
>
> > TIA,
> > --
> > → Jonathan Hayward, christos.jonathan.hayw...@gmail.com
> > → An Orthodox Christian author: theology, literature, et cetera.
> > → My award-winning collection is available for free reading online:
> > ☩ I invite you to visit my main site athttp://JonathansCorner.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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(request)  )

And in the template tag use something similar to:
@register.inclusion_tag('news.html', takes_context = True)
def show_news_sidebar(context):
  request = context['request']
  news = getNewsrequest)
  return {'news': news}

Was that your problem or did i just misunderstood you?

-V-
http://twitter.com/venkasub

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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
another markup (), but we'd like to have access to
the template's context as well (because this id is "local" to
document, which is passed to template via context).

>From what I've found, there is no way to pass arguments to load ({%
load cms_tags context %}) and context is not available otherwise.

Any ideas? Is there perhaps a better to tackle this challenge?

Kind regards,
  Miha.

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 with service, other times is etc...
>
> == #django Cannot join channel (+r) - you need to be identified with
> services,
>
> -NickServ- You failed to identify in time for the nickname david
>
> Also, where do I setup the password for the django channel? I thought it is
> supposed to be the same password i setup in the google group?
>
> Please help.
>
> David
>
> --
> 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...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Syed Ali Saim
Project Manager
Softech Worldwide LLC

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 right place to place news loader?  
TEMPLATE_CONTEXT_PROCESSORS seems to be a good place and easy to  
implement. Another possibility is a middleware, I feel, that it should  
go there instead of TEMPLATE_CONTEXT_PROCESSORS.


2.) If I use middleware, how do I smuggle variables into templates? It  
has something to do with the request object, but I don't know how to use  
it for that thing. What should I do in a middleware to have e.g {{ news  
}} template variable containing last x news?


Thanks for your advices,
Martin



I used template context processors to solve this problem, it is easier to  
implement now, but I will look at custom tags and cache, when I have some  
time :)


But can somebody answer my second question please? I need to know how can  
I transfer variables from middleware into templates.


Thanks,
Martin

--
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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-cache-machine)

-Sævar

On Jul 9, 4:30 am, Venkatraman S  wrote:
> On Fri, Jul 9, 2010 at 3:40 AM, Antoni Aloy  wrote:
> > I would use a custom template tag with cache
>
> I was planning to recommend the same, but i wasnt sure whether this is
> efficient when compared with context-processor solution. I had used template
> tags for a similar requirement for one of my clients.
>
> Is the DB queried repeatedly in cases wherein a template tag is used across
> pages? or is the data/query cached?
>
> -V

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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.CharField(max_length=100, blank=False)
>
> Code -
>
>     om = Othermodel(name="Test")
>     om.save()
>     count = om.reel_set.count()  #this causes the error
>
> Thanks,
>            Alex

Thanks, but the code you give can't generate the error "QuerySet'
object has no attribute 'reel_set'", as om is not a QuerySet object.
Please also post the actual error and traceback.
--
DR.

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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/?from=olddocs#syncdb

So I would try:

python manage.py reset appname
python manage.py syncdb

Just keep in mind that you'll lose your previously stored data.

-Sævar

On Jul 9, 8:10 am, yugori  wrote:
> Hi, I'm beginner of Django&Py.
> Now I try to make Product Management Tool with Django.
> So I wrote some code.
>
> models.py
> //---
> from django import forms
> from django.db import models
>
> # ex('ie8','InternetExplorer8')
> class Browser(models.Model):
>   id=model.CharField('id',primary_key=True)
>   name=model.CharField('name')
>
>   def __unicode__(self):
>     return self.name
>
> # ex('iphone3','iPhoneOS3')
> class Device(models.Model):
>   id=model.CharField('id',primary_key=True)
>   name=model.CharField('name')
>
>   def __unicode__(self):
>     return self.name
>
> # ex('site01','MySite','browser[]','device[]')
> class Product(models.Model):
>   id = models.CharField('id', primary_key=True)
>   name = models.CharField('name')
>   support_browser = models.ManyToManyField(Browser)
>   support_device = models.ManyToManyField(Device)
>
>   def __unicode__(self):
>     return self.name
>
> class ProductForm(forms.ModelForm):
>   class Meta:
>     model = Product
> ---//
>
> 
> view.py
> //---
> def create(request):
>     if request.method == 'POST':
>         form = ProductForm(request.POST)
>         if form.is_valid():
>             form.save()
>             return HttpResponseRedirect('/product/detail/'+form.id
> +'/')
>         else:
>             print form.errors
>             errors = form.errors
>             return render_to_response('Product/create.html',{'errors':
> errors,'form':form})
>
>     else:
>         form = ProductForm()
>
>     return render_to_response('Product/create.html',{'form':form})
> ---//
>
> 
> create.html
> //---
> 
> create
> 
> 
> {{ form.errors }}
> 
>   ID{{form.id}}
> 
> 
>   NAME{{form.name}}
> 
> 
>   Support Browser
>   {{form.support_browser}}
> 
> 
>   Support Device
>   {{form.support_device}}
> 
>   
> 
> 
> 
>
> ---//
> 
>
> 1.Access to /product/create/ - it works good!
> 2.Complete form and submit - it works good!
> 3.Watch table 'product' - it works good? There's no column
> 'support_browser' and 'support_device'.
> 4.Watch intermidieval table 'product_browser'(autogenerated) - it has
> no rows...
>
> What's wrong?
> Please tell me..

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 = Othermodel(name="Test")
om.save()
count = om.reel_set.count()  #this causes the error


Thanks,
   Alex

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 have been created between the two models
> so effectively the set is empty which is a problem - is it?  (this
> seems like an unlikely cause)
>
> - the 'Reel' model was created *after* instances of its foreign key
> had been created - so I am wondering if syncdb doesn't create the _set
> field - this also seems an unlikely cause of the problem as adding
> foreign keys to models with existing instances is likely to happen a
> lot during development
>
> - something to do with INSTALLED_APPS ? I have changed the order to
> ensure that the foreign key model (Reel)  appears before the model it
> has a foreign key to.
>
> - other ideas?
>
> Thanks for any thoughts,
>
>                                             Alex

Although you haven't posted your models, or the actual code causing
the problem, the reference to a QuerySet gives a hint as to the
problem.

Foreign key relationships are of course attributes of individual model
instances, not querysets. So this won't work:

MyObject.objects.filter(whatever=whatever).reel_set.all()# NO

because filter returns a queryset, not an instance. You could do:

MyObject.objects.get(whatever=whatever).reel_set.all()

because get returns a single instance, assuming there is only one that
matches the query parameters (otherwise you will get a
MultipleObjectsReturned exception). Or, you could do:

   MyObject.objects.filter(whatever=whatever)[0].reel_set.all()

where you get an individual object from the qs before accessing its
reel_set relation (although if there are no matches, you will get an
IndexError).
--
DR.

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 effectively the set is empty which is a problem - is it?  (this
seems like an unlikely cause)

- the 'Reel' model was created *after* instances of its foreign key
had been created - so I am wondering if syncdb doesn't create the _set
field - this also seems an unlikely cause of the problem as adding
foreign keys to models with existing instances is likely to happen a
lot during development

- something to do with INSTALLED_APPS ? I have changed the order to
ensure that the foreign key model (Reel)  appears before the model it
has a foreign key to.

- other ideas?

Thanks for any thoughts,

Alex

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 request as get this parameters and also easily parse
> the return results which could be xml or json?
>
>
> thanks,
> James
>

That's not factual, django has built in support for python, and there
are a multitude of python RPC libraries, some of which are included in
python.

Examples include:

SUDS/soaplib for SOAP RPC
xmlrpclib for XML-RPC
rpyc for python specific RPC server/client
celery/RabbitMQ for AMQP style message bus
py-lasso for SAML RPC

etc etc ad infinitum

Tom

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 need to be identified with
> services,
>
> -NickServ- You failed to identify in time for the nickname david
>
> Also, where do I setup the password for the django channel? I thought it is
> supposed to be the same password i setup in the google group?
>
> Please help.
>
> David
>

What is unclear here? Identify yourself to NickServ. If you need help
doing that:

http://lmgtfy.com/?q=freenode+identify+nickserv

Tom

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 identify in time for the nickname david

Also, where do I setup the password for the django channel? I thought it is
supposed to be the same password i setup in the google group?

Please help.

David

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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.")

2010/7/9 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't work,
> Álex González
>
>
> On Fri, Jul 9, 2010 at 01:40, Jacob Fenwick wrote:
>
>> I tried something like this:
>>
>> *models.py
>> class MyUser(User):
>> pass
>>
>> *admin.py
>> class MyUserAdminForm(forms.ModelForm):
>> is_staff = models.BooleanField(_('staff status'),
>> default=True, help_text=_("Test."))
>>
>> class Meta:
>> model = User
>>
>> class MyUserAdmin(UserAdmin):
>> form = PublisherAdminForm
>>
>> admin.site.register(MyUser, MyUserAdmin)
>>
>>
>> Any idea why the help text wouldn't show up in the admin for this?
>>
>> Jacob
>>
>> On Thu, Jul 8, 2010 at 7:08 PM, Jacob Fenwick wrote:
>>
>>> So one method I found is to use the custom validation from a form in the
>>> ModelAdmin:
>>>
>>> http://docs.djangoproject.com/en/1.2/ref/contrib/admin/#adding-custom-validation-to-the-admin
>>>
>>> However, this only seems to work on edits, not on adds.
>>>
>>> How can I make this work on adds?
>>>
>>> Jacob
>>>
>>>
>>> On Thu, Jul 8, 2010 at 6:33 PM, Jacob Fenwick 
>>> wrote:
>>>
 I'm looking for a way to automatically set is_active to true for new
 users that are added through the admin interface.

 I tried to subclass the User class and set the is_active default to true
 but apparently you can't override fields in a parent model:

 http://docs.djangoproject.com/en/1.2/topics/db/models/#field-name-hiding-is-not-permitted

 Is there some sort of ModelAdmin magic that could solve this problem?

 Or is there some other method that can be arrived at through subclassing
 the User object?

 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-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
> and/or .pptx
> http://mirblu.com
>



-- 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx
http://mirblu.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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't work,
Álex González

On Fri, Jul 9, 2010 at 01:40, Jacob Fenwick  wrote:

> I tried something like this:
>
> *models.py
> class MyUser(User):
> pass
>
> *admin.py
> class MyUserAdminForm(forms.ModelForm):
> is_staff = models.BooleanField(_('staff status'),
> default=True, help_text=_("Test."))
>
> class Meta:
> model = User
>
> class MyUserAdmin(UserAdmin):
> form = PublisherAdminForm
>
> admin.site.register(MyUser, MyUserAdmin)
>
>
> Any idea why the help text wouldn't show up in the admin for this?
>
> Jacob
>
> On Thu, Jul 8, 2010 at 7:08 PM, Jacob Fenwick wrote:
>
>> So one method I found is to use the custom validation from a form in the
>> ModelAdmin:
>>
>> http://docs.djangoproject.com/en/1.2/ref/contrib/admin/#adding-custom-validation-to-the-admin
>>
>> However, this only seems to work on edits, not on adds.
>>
>> How can I make this work on adds?
>>
>> Jacob
>>
>>
>> On Thu, Jul 8, 2010 at 6:33 PM, Jacob Fenwick wrote:
>>
>>> I'm looking for a way to automatically set is_active to true for new
>>> users that are added through the admin interface.
>>>
>>> I tried to subclass the User class and set the is_active default to true
>>> but apparently you can't override fields in a parent model:
>>>
>>> http://docs.djangoproject.com/en/1.2/topics/db/models/#field-name-hiding-is-not-permitted
>>>
>>> Is there some sort of ModelAdmin magic that could solve this problem?
>>>
>>> Or is there some other method that can be arrived at through subclassing
>>> the User object?
>>>
>>> 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-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx
http://mirblu.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 running "django-admin.py compilemessages" to create the
relevant django.mo file after the event?

Are there other strings in the same template that _are_ being translated?

Which version of django are you using?

Which language are you translating too?

cheers
L.



>
> I wonder how it's possible to handle such situations?
>
> Thank you very much,
> Börni
>
> --
> 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...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.