Re: SUPPORTS_TRANSACTIONS Error while running tests

2010-10-07 Thread Russell Keith-Magee
On Fri, Oct 8, 2010 at 1:34 PM, girish shabadimath
 wrote:
> Hi all,
> i looked into the setup_databases()  code, here it basically checks for
> MIRROR,,if db is a mirror ,then it simply points to it or else creates test
> db,,,where dis SUPPORTS_TRANSACTIONS check is happening..?
>
> trace-out shows its present in testcases.py,,but how setup_database gets
> there..?,,
>
> im a newbie to django,,so don't mind if it sounds simple ...

In django/db/backends/creation.py. It's part of the database backend
logic that defines how to create the test database.

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: SUPPORTS_TRANSACTIONS Error while running tests

2010-10-07 Thread girish shabadimath
Hi all,
i looked into the *setup_databases()*  code, here it basically checks for
MIRROR,,if db is a mirror ,then it simply points to it or else creates test
db,,,where dis *SUPPORTS_TRANSACTIONS *check is happening..?

trace-out shows its present in testcases.py,,but how *setup_database* gets
there..?,,

im a newbie to django,,so don't mind if it sounds simple ...

On Thu, Oct 7, 2010 at 12:41 PM, girish shabadimath <
girishmss.1...@gmail.com> wrote:

> Hi Russ,
>
> Thanks for the reply
>
>
> On Thu, Oct 7, 2010 at 11:09 AM, Russell Keith-Magee <
> russ...@keith-magee.com> wrote:
>
>> On Thu, Oct 7, 2010 at 1:32 PM, girish shabadimath
>>  wrote:
>> > Hi all,
>> >
>> > im using django 1.2
>> >
>> > i dont want django to create test_db for testing, instead should use the
>> > main database
>> >
>> > i have override  run_tests method to do unit tests,,,
>> > here is the run_tests code:
>> >
>> > class Custom_TestSuiteRunner(DjangoTestSuiteRunner):
>> >
>> >def run_tests(self, test_labels, extra_tests=None, **kwargs):
>> >
>> >   self.setup_test_environment()
>> >   suite = self.build_suite(test_labels, extra_tests)
>> >   #old_config = self.setup_databases() commented to use main
>> > database
>>
>> Before you start randomly commenting out code, you might want to check
>> out what the code actually does.
>>
>> Part of the process of creating a test database is to verifies the
>> capabilities of the database -- most notably, whether the database
>> supports transactions, which has a profound effect on the operation of
>> subsequent test cases.
>>
>> If you don't want to use a separate test database, then you'll need to
>> replicate the feature validation logic. If you don't, you'll get
>> exactly the error you describe.
>>
>> Yours,
>> Russ Magee %-)
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-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.
>>
>>
>
>
> --
> Girish M S
>



-- 
Girish M S

-- 
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: Generate a daily serial/batch/lot number

2010-10-07 Thread Darryl Ross

On 06/09/10 19:09, kmpm wrote:

Regarding UUIDs, one of the business requirements (which I don't
control) is that the identifier that is to be used on barcodes and
what not is to be in the format "YYMMDD" where  is the number
we are talking about. So UUID would be great and unique, as well would
the automatic pk/id from the model itself as that is unique enough.
But I need a rolling number per day and nothing else.


I can't see if you mentioned which database you are using, but if you 
are using Postgres, why can't you just use the default PK field and run 
a cronjob to excecute a postgres SETVAL at midnight?


#!/bin/sh
DATECODE=$( date +%Y%m%d )
echo "SET SETVAL('table_id_seq', '${DATECODE}');" | psql 


Regards
Darryl

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



Exclude Inherited Fields in Admin

2010-10-07 Thread nkatt
Hi there,

I have a UserExtended model that extends the User model.  I am trying
to upgrade from 1.1.1 to 1.2.3, and I no longer seem to be able to
specify inherited fields to be excluded in the admin forms - it was
working fine in 1.1.1.

For example, I had the "is_staff" field in the admin exclude list for
UserExtended, but 1.2.3 gives me the error:
"'UserExtendedAdmin.exclude' refers to field 'is_staff' that is
missing from the form."

Is there a syntax change I am missing?

exclude = ['is_staff','is_superuser']

Thanks!

nkatt

-- 
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: Manually sorting items in a table - Doubly-Linked List vs sort_index

2010-10-07 Thread esatterwh...@wi.rr.com
I'm assuming you are talking about the client facing site with html/
css/javascript. If that is the case,

A DOM tree is already a doubly linked list.

Elements are aware of their parent, their siblings and their children,
who are again aware of their parents, children and siblings.

All you should have to do is place the id as an attribute on the
corresponding element and use the DOM api to do the rest. Most
javascript libraries make doing that fairly easy to do now a days. no
sense trying to re-invent the wheel on this one.

you can use ajax to do an update after the user has made a change in
the UI, or make the click a save button to commit changes.

On Oct 6, 10:57 pm, Steven Sacks  wrote:
> I've got items in a list that a user can arbitrarily move around in
> whatever order they want.  Additionally, they can add a group of items
> to a list in a specific position within that list.
>
> Further, they can sort multiple items at once, meaning they can select
> one to many, sequential or non-sequential, and move them as a group to
> a new position in the list.
>
> The items will always be moved in order from top to bottom, so if you
> select multiple items, whether they're sequential or non, they will be
> flattened together into a group sequentially from the top to bottom.
>
> For example:
> [1, 2, 3, 4, 5]
>
> If I select 1, 4, and 5 and move them to where id 1 in the list is, it
> will look like this:
>
> [1, 4, 5, 2, 3]
>
> I need to refer to items not by their indices, but by their ids.  So,
> it's possible that a list might look like this (id-wise)
>
> [27, 31, 45, 7, 21]
>
> When I want to move items, I pass a before_id to determine which item
> they should move before. If I pass 0 for before_id, they are moved to
> the end of the list.
>
> I've got two possible choices here:
>
> 1) Doubly-linked list
>
> Each item in the list has a next_id and prev_id, which are foreign
> keys to the Model that those objects are. When I move items in the
> list, I calculate and modify the affected rows next/prev id fields.
>
> 2) sort_index
>
> A more brute force method is to have each item in the list have a
> sort_index, and when I add/move items to the list, I determine where
> they're supposed to go and calculate the sort_index for every row in
> the table. This actually isn't as easy as it seems because you can't
> Array.insert on a QuerySet.  I'm leaning towards a doubly-linked list.
>
> Does anyone have any advice or other, more efficient ways of
> accomplishing this?
>
> Thanks!

-- 
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: unique_together to bind three fields

2010-10-07 Thread meenakshi
Thanks for the great suggestions.  In order to display the poll scores
I would add the query in the results page template right?  I apologiz
for these newbie questions

Meenakshi

On Oct 7, 2:39 am, Tom Evans  wrote:
> On Thu, Oct 7, 2010 at 4:54 AM, meenakshi  wrote:
> > Hi,
> >   I am new to Django and Python and have been working through the
> > tutorial.  I would like to modify the polls app in the tutorial such
> > that I can track individual users who vote in a poll, keep a record of
> > their choice, and not allow any user to vote more than once in any
> > given poll.
> >   Briefly, there are many polls, each poll being linked to several
> > choices.  Each user can vote in many polls, but is allowed to vote
> > only once in each individual poll.  Whats the best way to enforce
> > this?
> > I tried to enforce this by using the unique_together feature to bind a
> > specific user, poll, choice combination together (within the Choice
> > class). It didnt work.  Here is the code I tried:
>
> > from django.db import models
> > import datetime
>
> > class User(models.Model):
> >    name = models.CharField(max_length=100)
> >    email = models.EmailField()
> >    def __unicode__(self):
> >        return self.name
>
> > class Poll(models.Model):
> >    question = models.CharField(max_length=200)
> >    pub_date = models.DateTimeField('date published')
> >    def __unicode__(self):
> >        return self.question
>
> > class Choice(models.Model):
> >    poll = models.ForeignKey(Poll)
> >    user = models.ManyToManyField(User)
> >    choice = models.CharField(max_length=200)
> >    votes = models.IntegerField()
>
> >    def __unicode__(self):
> >        return self.choice
>
> >    class Meta:
> >        unique_together = ("poll", "user", "choice")
>
> > My error message:
> > Error: One or more models did not validate:
> > polls.choice: "unique_together" refers to user. ManyToManyFields are
> > not supported in unique_together.
> > polls.choice: "unique_together" refers to user. This is not in the
> > same model as the unique_together statement.
>
> > I would appreciate any suggestions/corrections,
>
> > Thanks,
> > Meenakshi
>
> Make your model heirarchy such that adding a vote is modelled by the
> creation of a single row in a single table, and the creation of that
> row is constrained by the DB to respect your conditions (1 vote per
> user per poll):
>
> class User(models.Model):
>   pass
>
> class Poll(models.Model):
>   pass
>
> class Choice(models.Model):
>   poll = models.ForeignKey(Poll)
>
> class UserPollChoice(models.Model):
>   poll = models.ForeignKey(Poll)
>   user = models.ForeignKey(User)
>   choice = models.ForeignKey(Choice)
>
>   class Meta:
>     unique_together = ( 'poll', 'user', )
>
> You will have to use aggregates to get the scores of the poll out with
> this scenario though. Something like this would work:
>   from django.db.models import Count
>   poll.choice_set.annotate(num_votes=Count('userpollchoice'))
>
> Cheers
>
> 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.



I can't select day with calendar widget

2010-10-07 Thread renevie...@gmail.com
Hello.

I've a problem with the calendar widget.

I created a sandbox project with just one entity and one date attribute
then I registered in the admin

nothing else

the problem happens when I select 2010-10-10  in the widget , then
2010-10-09 is set in the field.
I don't know if this happens with others dates.

what happen?

my setting.py doesn't have any significant changes

thanks

-- 
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: An app to create sprite bundles (django-imaginator)

2010-10-07 Thread Brandon Taylor
Hello,

>From my experience with sprites, you wouldn't be using an image tag to
render the sprite. Rather, you would be giving an id or class
attribute on a div or some other type of HTML container tag that
positions the background image (sprite) and possibly sets a width and
height on the container to prevent overflow.

>From an organizational standpoint, knowing which images are in a
sprite would be nice, but from my perspective, this might get to be a
maintenance nightmare. Sometimes you need extra space between sprites
or you might want to do selective optimization on the image, etc.
Plus, you might end up with inline-css to position the background
image within each element, which would make it impossible to override
from a css file.

All that being said, probably not worth the effort from my experience
as a presentation layer architect on big and small projects.

Kindest regards,
Brandon

On Oct 3, 3:48 pm, Cesar Canassa  wrote:
> Hello everyone,
>
> I had this idea for an django application that creates image sprites
> automatically for you. I want an application that allows me to create and
> manage sprites by only using the admin interface. This is how it should
> work:
>
> - Add 'django-imaginator' to your INSTALLED_APPS
> - Run syncdb, the app creates two new models - Sprites and Images
> - Open the Admin interface and add a new Sprite, it has a mandatory slug
> field in it.
> - Create new Images, they have a ImageField, an slug and a
> ForeignKey pointing to which Sprite they belong.
>
> Now you run a custom manage.py command that uses PIL to compile all images
> into sprites. It also generate any required CSS.
>
> Now, in your templates you will display the images by using a custom
> template tag, something like this
>
> {% sprite 'sprite_slug' 'image_slug' %}
>
> which will be rendered as an HTML  tag.
>
> That's basically how it should work, but I wanted your opinion before I
> start to write any code. Do you think that this app is a good idea or
> it's doomed to failure? Are there other apps that already do this? I also a
> bit worried on version control, since the image will be stored in the
> database I don't I will be able to keep a version control of the sprites and
> rollback changes if required.
>
> Any opinions?
>
> Thanks,
> Cesar Canassa

-- 
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: Iterating tree-like data structures with django

2010-10-07 Thread Sam Walters
Also for all your tree related needs there is Django Treebeard:

https://tabo.pe/projects/django-treebeard/



On Thu, Oct 7, 2010 at 2:51 AM, Cesar Canassa  wrote:
> I had the same issue a few months ago.
> My only answer to you is that is not worth to develop this all for self.
> There is a great django library called django-mptt that does all the heavy
> lifting for you. It's very fast, has many helper functions and even admin
> integration! I suggest that you check it out.
> Regards,
> Cesar Canassa
>
> 2010/10/6 Paweł Roman 
>>
>> Yuck, in_bulk() is useless! I thought it would return a nice
>> dictionary just as expected, but instead it makes me deliver a list of
>> keys first. Why?
>>
>> Eventually I wrote something more usable:
>>
>>    mydict = {}
>>    for model in MyModel.objects.all().iterator():
>>        mydict[model.id]=model
>>
>> Correct me if I'm wrong but this is hundred times more useful than
>> current in_bulk() implementation.
>>
>>
>> On Oct 6, 5:31 pm, Paweł Roman  wrote:
>> > OK, I've got it. It's in_bulk() :) Nevermind the question.
>> >
>> > On Oct 6, 5:27 pm, Paweł Roman  wrote:
>> >
>> > > I have a model which has a tree-like structure (not exactly a FK on
>> > > self but we can assume that's the case).
>> >
>> > > I want to visualise this tree using all records from the db. It seems
>> > > impossible to do with QuerySet, if I have say 100 records (100 nodes
>> > > in the tree) and I try building the tree recursively django will
>> > > execute a SELECT for each node so it will hit the db 100 times to
>> > > build the tree.
>> >
>> > > I thought I could pull the data in one query using objects.all() and
>> > > then build the whole tree by iterating objects in memory. But again,
>> > > the structures returned by QuerySet are not the best for this purpose.
>> > > I can get either list of dictionaries or list of tuples. No
>> > > dictionary! So, to get a list of child nodes for each node I'd have to
>> > > iterate thru the whole collection which is not efficient at all. I
>> > > can't find a way to immediately lookup already fetched records by id!
>> >
>> > > Am I missing something? Iterating tree-like data structures seems
>> > > something quite common problem and someone must have done it already
>> > > with django.
>>
>> --
>> 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.
>

-- 
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: OS Error, Permission Denined

2010-10-07 Thread Rizwan Mansuri
Hi Shawn,

I've pasted my model code. That doesn't sort out my issue.

from django.db import models
from django.contrib import admin
import datetime
import os 

PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))

class Portfolio(models.Model):
title = models.CharField('Title', max_length=200)
url = models.URLField('website URL')
description = models.TextField('Desc', max_length=500, null=True)
technology_used = models.CharField('Technology Used',max_length=200)
url_image = models.ImageField('Portfolio Image',upload_to =
'media/images/portfolio/')  
display = models.BooleanField('Display on Frontpage')
created = models.DateField(auto_now= True)

class Meta:
ordering = ['created']

class Admin:
pass

def __unicode__(self):
return self.title

admin.site.register(Portfolio)  

-Original Message-
From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com]
On Behalf Of ShawnMilo
Sent: 07 October 2010 21:16
To: Django users
Subject: Re: OS Error, Permission Denined

The problem here is most likely due to the forward-slash in front of
your path name. Django's trying to actually write to a non-existant
folder at a level you don't have access to in any case on shared
hosting. Try taking it out and see if that fixes it.

Shawn

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



Re: Django admin in app installed in directory below root.

2010-10-07 Thread Joe Murphy

On Oct 6, 1:15 pm, Daniel Roseman  wrote:
>
> Are you using mod_wsgi? If so, there must be something wrong with your
> configuration. Can you post your .wsgi file?
> --
> DR.

Hi DR -- thanks for the reply, and the pointer. Yup, I'm using
mod_wsgi, and I'll dig in that direction rather than take up space
here.

-Joe

-- 
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 Registration password reset problem

2010-10-07 Thread Felipe Prenholato
So you need to make your reverse calls use this views, if is really needed.

If only template names are changed, have no sense to add custom views, just
use same names in right place.

and about this right place...when I used:

accounts/templates/registration/

some templates for password get templates from admin, so I moved it to

templates/registration/

2010/10/7 Joel Klabo 

> Yeah. I don't understand that either. Except that auth_views.py uses
> different templates I think…
>
> Sent from my iPhone
>
> On Oct 7, 2010, at 1:50 PM, Felipe Prenholato 
> wrote:
>
> But about views that you have at auth_views.py, are same of django auth
> views?
> this registration/auth_views.py exists for something, not?
>
> 2010/10/7 Joel Klabo < joelkl...@gmail.com>
>
>> Awesome, that fixed it. All I had to do was change "from registration
>> import auth_views" to "from django.contrib.auth import views as auth_views"
>>
>> Thank you so much
>>
>>
>> On Thu, Oct 7, 2010 at 12:56 PM, Ted < 
>> ted.tie...@gmail.com> wrote:
>>
>>> I think your problem is in auth_urls.py
>>>
>>> 28 - from registration import auth_views
>>>
>>> in my version of registration this is:
>>> from django.contrib.auth import views as auth_views
>>>
>>>
>>> Then you can understand why you get this error:
>>> NoReverseMatch: Reverse for
>>> 'django.contrib.auth.views.password_reset_complete' with arguments
>>> '()' and keyword arguments '{}' not found.
>>>
>>> Because, you aren't mapping a URL to
>>> django.contrib.auth.views.password_reset_complete.  You are mapping a
>>> URL to registration.auth_views.password_reset_complete.  Django
>>> doesn't know that registration.auth_views.password_reset_complete is
>>> where you handle django.contrib.auth.views.password_reset_complete.
>>>
>>> You have two ways out of this:
>>>
>>> 1) don't use your local copy of auth_views, switch back to the
>>> imported version.
>>>
>>> 2) In auth_views.py update:
>>> 110 - post_reset_redirect =
>>> reverse('django.contrib.auth.views.password_reset_done')
>>> 144 -  post_reset_redirect =
>>> reverse('django.contrib.auth.views.password_reset_complete')
>>> 177 - post_change_redirect =
>>> reverse('django.contrib.auth.views.password_change_done')
>>>
>>> to
>>> 110 - post_reset_redirect =
>>> reverse('registration.auth_views.password_reset_done')
>>> 144 -  post_reset_redirect =
>>> reverse('registration.auth_views.password_reset_complete')
>>> 177 - post_change_redirect =
>>> reverse('registration.auth_views.password_change_done')
>>>
>>> It also bears mentioning that name spacing registration can cause a
>>> similar set of errors.
>>>
>>> Let me know if that worked,
>>> Ted
>>>
>>> On Oct 7, 10:59 am, Joel Klabo  wrote:
>>> > I am just using it as is. I haven't modified any of the code from
>>> > django-registration. I'm confused as to how these are connected. Thanks
>>> for
>>> > looking.
>>> >
>>> > On Thu, Oct 7, 2010 at 10:20 AM, Felipe Prenholato <
>>> philipe...@gmail.com>wrote:
>>> >
>>> >
>>> >
>>> > > This auth_views.py doesn't exist in trunk (that is this version),
>>> sounds
>>> > > like you writing custom admin views? Or you just copied
>>> admin/views.py
>>> > > locally?
>>> >
>>> > > You already tried to resolve via name of url?
>>> > > Else, if you writing custom admin views, isn't right to reference
>>> this
>>> > > custom views?
>>> >
>>> > > (anyway, tonight I'll check the code)
>>> >
>>> > > 2010/10/7 Joel Klabo 
>>> >
>>> > >> Also, all my code is on Github if you would like to see something
>>> else:
>>> > >> 
>>> http://github.com/joelklabo/brooski
>>> >
>>> > >> I really appreciate your help, thank you.
>>> >
>>> > >> On Thu, Oct 7, 2010 at 9:43 AM, Joel Klabo 
>>> wrote:
>>> >
>>> > >>> My version is: VERSION = (0, 8, 0, 'alpha', 1)
>>> >
>>> > >>> Yeah, I have that include in my version as well...
>>> >
>>> > >>> It sends and email with this link:
>>> > >>>
>>> http://brooski.net/accounts/password/reset/confirm/1-2r2-ce8f57c2669d...
>>> >
>>> > >>> <
>>> http://brooski.net/accounts/password/reset/confirm/1-2r2-ce8f57c2669d
>>> ...>and
>>> > >>> then when I click the link I get this error:
>>> http://dpaste.org/vrLp/
>>> >
>>> > >>> On Thu, Oct 7, 2010 at 5:48 AM, Felipe Prenholato <
>>> philipe...@gmail.com>wrote:
>>> >
>>> >  Actually auth urls is 'appended' to urls in default backend (and
>>> should
>>> >  be added to your own backend if you create one).
>>> >
>>> >  Take a look at this line: http://1l.to/bf1/...
>>> so you don't need to
>>> >  add it (again) to your urls.
>>> >
>>> >  I don't have this error with password_reset_complete view , but
>>> I'm
>>> >  using my clone of original repo with some useful patches
>>> (additions). What
>>> >  is version that you are using?
>>> >
>>> >  20

Re: Django Registration password reset problem

2010-10-07 Thread Joel Klabo
Yeah. I don't understand that either. Except that auth_views.py uses
different templates I think…

Sent from my iPhone

On Oct 7, 2010, at 1:50 PM, Felipe Prenholato  wrote:

But about views that you have at auth_views.py, are same of django auth
views?
this registration/auth_views.py exists for something, not?

2010/10/7 Joel Klabo 

> Awesome, that fixed it. All I had to do was change "from registration
> import auth_views" to "from django.contrib.auth import views as auth_views"
>
> Thank you so much
>
>
> On Thu, Oct 7, 2010 at 12:56 PM, Ted  wrote:
>
>> I think your problem is in auth_urls.py
>>
>> 28 - from registration import auth_views
>>
>> in my version of registration this is:
>> from django.contrib.auth import views as auth_views
>>
>>
>> Then you can understand why you get this error:
>> NoReverseMatch: Reverse for
>> 'django.contrib.auth.views.password_reset_complete' with arguments
>> '()' and keyword arguments '{}' not found.
>>
>> Because, you aren't mapping a URL to
>> django.contrib.auth.views.password_reset_complete.  You are mapping a
>> URL to registration.auth_views.password_reset_complete.  Django
>> doesn't know that registration.auth_views.password_reset_complete is
>> where you handle django.contrib.auth.views.password_reset_complete.
>>
>> You have two ways out of this:
>>
>> 1) don't use your local copy of auth_views, switch back to the
>> imported version.
>>
>> 2) In auth_views.py update:
>> 110 - post_reset_redirect =
>> reverse('django.contrib.auth.views.password_reset_done')
>> 144 -  post_reset_redirect =
>> reverse('django.contrib.auth.views.password_reset_complete')
>> 177 - post_change_redirect =
>> reverse('django.contrib.auth.views.password_change_done')
>>
>> to
>> 110 - post_reset_redirect =
>> reverse('registration.auth_views.password_reset_done')
>> 144 -  post_reset_redirect =
>> reverse('registration.auth_views.password_reset_complete')
>> 177 - post_change_redirect =
>> reverse('registration.auth_views.password_change_done')
>>
>> It also bears mentioning that name spacing registration can cause a
>> similar set of errors.
>>
>> Let me know if that worked,
>> Ted
>>
>> On Oct 7, 10:59 am, Joel Klabo  wrote:
>> > I am just using it as is. I haven't modified any of the code from
>> > django-registration. I'm confused as to how these are connected. Thanks
>> for
>> > looking.
>> >
>> > On Thu, Oct 7, 2010 at 10:20 AM, Felipe Prenholato <
>> philipe...@gmail.com>wrote:
>> >
>> >
>> >
>> > > This auth_views.py doesn't exist in trunk (that is this version),
>> sounds
>> > > like you writing custom admin views? Or you just copied admin/views.py
>> > > locally?
>> >
>> > > You already tried to resolve via name of url?
>> > > Else, if you writing custom admin views, isn't right to reference this
>> > > custom views?
>> >
>> > > (anyway, tonight I'll check the code)
>> >
>> > > 2010/10/7 Joel Klabo 
>> >
>> > >> Also, all my code is on Github if you would like to see something
>> else:
>> > >>http://github.com/joelklabo/brooski
>> >
>> > >> I really appreciate your help, thank you.
>> >
>> > >> On Thu, Oct 7, 2010 at 9:43 AM, Joel Klabo 
>> wrote:
>> >
>> > >>> My version is: VERSION = (0, 8, 0, 'alpha', 1)
>> >
>> > >>> Yeah, I have that include in my version as well...
>> >
>> > >>> It sends and email with this link:
>> > >>>
>> http://brooski.net/accounts/password/reset/confirm/1-2r2-ce8f57c2669d...
>> >
>> > >>> <
>> http://brooski.net/accounts/password/reset/confirm/1-2r2-ce8f57c2669d..
>> .>and
>> > >>> then when I click the link I get this error:http://dpaste.org/vrLp/
>> >
>> > >>> On Thu, Oct 7, 2010 at 5:48 AM, Felipe Prenholato <
>> philipe...@gmail.com>wrote:
>> >
>> >  Actually auth urls is 'appended' to urls in default backend (and
>> should
>> >  be added to your own backend if you create one).
>> >
>> >  Take a look at this line:http://1l.to/bf1/... so you don't need to
>> >  add it (again) to your urls.
>> >
>> >  I don't have this error with password_reset_complete view , but I'm
>> >  using my clone of original repo with some useful patches
>> (additions). What
>> >  is version that you are using?
>> >
>> >  2010/10/7 Joel Klabo 
>> >
>> > > Thanks for checking it out, this is the way it's set up:
>> > >http://dpaste.org/e6Ra/
>> >
>> > > it looks like it's using registration.auth_urls to direct to the
>> > > django.contrib.auth.urls ? I don't understand why
>> > > registration.auth_urls would exist...
>> >
>> > > On Oct 6, 6:32 pm, Ian Lewis  wrote:
>> > > > I just took a cursory look at this but did you make sure to add
>> > > > something like the following to your urlpatterns in urls.py?
>> >
>> > > > urlpatterns=patterns('',
>> > > > ...
>> > > > (r'^accounts/', include('django.contrib.auth.urls')),
>> > > > ...
>> > > > )
>> >
>> > > > On Thu, Oct 7, 2010 at 1:29 AM, Joel Klabo > >
>> > > wrote:
>> > > > > So now I am redirecting to the nam

Re: Django Registration password reset problem

2010-10-07 Thread Felipe Prenholato
But about views that you have at auth_views.py, are same of django auth
views?
this registration/auth_views.py exists for something, not?

2010/10/7 Joel Klabo 

> Awesome, that fixed it. All I had to do was change "from registration
> import auth_views" to "from django.contrib.auth import views as auth_views"
>
> Thank you so much
>
>
> On Thu, Oct 7, 2010 at 12:56 PM, Ted  wrote:
>
>> I think your problem is in auth_urls.py
>>
>> 28 - from registration import auth_views
>>
>> in my version of registration this is:
>> from django.contrib.auth import views as auth_views
>>
>>
>> Then you can understand why you get this error:
>> NoReverseMatch: Reverse for
>> 'django.contrib.auth.views.password_reset_complete' with arguments
>> '()' and keyword arguments '{}' not found.
>>
>> Because, you aren't mapping a URL to
>> django.contrib.auth.views.password_reset_complete.  You are mapping a
>> URL to registration.auth_views.password_reset_complete.  Django
>> doesn't know that registration.auth_views.password_reset_complete is
>> where you handle django.contrib.auth.views.password_reset_complete.
>>
>> You have two ways out of this:
>>
>> 1) don't use your local copy of auth_views, switch back to the
>> imported version.
>>
>> 2) In auth_views.py update:
>> 110 - post_reset_redirect =
>> reverse('django.contrib.auth.views.password_reset_done')
>> 144 -  post_reset_redirect =
>> reverse('django.contrib.auth.views.password_reset_complete')
>> 177 - post_change_redirect =
>> reverse('django.contrib.auth.views.password_change_done')
>>
>> to
>> 110 - post_reset_redirect =
>> reverse('registration.auth_views.password_reset_done')
>> 144 -  post_reset_redirect =
>> reverse('registration.auth_views.password_reset_complete')
>> 177 - post_change_redirect =
>> reverse('registration.auth_views.password_change_done')
>>
>> It also bears mentioning that name spacing registration can cause a
>> similar set of errors.
>>
>> Let me know if that worked,
>> Ted
>>
>> On Oct 7, 10:59 am, Joel Klabo  wrote:
>> > I am just using it as is. I haven't modified any of the code from
>> > django-registration. I'm confused as to how these are connected. Thanks
>> for
>> > looking.
>> >
>> > On Thu, Oct 7, 2010 at 10:20 AM, Felipe Prenholato <
>> philipe...@gmail.com>wrote:
>> >
>> >
>> >
>> > > This auth_views.py doesn't exist in trunk (that is this version),
>> sounds
>> > > like you writing custom admin views? Or you just copied admin/views.py
>> > > locally?
>> >
>> > > You already tried to resolve via name of url?
>> > > Else, if you writing custom admin views, isn't right to reference this
>> > > custom views?
>> >
>> > > (anyway, tonight I'll check the code)
>> >
>> > > 2010/10/7 Joel Klabo 
>> >
>> > >> Also, all my code is on Github if you would like to see something
>> else:
>> > >>http://github.com/joelklabo/brooski
>> >
>> > >> I really appreciate your help, thank you.
>> >
>> > >> On Thu, Oct 7, 2010 at 9:43 AM, Joel Klabo 
>> wrote:
>> >
>> > >>> My version is: VERSION = (0, 8, 0, 'alpha', 1)
>> >
>> > >>> Yeah, I have that include in my version as well...
>> >
>> > >>> It sends and email with this link:
>> > >>>
>> http://brooski.net/accounts/password/reset/confirm/1-2r2-ce8f57c2669d...
>> >
>> > >>> <
>> http://brooski.net/accounts/password/reset/confirm/1-2r2-ce8f57c2669d..
>> .>and
>> > >>> then when I click the link I get this error:http://dpaste.org/vrLp/
>> >
>> > >>> On Thu, Oct 7, 2010 at 5:48 AM, Felipe Prenholato <
>> philipe...@gmail.com>wrote:
>> >
>> >  Actually auth urls is 'appended' to urls in default backend (and
>> should
>> >  be added to your own backend if you create one).
>> >
>> >  Take a look at this line:http://1l.to/bf1/... so you don't need to
>> >  add it (again) to your urls.
>> >
>> >  I don't have this error with password_reset_complete view , but I'm
>> >  using my clone of original repo with some useful patches
>> (additions). What
>> >  is version that you are using?
>> >
>> >  2010/10/7 Joel Klabo 
>> >
>> > > Thanks for checking it out, this is the way it's set up:
>> > >http://dpaste.org/e6Ra/
>> >
>> > > it looks like it's using registration.auth_urls to direct to the
>> > > django.contrib.auth.urls ? I don't understand why
>> > > registration.auth_urls would exist...
>> >
>> > > On Oct 6, 6:32 pm, Ian Lewis  wrote:
>> > > > I just took a cursory look at this but did you make sure to add
>> > > > something like the following to your urlpatterns in urls.py?
>> >
>> > > > urlpatterns=patterns('',
>> > > > ...
>> > > > (r'^accounts/', include('django.contrib.auth.urls')),
>> > > > ...
>> > > > )
>> >
>> > > > On Thu, Oct 7, 2010 at 1:29 AM, Joel Klabo > >
>> > > wrote:
>> > > > > So now I am redirecting to the named url in the URL conf. That
>> is
>> > > now
>> > > > > giving me the error: The included urlconf
>> registration.auth_urls
>> > > > > doesn't have any patterns i

Re: OS Error, Permission Denined

2010-10-07 Thread ShawnMilo
The problem here is most likely due to the forward-slash in front of
your path name. Django's trying to actually write to a non-existant
folder at a level you don't have access to in any case on shared
hosting. Try taking it out and see if that fixes it.

Shawn

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



Best way to change pk field type

2010-10-07 Thread indymike
Here's my issue - I'm going to run out of integers for my primary key
in one of my tables.  I'm using MySQL, which has been absolutely
fantastic, and will for at least a few more decades if I can make a
change from INT to BIGINT.

What's the right way to switch from INT to BIGINT so the PK works
correctly?

/ First thought was a big, fat south migration, but I I wonder if
there's anything in Django's code that this will break?

-- 
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 Registration password reset problem

2010-10-07 Thread Joel Klabo
Awesome, that fixed it. All I had to do was change "from registration import
auth_views" to "from django.contrib.auth import views as auth_views"

Thank you so much


On Thu, Oct 7, 2010 at 12:56 PM, Ted  wrote:

> I think your problem is in auth_urls.py
>
> 28 - from registration import auth_views
>
> in my version of registration this is:
> from django.contrib.auth import views as auth_views
>
>
> Then you can understand why you get this error:
> NoReverseMatch: Reverse for
> 'django.contrib.auth.views.password_reset_complete' with arguments
> '()' and keyword arguments '{}' not found.
>
> Because, you aren't mapping a URL to
> django.contrib.auth.views.password_reset_complete.  You are mapping a
> URL to registration.auth_views.password_reset_complete.  Django
> doesn't know that registration.auth_views.password_reset_complete is
> where you handle django.contrib.auth.views.password_reset_complete.
>
> You have two ways out of this:
>
> 1) don't use your local copy of auth_views, switch back to the
> imported version.
>
> 2) In auth_views.py update:
> 110 - post_reset_redirect =
> reverse('django.contrib.auth.views.password_reset_done')
> 144 -  post_reset_redirect =
> reverse('django.contrib.auth.views.password_reset_complete')
> 177 - post_change_redirect =
> reverse('django.contrib.auth.views.password_change_done')
>
> to
> 110 - post_reset_redirect =
> reverse('registration.auth_views.password_reset_done')
> 144 -  post_reset_redirect =
> reverse('registration.auth_views.password_reset_complete')
> 177 - post_change_redirect =
> reverse('registration.auth_views.password_change_done')
>
> It also bears mentioning that name spacing registration can cause a
> similar set of errors.
>
> Let me know if that worked,
> Ted
>
> On Oct 7, 10:59 am, Joel Klabo  wrote:
> > I am just using it as is. I haven't modified any of the code from
> > django-registration. I'm confused as to how these are connected. Thanks
> for
> > looking.
> >
> > On Thu, Oct 7, 2010 at 10:20 AM, Felipe Prenholato  >wrote:
> >
> >
> >
> > > This auth_views.py doesn't exist in trunk (that is this version),
> sounds
> > > like you writing custom admin views? Or you just copied admin/views.py
> > > locally?
> >
> > > You already tried to resolve via name of url?
> > > Else, if you writing custom admin views, isn't right to reference this
> > > custom views?
> >
> > > (anyway, tonight I'll check the code)
> >
> > > 2010/10/7 Joel Klabo 
> >
> > >> Also, all my code is on Github if you would like to see something
> else:
> > >>http://github.com/joelklabo/brooski
> >
> > >> I really appreciate your help, thank you.
> >
> > >> On Thu, Oct 7, 2010 at 9:43 AM, Joel Klabo 
> wrote:
> >
> > >>> My version is: VERSION = (0, 8, 0, 'alpha', 1)
> >
> > >>> Yeah, I have that include in my version as well...
> >
> > >>> It sends and email with this link:
> > >>>
> http://brooski.net/accounts/password/reset/confirm/1-2r2-ce8f57c2669d...
> >
> > >>> <
> http://brooski.net/accounts/password/reset/confirm/1-2r2-ce8f57c2669d..
> .>and
> > >>> then when I click the link I get this error:http://dpaste.org/vrLp/
> >
> > >>> On Thu, Oct 7, 2010 at 5:48 AM, Felipe Prenholato <
> philipe...@gmail.com>wrote:
> >
> >  Actually auth urls is 'appended' to urls in default backend (and
> should
> >  be added to your own backend if you create one).
> >
> >  Take a look at this line:http://1l.to/bf1/... so you don't need to
> >  add it (again) to your urls.
> >
> >  I don't have this error with password_reset_complete view , but I'm
> >  using my clone of original repo with some useful patches
> (additions). What
> >  is version that you are using?
> >
> >  2010/10/7 Joel Klabo 
> >
> > > Thanks for checking it out, this is the way it's set up:
> > >http://dpaste.org/e6Ra/
> >
> > > it looks like it's using registration.auth_urls to direct to the
> > > django.contrib.auth.urls ? I don't understand why
> > > registration.auth_urls would exist...
> >
> > > On Oct 6, 6:32 pm, Ian Lewis  wrote:
> > > > I just took a cursory look at this but did you make sure to add
> > > > something like the following to your urlpatterns in urls.py?
> >
> > > > urlpatterns=patterns('',
> > > > ...
> > > > (r'^accounts/', include('django.contrib.auth.urls')),
> > > > ...
> > > > )
> >
> > > > On Thu, Oct 7, 2010 at 1:29 AM, Joel Klabo 
> > > wrote:
> > > > > So now I am redirecting to the named url in the URL conf. That
> is
> > > now
> > > > > giving me the error: The included urlconf
> registration.auth_urls
> > > > > doesn't have any patterns in it ...
> http://dpaste.org/OOw5/anyideas
> > > > > would be greatly appreciated
> >
> > > > > On Oct 5, 5:56 pm, Joel Klabo  wrote:
> > > > >> Ok, so I'm pretty sure this has to do with the fact that the
> > > > >> post_reset_redirect argument defaults to the
> > > > >> django.contrib.auth.views.password_reset_

Re: OS Error, Permission Denined

2010-10-07 Thread Shawn Milochik
I have Webfaction. I found a file named /etc/redhat-release which states that 
my server is running CentOS release 5.5 (Final).

I hope that helps. Look for a file in /etc beginning with 'lsb' (for Linux 
Standard Base') or 'redhat.' 

Shawn

-- 
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: OS Error, Permission Denined

2010-10-07 Thread Rizwan Mansuri
it's Linux. I don’t know Have you heard of webfaction hosting company. 

-Original Message-
From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com]
On Behalf Of Gonzalo Delgado
Sent: 07 October 2010 20:57
To: django-users@googlegroups.com
Subject: Re: OS Error, Permission Denined

El 07/10/10 16:21, Rizwan Mansuri escribió:
> Could you please guide me to any document that explain this?

Sorry, I may have assumed too much on my previous response.
What OS is your Django project running on?

Here is a guide for Linux:
http://www.zzee.com/solutions/linux-permissions.shtml

-- 
Gonzalo Delgado 

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



Re: dictionary doesn't get properly updated

2010-10-07 Thread jimgardener
right..that is what was happening..
thanks for pointing it out..
regards
jim

On Oct 7, 11:41 pm, Doug  wrote:
> Could it be that garbage collection is deleting your "tm" instance
> when it falls out of scope at the end of the view call?  If that is
> the only place you've instantiated it, I'm guessing the reference
> count would go to zero 'singleton' or not.

-- 
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 Registration password reset problem

2010-10-07 Thread Ted
I think your problem is in auth_urls.py

28 - from registration import auth_views

in my version of registration this is:
from django.contrib.auth import views as auth_views


Then you can understand why you get this error:
NoReverseMatch: Reverse for
'django.contrib.auth.views.password_reset_complete' with arguments
'()' and keyword arguments '{}' not found.

Because, you aren't mapping a URL to
django.contrib.auth.views.password_reset_complete.  You are mapping a
URL to registration.auth_views.password_reset_complete.  Django
doesn't know that registration.auth_views.password_reset_complete is
where you handle django.contrib.auth.views.password_reset_complete.

You have two ways out of this:

1) don't use your local copy of auth_views, switch back to the
imported version.

2) In auth_views.py update:
110 - post_reset_redirect =
reverse('django.contrib.auth.views.password_reset_done')
144 -  post_reset_redirect =
reverse('django.contrib.auth.views.password_reset_complete')
177 - post_change_redirect =
reverse('django.contrib.auth.views.password_change_done')

to
110 - post_reset_redirect =
reverse('registration.auth_views.password_reset_done')
144 -  post_reset_redirect =
reverse('registration.auth_views.password_reset_complete')
177 - post_change_redirect =
reverse('registration.auth_views.password_change_done')

It also bears mentioning that name spacing registration can cause a
similar set of errors.

Let me know if that worked,
Ted

On Oct 7, 10:59 am, Joel Klabo  wrote:
> I am just using it as is. I haven't modified any of the code from
> django-registration. I'm confused as to how these are connected. Thanks for
> looking.
>
> On Thu, Oct 7, 2010 at 10:20 AM, Felipe Prenholato 
> wrote:
>
>
>
> > This auth_views.py doesn't exist in trunk (that is this version), sounds
> > like you writing custom admin views? Or you just copied admin/views.py
> > locally?
>
> > You already tried to resolve via name of url?
> > Else, if you writing custom admin views, isn't right to reference this
> > custom views?
>
> > (anyway, tonight I'll check the code)
>
> > 2010/10/7 Joel Klabo 
>
> >> Also, all my code is on Github if you would like to see something else:
> >>http://github.com/joelklabo/brooski
>
> >> I really appreciate your help, thank you.
>
> >> On Thu, Oct 7, 2010 at 9:43 AM, Joel Klabo  wrote:
>
> >>> My version is: VERSION = (0, 8, 0, 'alpha', 1)
>
> >>> Yeah, I have that include in my version as well...
>
> >>> It sends and email with this link:
> >>>http://brooski.net/accounts/password/reset/confirm/1-2r2-ce8f57c2669d...
>
> >>> and
> >>> then when I click the link I get this error:http://dpaste.org/vrLp/
>
> >>> On Thu, Oct 7, 2010 at 5:48 AM, Felipe Prenholato 
> >>> wrote:
>
>  Actually auth urls is 'appended' to urls in default backend (and should
>  be added to your own backend if you create one).
>
>  Take a look at this line:http://1l.to/bf1/... so you don't need to
>  add it (again) to your urls.
>
>  I don't have this error with password_reset_complete view , but I'm
>  using my clone of original repo with some useful patches (additions). 
>  What
>  is version that you are using?
>
>  2010/10/7 Joel Klabo 
>
> > Thanks for checking it out, this is the way it's set up:
> >http://dpaste.org/e6Ra/
>
> > it looks like it's using registration.auth_urls to direct to the
> > django.contrib.auth.urls ? I don't understand why
> > registration.auth_urls would exist...
>
> > On Oct 6, 6:32 pm, Ian Lewis  wrote:
> > > I just took a cursory look at this but did you make sure to add
> > > something like the following to your urlpatterns in urls.py?
>
> > > urlpatterns=patterns('',
> > >     ...
> > >     (r'^accounts/', include('django.contrib.auth.urls')),
> > >     ...
> > > )
>
> > > On Thu, Oct 7, 2010 at 1:29 AM, Joel Klabo 
> > wrote:
> > > > So now I am redirecting to the named url in the URL conf. That is
> > now
> > > > giving me the error: The included urlconf registration.auth_urls
> > > > doesn't have any patterns in it ...http://dpaste.org/OOw5/anyideas
> > > > would be greatly appreciated
>
> > > > On Oct 5, 5:56 pm, Joel Klabo  wrote:
> > > >> Ok, so I'm pretty sure this has to do with the fact that the
> > > >> post_reset_redirect argument defaults to the
> > > >> django.contrib.auth.views.password_reset_done if no
> > > >> post_reset_redirect is passed to the view. I am using django-
> > > >> registration and it seems like there would be a better way to deal
> > > >> with this... There is something I'm missing. If anyone has used
> > this
> > > >> and gotten it to work I would be grateful to hear about it. All
> > the
> > > >> other parts of the registration system work which makes me think
> > this
> > > >> has something to do with the fact that it i

Re: OS Error, Permission Denined

2010-10-07 Thread Gonzalo Delgado
El 07/10/10 16:21, Rizwan Mansuri escribió:
> Could you please guide me to any document that explain this?

Sorry, I may have assumed too much on my previous response.
What OS is your Django project running on?

Here is a guide for Linux:
http://www.zzee.com/solutions/linux-permissions.shtml

-- 
Gonzalo Delgado 

-- 
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: OS Error, Permission Denined

2010-10-07 Thread Rizwan Mansuri
Thanks very much for your reply,

Could you please guide me to any document that explain this?

Thanks again,


-Original Message-
From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com]
On Behalf Of Gonzalo Delgado
Sent: 07 October 2010 20:17
To: django-users@googlegroups.com
Subject: Re: OS Error, Permission Denined

El 07/10/10 16:05, Rizwan Mansuri escribió:
>
>
>   I am newbie in Django. I ‘m stuck at this point. I have developed
>   one apps in django which has Imagefield. While I am trying add this
>   content in site its giving me error saying OSError at
>   /admin/portfolio/portfolio/add/
>
> [Errno 13] Permission denied: '/myproject'. Myproject is root folder
> of my django website. I have pasted traceback below.
>

You need to allow the http process user (most likely apache) to write in
that folder.

-- 
Gonzalo Delgado 

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



Re: OSError Permission denied

2010-10-07 Thread Ale
On Thu, Oct 7, 2010 at 3:58 PM, Rizwan Mansuri  wrote:
> Hello Django Gurus,
>
>
>
> I am newbie in Django. I ‘m stuck at this point. I have developed one apps
> in django which has Imagefield. While I am trying add this content in site
> its giving me error saying OSError at /admin/portfolio/portfolio/add/
>
> [Errno 13] Permission denied: '/myproject'. Myproject is root folder of my
> django website. I have pasted traceback below.

Clearly from the error it means that you don't have permissions to
write or create a dir "/myproject" directory. (Usually in unix
environments a normal user doesn't have permissions to write in "/",
-- the root dir). So you should check that the directory you are
creating or saving a file too has write permission (or more correctly
that the user who is running the process can write to it).

My guess is that you miss configured something, check that you
specified the correct directory (in which ever setting variable is
that)

Hope it helps,
-- 
Ale.

-- 
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: OS Error, Permission Denined

2010-10-07 Thread Gonzalo Delgado
El 07/10/10 16:05, Rizwan Mansuri escribió:
>
>
>   I am newbie in Django. I ‘m stuck at this point. I have developed
>   one apps in django which has Imagefield. While I am trying add this
>   content in site its giving me error saying OSError at
>   /admin/portfolio/portfolio/add/
>
> [Errno 13] Permission denied: '/myproject'. Myproject is root folder
> of my django website. I have pasted traceback below.
>

You need to allow the http process user (most likely apache) to write in
that folder.

-- 
Gonzalo Delgado 

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



OS Error, Permission Denined

2010-10-07 Thread Rizwan Mansuri
Hello Django Gurus,

 


I am newbie in Django. I 'm stuck at this point. I have developed one apps
in django which has Imagefield. While I am trying add this content in site
its giving me error saying OSError at /admin/portfolio/portfolio/add/


[Errno 13] Permission denied: '/myproject'. Myproject is root folder of my
django website. I have pasted traceback below.

 

I've search a bit on Google but couldn't find any solution.

 

Please Help !!!

 

Cheers,

 

 

Environment:

 

Request Method: POST

Request URL: http://dev.rmansuri.net/admin/portfolio/portfolio/add/

Django Version: 1.2 beta 1

Python Version: 2.5.4

Installed Applications:

['django.contrib.auth',

 'django.contrib.contenttypes',

 'django.contrib.sessions',

 'django.contrib.sites',

 'django.contrib.messages',

 'django.contrib.admin',

 'django.contrib.flatpages',

 'tinymce',

 'contact_form',

 'myproject.weblog',

 'photologue',

 'myproject.portfolio']

Installed Middleware:

('django.middleware.common.CommonMiddleware',

 'django.contrib.sessions.middleware.SessionMiddleware',

 'django.middleware.csrf.CsrfViewMiddleware',

 'django.contrib.auth.middleware.AuthenticationMiddleware',

 'django.contrib.messages.middleware.MessageMiddleware',

 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',

 'django.middleware.csrf.CsrfViewMiddleware',

 'django.middleware.csrf.CsrfResponseMiddleware')

 

 

Traceback:

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/core/handlers/base
.py" in get_response

  100. response = callback(request, *callback_args,
**callback_kwargs)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/contrib/admin/site
s.py" in root

  516. return self.model_page(request, *url.split('/', 2))

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/views/decorators/c
ache.py" in _wrapped_view_func

  69. response = view_func(request, *args, **kwargs)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/contrib/admin/site
s.py" in model_page

  535. return admin_obj(request, rest_of_url)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/contrib/admin/opti
ons.py" in __call__

  1166. return self.add_view(request)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/utils/decorators.p
y" in _wrapper

  21. return decorator(bound_func)(*args, **kwargs)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/utils/decorators.p
y" in _wrapped_view

  74. response = view_func(request, *args, **kwargs)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/utils/decorators.p
y" in bound_func

  17. return func(self, *args2, **kwargs2)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/db/transaction.py"
in _commit_on_success

  299. res = func(*args, **kw)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/contrib/admin/opti
ons.py" in add_view

  796. self.save_model(request, new_object, form,
change=False)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/contrib/admin/opti
ons.py" in save_model

  596. obj.save()

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/db/models/base.py"
in save

  435. self.save_base(using=using, force_insert=force_insert,
force_update=force_update)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/db/models/base.py"
in save_base

  511. for f in meta.local_fields if not
isinstance(f, AutoField)]

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/db/models/fields/f
iles.py" in pre_save

  255. file.save(file.name, file, save=False)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/db/models/fields/f
iles.py" in save

  92. self.name = self.storage.save(name, content)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/core/files/storage
.py" in save

  48. name = self._save(name, content)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/core/files/storage
.py" in _save

  144. os.makedirs(directory)

File "/usr/local/lib/python2.5/os.py" in makedirs

  164. makedirs(head, mode)

File "/usr/local/lib/python2.5/os.py" in makedirs

  164. makedirs(head, mode)

File "/usr/local/lib/python2.5/os.py" in makedirs

  164. makedirs(head, mode)

File "/usr/local/lib/python2.5/os.py" in makedirs

  164. makedirs(head, mode)

File "/usr/local/lib/python2.5/os.py" in makedirs

  171. mkdir(name, mode)

 

Exception Type: OSError at /admin/portfolio/portfolio/add/

Exception Value: [Errno 13] Permission denied: '/myproject'

 

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

OSError Permission denied

2010-10-07 Thread Rizwan Mansuri
Hello Django Gurus,

 


I am newbie in Django. I 'm stuck at this point. I have developed one apps
in django which has Imagefield. While I am trying add this content in site
its giving me error saying OSError at /admin/portfolio/portfolio/add/


[Errno 13] Permission denied: '/myproject'. Myproject is root folder of my
django website. I have pasted traceback below.

 

I've search a bit on Google but couldn't find any solution.

 

Please Help !!!

 

Cheers,

 

 

Environment:

 

Request Method: POST

Request URL: http://dev.rmansuri.net/admin/portfolio/portfolio/add/

Django Version: 1.2 beta 1

Python Version: 2.5.4

Installed Applications:

['django.contrib.auth',

 'django.contrib.contenttypes',

 'django.contrib.sessions',

 'django.contrib.sites',

 'django.contrib.messages',

 'django.contrib.admin',

 'django.contrib.flatpages',

 'tinymce',

 'contact_form',

 'myproject.weblog',

 'photologue',

 'myproject.portfolio']

Installed Middleware:

('django.middleware.common.CommonMiddleware',

 'django.contrib.sessions.middleware.SessionMiddleware',

 'django.middleware.csrf.CsrfViewMiddleware',

 'django.contrib.auth.middleware.AuthenticationMiddleware',

 'django.contrib.messages.middleware.MessageMiddleware',

 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',

 'django.middleware.csrf.CsrfViewMiddleware',

 'django.middleware.csrf.CsrfResponseMiddleware')

 

 

Traceback:

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/core/handlers/base
.py" in get_response

  100. response = callback(request, *callback_args,
**callback_kwargs)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/contrib/admin/site
s.py" in root

  516. return self.model_page(request, *url.split('/', 2))

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/views/decorators/c
ache.py" in _wrapped_view_func

  69. response = view_func(request, *args, **kwargs)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/contrib/admin/site
s.py" in model_page

  535. return admin_obj(request, rest_of_url)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/contrib/admin/opti
ons.py" in __call__

  1166. return self.add_view(request)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/utils/decorators.p
y" in _wrapper

  21. return decorator(bound_func)(*args, **kwargs)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/utils/decorators.p
y" in _wrapped_view

  74. response = view_func(request, *args, **kwargs)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/utils/decorators.p
y" in bound_func

  17. return func(self, *args2, **kwargs2)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/db/transaction.py"
in _commit_on_success

  299. res = func(*args, **kw)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/contrib/admin/opti
ons.py" in add_view

  796. self.save_model(request, new_object, form,
change=False)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/contrib/admin/opti
ons.py" in save_model

  596. obj.save()

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/db/models/base.py"
in save

  435. self.save_base(using=using, force_insert=force_insert,
force_update=force_update)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/db/models/base.py"
in save_base

  511. for f in meta.local_fields if not
isinstance(f, AutoField)]

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/db/models/fields/f
iles.py" in pre_save

  255. file.save(file.name, file, save=False)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/db/models/fields/f
iles.py" in save

  92. self.name = self.storage.save(name, content)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/core/files/storage
.py" in save

  48. name = self._save(name, content)

File
"/home/rmansuri/webapps/dev_rmansuri/lib/python2.5/django/core/files/storage
.py" in _save

  144. os.makedirs(directory)

File "/usr/local/lib/python2.5/os.py" in makedirs

  164. makedirs(head, mode)

File "/usr/local/lib/python2.5/os.py" in makedirs

  164. makedirs(head, mode)

File "/usr/local/lib/python2.5/os.py" in makedirs

  164. makedirs(head, mode)

File "/usr/local/lib/python2.5/os.py" in makedirs

  164. makedirs(head, mode)

File "/usr/local/lib/python2.5/os.py" in makedirs

  171. mkdir(name, mode)

 

Exception Type: OSError at /admin/portfolio/portfolio/add/

Exception Value: [Errno 13] Permission denied: '/myproject'

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

Re: dictionary doesn't get properly updated

2010-10-07 Thread Doug
Could it be that garbage collection is deleting your "tm" instance
when it falls out of scope at the end of the view call?  If that is
the only place you've instantiated it, I'm guessing the reference
count would go to zero 'singleton' or not.

-- 
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: iPhone posting FILEs = "Invalid content length"

2010-10-07 Thread Eric Chamberlain
We ran into the same error with ASIHTTPRequest, our fix was to turn off 
persistent connections.

On Sep 30, 2010, at 3:55 AM, Danny Bos wrote:

> 
> Hey there,
> I've got a new error I'm totally stumped on. All searches are saying
> it's a "http vs https" or similar.
> I'd be keen to hear your thoughts.
> 
> Basically I've got an iPhone app sending a POST to a django app, it
> contains one FILE.
> Every now and then (very sporadically, about 1 in 5) one fails and I
> get the below message.
> 
> 
> Exception Type:
> MultiPartParserError
> 
> 
> Exception Value:
> Invalid content length: 0
> 
> 
> Exception Location:
> /home/72999/data/python/django/django/http/multipartparser.py in
> _init_, line 80
> 
> 
> Any ideas?
> 
> -- 
> 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.



Add message on specific error to 500 page

2010-10-07 Thread Streamweaver
On our 500 error page I would like to display a message specifically
if the error is in the Database connection, and not display the
message on any other uncaught exception but I can't seem to figure out
a way to catch the specific exception going to a 500 page.

Has anyone done 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.



Re: Django Registration password reset problem

2010-10-07 Thread Joel Klabo
I am just using it as is. I haven't modified any of the code from
django-registration. I'm confused as to how these are connected. Thanks for
looking.

On Thu, Oct 7, 2010 at 10:20 AM, Felipe Prenholato wrote:

> This auth_views.py doesn't exist in trunk (that is this version), sounds
> like you writing custom admin views? Or you just copied admin/views.py
> locally?
>
> You already tried to resolve via name of url?
> Else, if you writing custom admin views, isn't right to reference this
> custom views?
>
> (anyway, tonight I'll check the code)
>
> 2010/10/7 Joel Klabo 
>
>> Also, all my code is on Github if you would like to see something else:
>> http://github.com/joelklabo/brooski
>>
>> I really appreciate your help, thank you.
>>
>> On Thu, Oct 7, 2010 at 9:43 AM, Joel Klabo  wrote:
>>
>>> My version is: VERSION = (0, 8, 0, 'alpha', 1)
>>>
>>> Yeah, I have that include in my version as well...
>>>
>>> It sends and email with this link:
>>> http://brooski.net/accounts/password/reset/confirm/1-2r2-ce8f57c2669d29e5f24e/
>>>
>>>
>>> and
>>> then when I click the link I get this error: http://dpaste.org/vrLp/
>>>
>>>
>>>
>>> On Thu, Oct 7, 2010 at 5:48 AM, Felipe Prenholato 
>>> wrote:
>>>
 Actually auth urls is 'appended' to urls in default backend (and should
 be added to your own backend if you create one).

 Take a look at this line: http://1l.to/bf1/ ... so you don't need to
 add it (again) to your urls.

 I don't have this error with password_reset_complete view , but I'm
 using my clone of original repo with some useful patches (additions). What
 is version that you are using?

 2010/10/7 Joel Klabo 

> Thanks for checking it out, this is the way it's set up:
> http://dpaste.org/e6Ra/
>
> it looks like it's using registration.auth_urls to direct to the
> django.contrib.auth.urls ? I don't understand why
> registration.auth_urls would exist...
>
> On Oct 6, 6:32 pm, Ian Lewis  wrote:
> > I just took a cursory look at this but did you make sure to add
> > something like the following to your urlpatterns in urls.py?
> >
> > urlpatterns=patterns('',
> > ...
> > (r'^accounts/', include('django.contrib.auth.urls')),
> > ...
> > )
> >
> >
> >
> >
> >
> > On Thu, Oct 7, 2010 at 1:29 AM, Joel Klabo 
> wrote:
> > > So now I am redirecting to the named url in the URL conf. That is
> now
> > > giving me the error: The included urlconf registration.auth_urls
> > > doesn't have any patterns in it ...http://dpaste.org/OOw5/anyideas
> > > would be greatly appreciated
> >
> > > On Oct 5, 5:56 pm, Joel Klabo  wrote:
> > >> Ok, so I'm pretty sure this has to do with the fact that the
> > >> post_reset_redirect argument defaults to the
> > >> django.contrib.auth.views.password_reset_done if no
> > >> post_reset_redirect is passed to the view. I am using django-
> > >> registration and it seems like there would be a better way to deal
> > >> with this... There is something I'm missing. If anyone has used
> this
> > >> and gotten it to work I would be grateful to hear about it. All
> the
> > >> other parts of the registration system work which makes me think
> this
> > >> has something to do with the fact that it is reverting back to the
> > >> django.contrib views and now using the ones that come with django-
> > >> registration... Here is the view where the error first pops up,
> this
> > >> is where post_reset_redirect is as well:http://dpaste.org/gatU/
> >
> > >> Thanks for your time
> >
> > >> On Oct 5, 1:56 pm, Steve Holden  wrote:
> >
> > >> > On 10/5/2010 4:45 PM,JoelKlabowrote:> Need to bump this, sorry.
> I don't get it.
>
> >
> > >> > > On Oct 5, 1:04 pm,JoelKlabo wrote:
> > >> > >> This is the error and location of the problem:
> http://gist.github.com/612210,
> > >> > >> I can't see what it's looking for. It seems like I could hard
> code the
> > >> > >> arguments it wants into the reverse() but that doesn't seem
> like the
> > >> > >> correct way to do it. Any advice?
> >
> > >> > I can quite see how 41 minutes would appear to be an infinity to
> someone
> > >> > who is wanting the answer to a problem. Please remember, though,
> that
> > >> > people who post on this list aren't paid to do so, and mostly
> have
> > >> > full-time jobs.
> >
> > >> > So a little patience will make it more likely people will help
> you.
> >
> > >> > regards
> > >> >  Steve
> > >> > --
> > >> > DjangoCon US 2010 September 7-9http://djangocon.us/
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups "Django users" group.
> 

Migrating Groups of Permissions

2010-10-07 Thread Dan Gentry
As I deploy my application into production, I haven't found a good way
to migrate the groups of permissions I have defined and tested in
development.  In fact, due to my poor typing and reviewing, I missed
one in production and caused a small amount of concern with the users
until I figured it out.

It seems that I can't just dump and load the data from the test DB,
since the permissions may not have the same ID.  Any hints from the
community on how I can automate this to reduce the chance for 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: Django Registration password reset problem

2010-10-07 Thread Felipe Prenholato
This auth_views.py doesn't exist in trunk (that is this version), sounds
like you writing custom admin views? Or you just copied admin/views.py
locally?

You already tried to resolve via name of url?
Else, if you writing custom admin views, isn't right to reference this
custom views?

(anyway, tonight I'll check the code)

2010/10/7 Joel Klabo 

> Also, all my code is on Github if you would like to see something else:
> http://github.com/joelklabo/brooski
>
> I really appreciate your help, thank you.
>
> On Thu, Oct 7, 2010 at 9:43 AM, Joel Klabo  wrote:
>
>> My version is: VERSION = (0, 8, 0, 'alpha', 1)
>>
>> Yeah, I have that include in my version as well...
>>
>> It sends and email with this link:
>> http://brooski.net/accounts/password/reset/confirm/1-2r2-ce8f57c2669d29e5f24e/
>>
>>
>> and
>> then when I click the link I get this error: http://dpaste.org/vrLp/
>>
>>
>>
>> On Thu, Oct 7, 2010 at 5:48 AM, Felipe Prenholato 
>> wrote:
>>
>>> Actually auth urls is 'appended' to urls in default backend (and should
>>> be added to your own backend if you create one).
>>>
>>> Take a look at this line: http://1l.to/bf1/ ... so you don't need to add
>>> it (again) to your urls.
>>>
>>> I don't have this error with password_reset_complete view , but I'm
>>> using my clone of original repo with some useful patches (additions). What
>>> is version that you are using?
>>>
>>> 2010/10/7 Joel Klabo 
>>>
 Thanks for checking it out, this is the way it's set up:
 http://dpaste.org/e6Ra/

 it looks like it's using registration.auth_urls to direct to the
 django.contrib.auth.urls ? I don't understand why
 registration.auth_urls would exist...

 On Oct 6, 6:32 pm, Ian Lewis  wrote:
 > I just took a cursory look at this but did you make sure to add
 > something like the following to your urlpatterns in urls.py?
 >
 > urlpatterns=patterns('',
 > ...
 > (r'^accounts/', include('django.contrib.auth.urls')),
 > ...
 > )
 >
 >
 >
 >
 >
 > On Thu, Oct 7, 2010 at 1:29 AM, Joel Klabo 
 wrote:
 > > So now I am redirecting to the named url in the URL conf. That is
 now
 > > giving me the error: The included urlconf registration.auth_urls
 > > doesn't have any patterns in it ...http://dpaste.org/OOw5/any ideas
 > > would be greatly appreciated
 >
 > > On Oct 5, 5:56 pm, Joel Klabo  wrote:
 > >> Ok, so I'm pretty sure this has to do with the fact that the
 > >> post_reset_redirect argument defaults to the
 > >> django.contrib.auth.views.password_reset_done if no
 > >> post_reset_redirect is passed to the view. I am using django-
 > >> registration and it seems like there would be a better way to deal
 > >> with this... There is something I'm missing. If anyone has used
 this
 > >> and gotten it to work I would be grateful to hear about it. All the
 > >> other parts of the registration system work which makes me think
 this
 > >> has something to do with the fact that it is reverting back to the
 > >> django.contrib views and now using the ones that come with django-
 > >> registration... Here is the view where the error first pops up,
 this
 > >> is where post_reset_redirect is as well:http://dpaste.org/gatU/
 >
 > >> Thanks for your time
 >
 > >> On Oct 5, 1:56 pm, Steve Holden  wrote:
 >
 > >> > On 10/5/2010 4:45 PM,JoelKlabowrote:> Need to bump this, sorry. I
 don't get it.

 >
 > >> > > On Oct 5, 1:04 pm,JoelKlabo wrote:
 > >> > >> This is the error and location of the problem:
 http://gist.github.com/612210,
 > >> > >> I can't see what it's looking for. It seems like I could hard
 code the
 > >> > >> arguments it wants into the reverse() but that doesn't seem
 like the
 > >> > >> correct way to do it. Any advice?
 >
 > >> > I can quite see how 41 minutes would appear to be an infinity to
 someone
 > >> > who is wanting the answer to a problem. Please remember, though,
 that
 > >> > people who post on this list aren't paid to do so, and mostly
 have
 > >> > full-time jobs.
 >
 > >> > So a little patience will make it more likely people will help
 you.
 >
 > >> > regards
 > >> >  Steve
 > >> > --
 > >> > DjangoCon US 2010 September 7-9http://djangocon.us/
 >
 > > --
 > > 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 athttp://
 groups.google.com/group/django-users?hl=en.
 >
 > --
 > Ian
 >
 > http://www.ianlewis.org/
>>>

Re: Django documentation search not working

2010-10-07 Thread NoviceSortOf

Steve:

Thanks, the problem must be Firefox plugin I'm running because Opera
works just
fine. Thanks for the suggestion.

-- 
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 Registration password reset problem

2010-10-07 Thread Joel Klabo
Also, all my code is on Github if you would like to see something else:
http://github.com/joelklabo/brooski

I really appreciate your help, thank you.

On Thu, Oct 7, 2010 at 9:43 AM, Joel Klabo  wrote:

> My version is: VERSION = (0, 8, 0, 'alpha', 1)
>
> Yeah, I have that include in my version as well...
>
> It sends and email with this link:
> http://brooski.net/accounts/password/reset/confirm/1-2r2-ce8f57c2669d29e5f24e/
>
>
> and
> then when I click the link I get this error: http://dpaste.org/vrLp/
>
>
>
> On Thu, Oct 7, 2010 at 5:48 AM, Felipe Prenholato wrote:
>
>> Actually auth urls is 'appended' to urls in default backend (and should be
>> added to your own backend if you create one).
>>
>> Take a look at this line: http://1l.to/bf1/ ... so you don't need to add
>> it (again) to your urls.
>>
>> I don't have this error with password_reset_complete view , but I'm using
>> my clone of original repo with some useful patches (additions). What is
>> version that you are using?
>>
>> 2010/10/7 Joel Klabo 
>>
>>> Thanks for checking it out, this is the way it's set up:
>>> http://dpaste.org/e6Ra/
>>>
>>> it looks like it's using registration.auth_urls to direct to the
>>> django.contrib.auth.urls ? I don't understand why
>>> registration.auth_urls would exist...
>>>
>>> On Oct 6, 6:32 pm, Ian Lewis  wrote:
>>> > I just took a cursory look at this but did you make sure to add
>>> > something like the following to your urlpatterns in urls.py?
>>> >
>>> > urlpatterns=patterns('',
>>> > ...
>>> > (r'^accounts/', include('django.contrib.auth.urls')),
>>> > ...
>>> > )
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > On Thu, Oct 7, 2010 at 1:29 AM, Joel Klabo 
>>> wrote:
>>> > > So now I am redirecting to the named url in the URL conf. That is now
>>> > > giving me the error: The included urlconf registration.auth_urls
>>> > > doesn't have any patterns in it ...http://dpaste.org/OOw5/any ideas
>>> > > would be greatly appreciated
>>> >
>>> > > On Oct 5, 5:56 pm, Joel Klabo  wrote:
>>> > >> Ok, so I'm pretty sure this has to do with the fact that the
>>> > >> post_reset_redirect argument defaults to the
>>> > >> django.contrib.auth.views.password_reset_done if no
>>> > >> post_reset_redirect is passed to the view. I am using django-
>>> > >> registration and it seems like there would be a better way to deal
>>> > >> with this... There is something I'm missing. If anyone has used this
>>> > >> and gotten it to work I would be grateful to hear about it. All the
>>> > >> other parts of the registration system work which makes me think
>>> this
>>> > >> has something to do with the fact that it is reverting back to the
>>> > >> django.contrib views and now using the ones that come with django-
>>> > >> registration... Here is the view where the error first pops up, this
>>> > >> is where post_reset_redirect is as well:http://dpaste.org/gatU/
>>> >
>>> > >> Thanks for your time
>>> >
>>> > >> On Oct 5, 1:56 pm, Steve Holden  wrote:
>>> >
>>> > >> > On 10/5/2010 4:45 PM,JoelKlabowrote:> Need to bump this, sorry. I
>>> don't get it.
>>>
>>> >
>>> > >> > > On Oct 5, 1:04 pm,JoelKlabo wrote:
>>> > >> > >> This is the error and location of the problem:
>>> http://gist.github.com/612210,
>>> > >> > >> I can't see what it's looking for. It seems like I could hard
>>> code the
>>> > >> > >> arguments it wants into the reverse() but that doesn't seem
>>> like the
>>> > >> > >> correct way to do it. Any advice?
>>> >
>>> > >> > I can quite see how 41 minutes would appear to be an infinity to
>>> someone
>>> > >> > who is wanting the answer to a problem. Please remember, though,
>>> that
>>> > >> > people who post on this list aren't paid to do so, and mostly have
>>> > >> > full-time jobs.
>>> >
>>> > >> > So a little patience will make it more likely people will help
>>> you.
>>> >
>>> > >> > regards
>>> > >> >  Steve
>>> > >> > --
>>> > >> > DjangoCon US 2010 September 7-9http://djangocon.us/
>>> >
>>> > > --
>>> > > 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 athttp://
>>> groups.google.com/group/django-users?hl=en.
>>> >
>>> > --
>>> > Ian
>>> >
>>> > http://www.ianlewis.org/
>>>
>>> --
>>> 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.
>>>
>>>
>>
>>
>> --
>> Felipe 'chronos' Prenholato.
>> Linux User nº 405489
>> Home page: http://chronosbox.org/blog

Re: Django Registration password reset problem

2010-10-07 Thread Joel Klabo
My version is: VERSION = (0, 8, 0, 'alpha', 1)

Yeah, I have that include in my version as well...

It sends and email with this link:
http://brooski.net/accounts/password/reset/confirm/1-2r2-ce8f57c2669d29e5f24e/

and
then when I click the link I get this error: http://dpaste.org/vrLp/



On Thu, Oct 7, 2010 at 5:48 AM, Felipe Prenholato wrote:

> Actually auth urls is 'appended' to urls in default backend (and should be
> added to your own backend if you create one).
>
> Take a look at this line: http://1l.to/bf1/ ... so you don't need to add
> it (again) to your urls.
>
> I don't have this error with password_reset_complete view , but I'm using
> my clone of original repo with some useful patches (additions). What is
> version that you are using?
>
> 2010/10/7 Joel Klabo 
>
>> Thanks for checking it out, this is the way it's set up:
>> http://dpaste.org/e6Ra/
>>
>> it looks like it's using registration.auth_urls to direct to the
>> django.contrib.auth.urls ? I don't understand why
>> registration.auth_urls would exist...
>>
>> On Oct 6, 6:32 pm, Ian Lewis  wrote:
>> > I just took a cursory look at this but did you make sure to add
>> > something like the following to your urlpatterns in urls.py?
>> >
>> > urlpatterns=patterns('',
>> > ...
>> > (r'^accounts/', include('django.contrib.auth.urls')),
>> > ...
>> > )
>> >
>> >
>> >
>> >
>> >
>> > On Thu, Oct 7, 2010 at 1:29 AM, Joel Klabo  wrote:
>> > > So now I am redirecting to the named url in the URL conf. That is now
>> > > giving me the error: The included urlconf registration.auth_urls
>> > > doesn't have any patterns in it ...http://dpaste.org/OOw5/any ideas
>> > > would be greatly appreciated
>> >
>> > > On Oct 5, 5:56 pm, Joel Klabo  wrote:
>> > >> Ok, so I'm pretty sure this has to do with the fact that the
>> > >> post_reset_redirect argument defaults to the
>> > >> django.contrib.auth.views.password_reset_done if no
>> > >> post_reset_redirect is passed to the view. I am using django-
>> > >> registration and it seems like there would be a better way to deal
>> > >> with this... There is something I'm missing. If anyone has used this
>> > >> and gotten it to work I would be grateful to hear about it. All the
>> > >> other parts of the registration system work which makes me think this
>> > >> has something to do with the fact that it is reverting back to the
>> > >> django.contrib views and now using the ones that come with django-
>> > >> registration... Here is the view where the error first pops up, this
>> > >> is where post_reset_redirect is as well:http://dpaste.org/gatU/
>> >
>> > >> Thanks for your time
>> >
>> > >> On Oct 5, 1:56 pm, Steve Holden  wrote:
>> >
>> > >> > On 10/5/2010 4:45 PM,JoelKlabowrote:> Need to bump this, sorry. I
>> don't get it.
>>
>> >
>> > >> > > On Oct 5, 1:04 pm,JoelKlabo wrote:
>> > >> > >> This is the error and location of the problem:
>> http://gist.github.com/612210,
>> > >> > >> I can't see what it's looking for. It seems like I could hard
>> code the
>> > >> > >> arguments it wants into the reverse() but that doesn't seem like
>> the
>> > >> > >> correct way to do it. Any advice?
>> >
>> > >> > I can quite see how 41 minutes would appear to be an infinity to
>> someone
>> > >> > who is wanting the answer to a problem. Please remember, though,
>> that
>> > >> > people who post on this list aren't paid to do so, and mostly have
>> > >> > full-time jobs.
>> >
>> > >> > So a little patience will make it more likely people will help you.
>> >
>> > >> > regards
>> > >> >  Steve
>> > >> > --
>> > >> > DjangoCon US 2010 September 7-9http://djangocon.us/
>> >
>> > > --
>> > > 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 athttp://
>> groups.google.com/group/django-users?hl=en.
>> >
>> > --
>> > Ian
>> >
>> > http://www.ianlewis.org/
>>
>> --
>> 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.
>>
>>
>
>
> --
> Felipe 'chronos' Prenholato.
> Linux User nº 405489
> Home page: http://chronosbox.org/blog
> Twitter: http://twitter.com/chronossc
> Use http://1l.to to shrink your urls :)
>
>  --
> 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
> 

Re: dictionary doesn't get properly updated

2010-10-07 Thread Steve Holden
I don't believe so, guess you have to keep looking.

regards
 Steve

On 10/7/2010 11:46 AM, jimgardener wrote:
> I am using the development server..will that cause such a problem?
> jim
> 
>> Are you sure that everything is being run in the same process? If (for
>> example) you are using Apache as a front-end then, as I understand it,
>> there are no guarantees about that.
>>
-- 
Steve Holden   +1 571 484 6266   +1 800 494 3119
PyCon 2011 Atlanta March 9-17   http://us.pycon.org/
See Python Video!   http://python.mirocommunity.org/
Holden Web LLC http://www.holdenweb.com/

-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

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



Problems with MultipleModelChoiceField

2010-10-07 Thread janedenone
Hi,

I try to create an admin form field using both a custom label and the
FilteredSelectMultiple widget:

from django.contrib.admin.widgets import FilteredSelectMultiple

class UserMultipleModelChoiceField(forms.ModelMultipleChoiceField):
def label_from_instance(self, obj):
return "%s (%s)" % (obj.get_full_name(), obj.username)

class UserProfileForm(forms.ModelForm):
supervisors =
UserMultipleModelChoiceField(queryset=User.objects.all(),
required=False, widget=FilteredSelectMultiple)

Django complains that there are too few arguments for the field's
__init__ method, pointing to line 937 of django/forms/models.py
(Django v1.2).

TypeError at /admin/profile/userprofile/220/
__init__() takes at least 3 arguments (1 given)

If I remove the custom widget parameter:

supervisors = UserMultipleModelChoiceField(User.objects.all())

everything looks fine. What am I doing wrong here?

- Jan

-- 
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 1.2.3 flatpage tests fail

2010-10-07 Thread jamstooks
I'm running into a weird error when running the tests for my project.
For some reason the flatpage tests seem to be failing because my login
page is issuing a 404. When I `runserver` this url is available, so I
don't understand the discrepancy. These tests don't fail when I revert
to 1.2.1, however...

I wonder if it has something to do with the fact that I use a
different LOGIN_URL than /accounts/login/?

==
FAIL: A flatpage served by the middleware can require authentication
--
Traceback (most recent call last):
  File "/Users/jamstooks/workspace/my_project/parts/django/django/
contrib/flatpages/tests/middleware.py", line 56, in
test_fallback_authenticated_flatpage
self.assertRedirects(response, '/accounts/login/?next=/sekrit/')
  File "/Users/jamstooks/workspace/my_project/parts/django/django/test/
testcases.py", line 336, in assertRedirects
(path, redirect_response.status_code, target_status_code))
AssertionError: Couldn't retrieve redirection page '/auth/login/':
response code was 404 (expected 200)

-- 
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: dictionary doesn't get properly updated

2010-10-07 Thread jimgardener
I am using the development server..will that cause such a problem?
jim

> Are you sure that everything is being run in the same process? If (for
> example) you are using Apache as a front-end then, as I understand it,
> there are no guarantees about that.
>
> regards
>  Steve
> --
> DjangoCon US 2010 September 7-9http://djangocon.us/

-- 
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: dictionary doesn't get properly updated

2010-10-07 Thread Steve Holden
On 10/7/2010 10:20 AM, jimgardener wrote:
[...]
> 
> When the view add_new_threadobj() is executed a couple of times,this
> is the print output
> adding for the first time,
> tm= 
> TM::before::threads: {}
> TM::  add_thread()::added=threadname1
> TM::after::threads: {'threadname1': daemon)>}
> 
> adding another,
> tm= 
> TM::before::threads: {}
> TM::after::threads: {'threadname2': daemon)>}
> 
> This is what I couldn't make out, the dictionary should now contain 2
> kv pairs.Since the tm instance is the same,the self.threads should
> have  printed  the initially added thread's name and instance.
> Please tell me if I am missing something
> 
Are you sure that everything is being run in the same process? If (for
example) you are using Apache as a front-end then, as I understand it,
there are no guarantees about that.

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
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: Strange 404s

2010-10-07 Thread shacker
On Oct 6, 2:51 pm, Daniel Roseman  wrote:

> Yes, there are all sorts of bots around, and the referrer is easy to
> fake - it's just an HTTP header. I quite frequently get reports with
> referrers that have never even existed on my site.

Would it make sense for the Django 404 logger to check that the
referring URL actually exists before blindly reporting it? That way
admins could choose not to receive false reports, or the report could
be rewritten to say something like "Probably bogus."

Just seems weird that Django is not using its internal awareness of
the site it's reporting on.  Or is this  not worth pursuing?

./s

-- 
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: dictionary doesn't get properly updated

2010-10-07 Thread jimgardener
hi
this is what I wrote
class MySingleton(object):
_instance = None
def __new__(cls, *args, **kwargs):
if not cls._instance:
cls._instance = super(MySingleton, cls).__new__(cls)
return cls._instance

I did  unit test on this ..
def setUp(self):
self.tm=TM()

def test_single_instance(self):
#create two instances of TM, check if they are the same
tm1=TM()
self.assertTrue(self.tm is tm1)
Also,printing the object instance shows same value (ie  )

thanks for the reply
jim


On Oct 7, 8:23 pm, Daniel Roseman  wrote:
> On Oct 7, 3:20 pm, jimgardener  wrote:

> What is the MySingleton superclass? There's nothing in the code you've
> posted that shows that TM is actually a singleton.
> --
> 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.



Localization of decimal fields

2010-10-07 Thread Michel Thadeu Sabchuk
Hi guys, how are you?

I'm using some model forms to edit DateTimeFields and DecimalFields. I
wanted to localize the input/output of these fields. Django 1.2 comes
with a localization method. If I set the USE_L10N setting, it is
supposed to have the forms fields localized.

The DateTimeField works great! The input and output data is set to the
Brazilian locale. The problem is with the DecimalField. The decimal
separator is a comma instead of a dot.

This is correct on the formats.py file for my locale, the problem is
that the DecimalField is not following the formats file if the
USE_L10N config is active.

The "Field" class gets a localize kw argument that defaults to False.
I think it should defaults to the USE_L10N setting.

Am I missing something? Once I don't know if it is my fault, I do not
talk to the developers list, should I?

Thanks!

-- 
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: dictionary doesn't get properly updated

2010-10-07 Thread Daniel Roseman
On Oct 7, 3:20 pm, jimgardener  wrote:
> hi
> In my django view ,I am creating a Thread subclass and adding it to a
> ThreadManager TM to keep in a dictionary with name of thread as key
> and instance as value.I have implemented TM as a singleton and
> verified that only one instance of TM exists .However,when the view
> calls tm.add_mythread() ,I find that the dictionary inside is empty
> and the currently added instance becomes the only member.
>
> I hope the code will make this clear.Please tell me what I did that
> was wrong.I unit tested the TM using Dummy thread class and found that
> the add works correctly .It is only when the view calls tm.add that
> the above behaviour occurs
>
> The view is like this,
>
> def add_new_threadobj(request,page_title,template_name):
>     
>     if request.method=='POST' and form.is_valid():
>         tobj=MyThread(some_post_data..)
>         tm=SingletonTM()
>         print 'tm=',tm  # to check if same instance
>         tm.add_mythread(tobj)
>         tobj.start()
>         
>
> TM is a singleton
>
> class TM(MySingleton):
>     def __init__(self):
>         self.threads={}
>     def add_thread(self,th):
>         if th.name in self.threads.keys():
>             print 'already in'
>         else:
>             print 'TM::before::threads:',self.threads
>             self.threads[th.name]=th
>             print 'TM::',self,'add_thread()::added=%s'%th.name
>             print 'TM::after::threads:',self.threads
>
>     def remove_thread(tname):
>         if tname in self.threads.keys():
>             del self.threads[tname]
>
> When the view add_new_threadobj() is executed a couple of times,this
> is the print output
> adding for the first time,
> tm= 
> TM::before::threads: {}
> TM::  add_thread()::added=threadname1
> TM::after::threads: {'threadname1': daemon)>}
>
> adding another,
> tm= 
> TM::before::threads: {}
> TM::after::threads: {'threadname2': daemon)>}
>
> This is what I couldn't make out, the dictionary should now contain 2
> kv pairs.Since the tm instance is the same,the self.threads should
> have  printed  the initially added thread's name and instance.
> Please tell me if I am missing something
>
> thanks
> jim

What is the MySingleton superclass? There's nothing in the code you've
posted that shows that TM is actually a singleton.
--
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: Django structure and git as VCS

2010-10-07 Thread Piotr Zalewa
Thanks Brian,

It looks like it will manage the git repositories for me. It might be a
good idea, but I think I'll keep it it "custom" build. I (wishful
thinking) don't use Apache, etc.

On 10/07/10 13:56, Brian Bouterse wrote:
> Maybe not an exact answer to your question, but we do something kind of
> similar to what you are describing.  Basically, we have app authors
> (both frontend and backend) work with their app in their own repo and
> publish them into this repository .  Then
> we use Opus  to deploy them onto our
> servers since it is connected to the app repository where their apps are
> published Opus provides a self service deployment interface.  You can
> even test your deployments on our sandbox servers
> .
> 
> Brian
> 
> On Thu, Oct 7, 2010 at 8:25 AM, Piotr Zalewa  > wrote:
> 
>  Hi,
> 
> I'm working on defining the structure of an application
> It will have quite a few apps, with few of them opensourced.
> 
> I was thinking how to make it easier for people involved into the
> project.
> In essence front-end developer should work on one repository only -
> that's also goes quite nicely with app portability and would also help
> if an idea about whitelabelling the project could come to someone's
> mind.
> Other apps will be installed via pip under the virtual environment and
> will be a separate repositories in git.
> Back-end devs then will work each one on the application back-end and on
> the front-end application, to provide some changes to the functionality.
> 
> Basically:
> project - one repository
> front-end app - one repository
> apps - a repository for each one.
> 
> I'd like to implement a slightly modified V.Dressen's model of the
> workflow - in draft explained here:
> https://wiki.mozilla.org/Labs/Jetpack/FlightDeck/Code_Workflow on each
> of the repositories
> 
> Do you think it's best structure?
> And, quite important, will it not look like a mess for an "average"
> developer?
> 
> Piotr
> 
> --
> blog  http://piotr.zalewa.info
> jobs  http://builder.mozillalabs.com, http://jsfiddle.net
> twit  http://twitter.com/zalun
> 
> 
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com
> .
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> 
> 
> 
> 
> -- 
> Brian Bouterse
> ITng Services
> 
> -- 
> 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.


-- 
blog  http://piotr.zalewa.info
jobs  http://webdev.zalewa.info
twit  http://twitter.com/zalun
face  http://facebook.com/zaloon

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



dictionary doesn't get properly updated

2010-10-07 Thread jimgardener
hi
In my django view ,I am creating a Thread subclass and adding it to a
ThreadManager TM to keep in a dictionary with name of thread as key
and instance as value.I have implemented TM as a singleton and
verified that only one instance of TM exists .However,when the view
calls tm.add_mythread() ,I find that the dictionary inside is empty
and the currently added instance becomes the only member.

I hope the code will make this clear.Please tell me what I did that
was wrong.I unit tested the TM using Dummy thread class and found that
the add works correctly .It is only when the view calls tm.add that
the above behaviour occurs

The view is like this,

def add_new_threadobj(request,page_title,template_name):

if request.method=='POST' and form.is_valid():
tobj=MyThread(some_post_data..)
tm=SingletonTM()
print 'tm=',tm  # to check if same instance
tm.add_mythread(tobj)
tobj.start()


TM is a singleton

class TM(MySingleton):
def __init__(self):
self.threads={}
def add_thread(self,th):
if th.name in self.threads.keys():
print 'already in'
else:
print 'TM::before::threads:',self.threads
self.threads[th.name]=th
print 'TM::',self,'add_thread()::added=%s'%th.name
print 'TM::after::threads:',self.threads

def remove_thread(tname):
if tname in self.threads.keys():
del self.threads[tname]


When the view add_new_threadobj() is executed a couple of times,this
is the print output
adding for the first time,
tm= 
TM::before::threads: {}
TM::  add_thread()::added=threadname1
TM::after::threads: {'threadname1':}

adding another,
tm= 
TM::before::threads: {}
TM::after::threads: {'threadname2':}

This is what I couldn't make out, the dictionary should now contain 2
kv pairs.Since the tm instance is the same,the self.threads should
have  printed  the initially added thread's name and instance.
Please tell me if I am missing something

thanks
jim

-- 
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 regroup not working as expected

2010-10-07 Thread Scott Gould
Your .list is in the wrong place:


{% for date in sale_list%}
{{ date.grouper }}

{% for sale in date.list %}
 {{ sale.item }} - {{ sale.qty }} 
{% endfor %}


{% endfor %}


Regards
Scott

On Oct 5, 2:28 pm, Gath  wrote:
> Guys
>
> I have the following view in my django application
>
> def ViewSale( request ):
>     salecur = Sale.objects.filter(user=2).order_by('sale_date')
>     return render_to_response('myapp/sale.html',{'salecur':salecur})
> my template looks like this
>
> {% regroup salecur by sale_date as sale_list %}
>
> 
>     {% for sale_date in sale_list.list %}
>     {{ sale_date.grouper }}
>     
>         {% for sale in sale_list %}
>          {{ sale.item }} - {{ sale.qty }} 
>         {% endfor %}
>     
>     
>     {% endfor %}
> 
>
> When i render the page i get the grouper sale_date.grouper printed,
> but {{ sale.item }} and {{ sale.qty }} in the inner loop shows
> nothing! Blank.
>
> What am i missing?
>
> Gath

-- 
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 updated is the online version of the Django Book?

2010-10-07 Thread Shawn Milochik
Is there anything specific you're concerned about? 

Almost everything is applicable to the latest version. If you're not using 
trunk, then just being familiar with the 1.2 release notes will be enough to 
let you know if what you're reading is deprecated. Most Django books out there 
haven't ben updated for 1.2, but I wouldn't hesitate to use them as a resource. 
 Django is a huge project; you're not going to find that a significant amount 
has changed in a point release.

Django 1.2 Release Notes:
http://docs.djangoproject.com/en/dev/releases/1.2/

Shawn


-- 
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 updated is the online version of the Django Book?

2010-10-07 Thread MrMuffin
The django book found here :

http://www.djangobook.com/en/2.0/

is great, but is it being kept up to date with the current version of
django?

Just wondering.

-- 
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 structure and git as VCS

2010-10-07 Thread Brian Bouterse
Maybe not an exact answer to your question, but we do something kind of
similar to what you are describing.  Basically, we have app authors (both
frontend and backend) work with their app in their own repo and publish them
into this repository .  Then we use
Opusto deploy them onto our servers
since it is connected to the app repository
where their apps are published Opus provides a self service deployment
interface.  You can even test your deployments on our sandbox
servers
.

Brian

On Thu, Oct 7, 2010 at 8:25 AM, Piotr Zalewa  wrote:

>  Hi,
>
> I'm working on defining the structure of an application
> It will have quite a few apps, with few of them opensourced.
>
> I was thinking how to make it easier for people involved into the project.
> In essence front-end developer should work on one repository only -
> that's also goes quite nicely with app portability and would also help
> if an idea about whitelabelling the project could come to someone's mind.
> Other apps will be installed via pip under the virtual environment and
> will be a separate repositories in git.
> Back-end devs then will work each one on the application back-end and on
> the front-end application, to provide some changes to the functionality.
>
> Basically:
> project - one repository
> front-end app - one repository
> apps - a repository for each one.
>
> I'd like to implement a slightly modified V.Dressen's model of the
> workflow - in draft explained here:
> https://wiki.mozilla.org/Labs/Jetpack/FlightDeck/Code_Workflow on each
> of the repositories
>
> Do you think it's best structure?
> And, quite important, will it not look like a mess for an "average"
> developer?
>
> Piotr
>
> --
> blog  http://piotr.zalewa.info
> jobs  http://builder.mozillalabs.com, http://jsfiddle.net
> twit  http://twitter.com/zalun
>
>
> --
> 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.
>
>


-- 
Brian Bouterse
ITng Services

-- 
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 Registration password reset problem

2010-10-07 Thread Felipe Prenholato
Actually auth urls is 'appended' to urls in default backend (and should be
added to your own backend if you create one).

Take a look at this line: http://1l.to/bf1/ ... so you don't need to add it
(again) to your urls.

I don't have this error with password_reset_complete view , but I'm using my
clone of original repo with some useful patches (additions). What is version
that you are using?

2010/10/7 Joel Klabo 

> Thanks for checking it out, this is the way it's set up:
> http://dpaste.org/e6Ra/
>
> it looks like it's using registration.auth_urls to direct to the
> django.contrib.auth.urls ? I don't understand why
> registration.auth_urls would exist...
>
> On Oct 6, 6:32 pm, Ian Lewis  wrote:
> > I just took a cursory look at this but did you make sure to add
> > something like the following to your urlpatterns in urls.py?
> >
> > urlpatterns=patterns('',
> > ...
> > (r'^accounts/', include('django.contrib.auth.urls')),
> > ...
> > )
> >
> >
> >
> >
> >
> > On Thu, Oct 7, 2010 at 1:29 AM, Joel Klabo  wrote:
> > > So now I am redirecting to the named url in the URL conf. That is now
> > > giving me the error: The included urlconf registration.auth_urls
> > > doesn't have any patterns in it ...http://dpaste.org/OOw5/any ideas
> > > would be greatly appreciated
> >
> > > On Oct 5, 5:56 pm, Joel Klabo  wrote:
> > >> Ok, so I'm pretty sure this has to do with the fact that the
> > >> post_reset_redirect argument defaults to the
> > >> django.contrib.auth.views.password_reset_done if no
> > >> post_reset_redirect is passed to the view. I am using django-
> > >> registration and it seems like there would be a better way to deal
> > >> with this... There is something I'm missing. If anyone has used this
> > >> and gotten it to work I would be grateful to hear about it. All the
> > >> other parts of the registration system work which makes me think this
> > >> has something to do with the fact that it is reverting back to the
> > >> django.contrib views and now using the ones that come with django-
> > >> registration... Here is the view where the error first pops up, this
> > >> is where post_reset_redirect is as well:http://dpaste.org/gatU/
> >
> > >> Thanks for your time
> >
> > >> On Oct 5, 1:56 pm, Steve Holden  wrote:
> >
> > >> > On 10/5/2010 4:45 PM,JoelKlabowrote:> Need to bump this, sorry. I
> don't get it.
> >
> > >> > > On Oct 5, 1:04 pm,JoelKlabo wrote:
> > >> > >> This is the error and location of the problem:
> http://gist.github.com/612210,
> > >> > >> I can't see what it's looking for. It seems like I could hard
> code the
> > >> > >> arguments it wants into the reverse() but that doesn't seem like
> the
> > >> > >> correct way to do it. Any advice?
> >
> > >> > I can quite see how 41 minutes would appear to be an infinity to
> someone
> > >> > who is wanting the answer to a problem. Please remember, though,
> that
> > >> > people who post on this list aren't paid to do so, and mostly have
> > >> > full-time jobs.
> >
> > >> > So a little patience will make it more likely people will help you.
> >
> > >> > regards
> > >> >  Steve
> > >> > --
> > >> > DjangoCon US 2010 September 7-9http://djangocon.us/
> >
> > > --
> > > 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 athttp://
> groups.google.com/group/django-users?hl=en.
> >
> > --
> > Ian
> >
> > http://www.ianlewis.org/
>
> --
> 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.
>
>


-- 
Felipe 'chronos' Prenholato.
Linux User nº 405489
Home page: http://chronosbox.org/blog
Twitter: http://twitter.com/chronossc
Use http://1l.to to shrink your urls :)

-- 
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 structure and git as VCS

2010-10-07 Thread Piotr Zalewa
 Hi,

I'm working on defining the structure of an application
It will have quite a few apps, with few of them opensourced.

I was thinking how to make it easier for people involved into the project.
In essence front-end developer should work on one repository only -
that's also goes quite nicely with app portability and would also help
if an idea about whitelabelling the project could come to someone's mind.
Other apps will be installed via pip under the virtual environment and
will be a separate repositories in git.
Back-end devs then will work each one on the application back-end and on
the front-end application, to provide some changes to the functionality.

Basically:
project - one repository
front-end app - one repository
apps - a repository for each one.

I'd like to implement a slightly modified V.Dressen's model of the
workflow - in draft explained here:
https://wiki.mozilla.org/Labs/Jetpack/FlightDeck/Code_Workflow on each
of the repositories

Do you think it's best structure?
And, quite important, will it not look like a mess for an "average"
developer?

Piotr

-- 
blog  http://piotr.zalewa.info
jobs  http://builder.mozillalabs.com, http://jsfiddle.net
twit  http://twitter.com/zalun


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



Inline editing of related models in tree-like fashion

2010-10-07 Thread Neo
I'm stuck with the inline Tree-like-eiditing of related models on same
page.
I've got three models, A, B and C.

Class A

Class B
fb = foreignkey(A)

Class C
fc = foreignkey(B)

In admin.py I'm doing something like

AdminA
inlines = [inlineB]

AdminB
inlines = [inlineC]

I want that when I edit/add model A, I should be able to add ModelB
inline, and add Model B's related Model C entries. I was trying out
inlineformsets, but can't find out how to use them for my purpose.
Moreover, I found http://stackoverflow.com/questions/702637/
django-admin-inline-inlines-or-three-model-editing-at-once">this old
discussion on same problem. But again, since I'm new to Django, I
don't know how to make it work.

-- 
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: Possible backwards incompatibility introduced by change 12950 (in upgrade from 1.1.1 to 1.1.2)

2010-10-07 Thread Steve Holden
On 10/7/2010 3:24 AM, Jyrki Pulliainen wrote:
>> So -- my original analysis still stands -- albeit for slightly more
>> > complex reasons. The issue here is that your code was previously in
>> > error, and now we're a little more vigilant about reporting the
>> > potential problem.
> Now that you've explained the problem a bit more deeply I think I have
> to agree with you that my software was faulty. And I so hoped that the
> flaws of my software could be accounted either by the flaws in the
> framework or by the flaws in the programming language itself ;)
> 
> - Jyrki

Don't we all, sometimes?

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

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



import error

2010-10-07 Thread shalini
i am bigner to django my appache sever is running suceesfully and
python manage.py runserver is running sucessfully but i have import
error can somebody help me i had attached error and conf file belo
To configure Django with mod_python I added this in httpd.conf file
---



SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE settings.py
PythonOption django.root /flip
PythonDebug On
PythonPath "['C:/flip'] + sys.path"

Occured error while using url http://localhost/fllyp/

MOD_PYTHON ERROR

ProcessId:  844
Interpreter:'192.168.1.116'

ServerName: '192.168.1.116'
DocumentRoot:   'C:/Program Files/Apache Software Foundation/Apache2.2/
htdocs'

URI:'/fllyp/'
Location:   '/fllyp/'
Directory:  None
Filename:   'C:/Program Files/Apache Software Foundation/Apache2.2/
htdocs/fllyp/'
PathInfo:   ''

Phase:  'PythonHandler'
Handler:'django.core.handlers.modpython'

Traceback (most recent call last):

  File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

  File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
1229, in _process_target
result = _execute_target(config, req, object, arg)

  File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
1128, in _execute_target
result = object(arg)

  File "C:\Python25\Lib\site-packages\django\core\handlers
\modpython.py", line 228, in handler
return ModPythonHandler()(req)

  File "C:\Python25\Lib\site-packages\django\core\handlers
\modpython.py", line 191, in __call__
self.load_middleware()

  File "C:\Python25\Lib\site-packages\django\core\handlers\base.py",
line 33, in load_middleware
for middleware_path in settings.MIDDLEWARE_CLASSES:

  File "C:\Python25\Lib\site-packages\django\utils\functional.py",
line 276, in __getattr__
self._setup()

  File "C:\Python25\Lib\site-packages\django\conf\__init__.py", line
40, in _setup
self._wrapped = Settings(settings_module)

  File "C:\Python25\Lib\site-packages\django\conf\__init__.py", line
75, in __init__
raise ImportError("Could not import settings '%s' (Is it on
sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE,
e))

ImportError: Could not import settings 'settings.py' (Is it on
sys.path? Does it have syntax errors?): No module named settings.py

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



import error

2010-10-07 Thread sami nathan
Occured error while using url http://localhost/fllyp/

MOD_PYTHON ERROR

ProcessId:  844
Interpreter:'192.168.1.116'

ServerName: '192.168.1.116'
DocumentRoot:   'C:/Program Files/Apache Software Foundation/Apache2.2/
htdocs'

URI:'/fllyp/'
Location:   '/fllyp/'
Directory:  None
Filename:   'C:/Program Files/Apache Software Foundation/Apache2.2/
htdocs/fllyp/'
PathInfo:   ''

Phase:  'PythonHandler'
Handler:'django.core.handlers.modpython'

Traceback (most recent call last):

  File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

  File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
1229, in _process_target
result = _execute_target(config, req, object, arg)

  File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
1128, in _execute_target
result = object(arg)

  File "C:\Python25\Lib\site-packages\django\core\handlers
\modpython.py", line 228, in handler
return ModPythonHandler()(req)

  File "C:\Python25\Lib\site-packages\django\core\handlers
\modpython.py", line 191, in __call__
self.load_middleware()

  File "C:\Python25\Lib\site-packages\django\core\handlers\base.py",
line 33, in load_middleware
for middleware_path in settings.MIDDLEWARE_CLASSES:

  File "C:\Python25\Lib\site-packages\django\utils\functional.py",
line 276, in __getattr__
self._setup()

  File "C:\Python25\Lib\site-packages\django\conf\__init__.py", line
40, in _setup
self._wrapped = Settings(settings_module)

  File "C:\Python25\Lib\site-packages\django\conf\__init__.py", line
75, in __init__
raise ImportError("Could not import settings '%s' (Is it on
sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE,
e))

ImportError: Could not import settings 'settings.py' (Is it on
sys.path? Does it have syntax errors?): No module named
settings.py-
To configure Django with mod_python I added this in httpd.conf file

SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE settings.py
PythonOption django.root /mysite
PythonDebug On
PythonPath "['C:/mysite'] + sys.path"

what shoul i do now pls  help me my project file is in C drive at this
location only i am not having file at C:/Program Files/Apache2.2/
htdocs/mysite'

-- 
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 use django session outside of the view

2010-10-07 Thread andy
>>> from django.contrib.sessions.backends.db import SessionStore
>>> s = SessionStore(session_key='2b1189a188b44ad18c35e113ac6ceead')
>>> s['last_login'] = datetime.datetime(2005, 8, 20, 13, 35, 10)
>>> s['last_login']
datetime.datetime(2005, 8, 20, 13, 35, 0)
>>> s.save()

The above shows how to use django outside of the view but I still am
not full clear on the 32-character session_key.

Assuming that I generate the key do I need to worry about using
duplicated values for the session_key and if so what is the best way
to avoid duplications in django?


Kimani

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



unittest fixture doesn't load from TestCase

2010-10-07 Thread jimgardener
hi
I have a 'sample.json' that has some data I use for unittesting my
app.I have put it in fixtures folder of myapp alongside
'initial_data.json'.In my TestCase subclass,I put it as,

class MyTC(TestCase):
fixtures=['sample.json']
def setUp(self):
...


However,when I run the unittest ,only the data in 'initial_data.json'
gets installed.
I tried from the command line
python manage.py loaddata sample.json

and the data gets installed.But ,I need the unittest to install it in
the testdb..,not manually in the main db.
Can someone tell me why this is happening?
thanks
jim

-- 
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: unique_together to bind three fields

2010-10-07 Thread Tom Evans
On Thu, Oct 7, 2010 at 4:54 AM, meenakshi  wrote:
> Hi,
>   I am new to Django and Python and have been working through the
> tutorial.  I would like to modify the polls app in the tutorial such
> that I can track individual users who vote in a poll, keep a record of
> their choice, and not allow any user to vote more than once in any
> given poll.
>   Briefly, there are many polls, each poll being linked to several
> choices.  Each user can vote in many polls, but is allowed to vote
> only once in each individual poll.  Whats the best way to enforce
> this?
> I tried to enforce this by using the unique_together feature to bind a
> specific user, poll, choice combination together (within the Choice
> class). It didnt work.  Here is the code I tried:
>
> from django.db import models
> import datetime
>
> class User(models.Model):
>    name = models.CharField(max_length=100)
>    email = models.EmailField()
>    def __unicode__(self):
>        return self.name
>
> class Poll(models.Model):
>    question = models.CharField(max_length=200)
>    pub_date = models.DateTimeField('date published')
>    def __unicode__(self):
>        return self.question
>
> class Choice(models.Model):
>    poll = models.ForeignKey(Poll)
>    user = models.ManyToManyField(User)
>    choice = models.CharField(max_length=200)
>    votes = models.IntegerField()
>
>    def __unicode__(self):
>        return self.choice
>
>    class Meta:
>        unique_together = ("poll", "user", "choice")
>
>
> My error message:
> Error: One or more models did not validate:
> polls.choice: "unique_together" refers to user. ManyToManyFields are
> not supported in unique_together.
> polls.choice: "unique_together" refers to user. This is not in the
> same model as the unique_together statement.
>
> I would appreciate any suggestions/corrections,
>
> Thanks,
> Meenakshi
>

Make your model heirarchy such that adding a vote is modelled by the
creation of a single row in a single table, and the creation of that
row is constrained by the DB to respect your conditions (1 vote per
user per poll):

class User(models.Model):
  pass

class Poll(models.Model):
  pass

class Choice(models.Model):
  poll = models.ForeignKey(Poll)

class UserPollChoice(models.Model):
  poll = models.ForeignKey(Poll)
  user = models.ForeignKey(User)
  choice = models.ForeignKey(Choice)

  class Meta:
unique_together = ( 'poll', 'user', )

You will have to use aggregates to get the scores of the poll out with
this scenario though. Something like this would work:
  from django.db.models import Count
  poll.choice_set.annotate(num_votes=Count('userpollchoice'))

Cheers

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.



Django facebook group

2010-10-07 Thread Lakshman Prasad
Hi,

I just created a django facebook group:
http://www.facebook.com/home.php?sk=group_114422875284562

Those interested may join.

PS: I know it doesn't matter to some people. If it doesn't matter, it
shouldn't matter even to complain, I think :)

-- 
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: Possible backwards incompatibility introduced by change 12950 (in upgrade from 1.1.1 to 1.1.2)

2010-10-07 Thread Jyrki Pulliainen
On Oct 6, 5:12 pm, Russell Keith-Magee 
wrote:
> Hi Jyrki,
>
> My apologies for not responding -- your message ran off the bottom of my 
> inbox.

No prob, thanks for the response!

> I've had a look at your sample code; the problem is that you're
> importing the app1 module in two different ways. As a result of a
> quirk of Python's module importer, 'r12950.app1.models' and
> 'app1.models' are different modules. You are importing modules as
> "r12950.app1", but your INSTALLED_APPS lists "app1". This means that
> app1.models is actually getting imported and registered twice, and
> depending on exactly what you are doing and the order in which you do
> it, some of those registrations may be incomplete or corrupted.
>
> Now, you may not have observed any effects of this corruption --
> simple "load model, write to database" operations should still be fine
> --  but that doesn't change the fact that model startup hasn't been
> completed successfully.
>
> If you change either your importing style, or your INSTALLED_APPS
> entry, the problem will go away. The problem will also go away if you
> move the admin registration out of models.py, and into admin.py
> (Strictly, using admin.py just masks the problem, but moving to using
> admin.py is good practice anyway).

We actually used fully qualified module paths in our production
environment, they just got accidentally left out from my example.
Anyhow, the solution there was to swap stuff to admin.py, reorganize
imports and move some parts of code to "dummy" modules to avoid
circular imports.

> So -- my original analysis still stands -- albeit for slightly more
> complex reasons. The issue here is that your code was previously in
> error, and now we're a little more vigilant about reporting the
> potential problem.

Now that you've explained the problem a bit more deeply I think I have
to agree with you that my software was faulty. And I so hoped that the
flaws of my software could be accounted either by the flaws in the
framework or by the flaws in the programming language itself ;)

- Jyrki

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