Re: filtering the join table in a many-to-many relationship

2009-06-01 Thread Sam Chuparkoff
On Mon, 2009-06-01 at 16:01 -0700, Ben Adida wrote: > I have a ManyToMany self relationship with a custom join table (I > don't think the self-reference is important to the problem, but it > might be, so I'm mentioning it): > > class Documents > related_docs = models.ManyToManyField("self", > t

Re: form adding

2009-06-01 Thread Sam Chuparkoff
On Sun, 2009-05-31 at 23:45 -0700, samira wrote: > I exactly do like when I use Django 0.96. > for example this: > > Class AccountAdd(forms.Form): > accountNo = forms.IntegerField(min_value=1, required=True, > widget=forms.TextInput(attrs={'size':'10'})) > > def __init__(self, data=None,

Re: URL conf question .....

2009-05-26 Thread Sam Chuparkoff
On May 26, 10:21 pm, tekion wrote: > But what if > you do not have a common prefix, would it still work?  Thanks. Sure, here is the reference: http://docs.djangoproject.com/en/dev/topics/http/urls/#multiple-view-prefixes sdc --~--~-~--~~~---~--~~ You received t

Re: initial data for formset

2009-05-26 Thread Sam Chuparkoff
On Tue, 2009-05-26 at 17:27 -0700, adrian wrote: > This code creates a formset and populates fields with copies of > date and start_time. > The problem is, if num_events is X then it creates X forms but it only > populates X-1 (it leaves the last one uninitialized). My question > is why, and h

Re: abstract model with save method

2009-05-25 Thread Sam Chuparkoff
On Mon, 2009-05-25 at 09:42 -0700, Viktor wrote: > super(self.__class__, self).save(force_insert, force_update) This line at least is bad. You want: super(AcceptedRoleAbstract, self).save(force_insert, force_update) Do post again as per Karen's request if you're still having trouble.

Re: Problems with excluding user-field from form

2009-05-24 Thread Sam Chuparkoff
On May 24, 5:49 pm, Martin wrote: > Hi, > > I'm struggling with a simple edit-form. My model has a user-FK and > authenticated users can 'create' objects of this model with a form. > Pretty simple. They should be able to edit these objects later, but of > course not change the value of the user-f

Re: running django with wsgi over apache

2009-05-24 Thread Sam Chuparkoff
On Sun, 2009-05-24 at 13:27 -0300, Gabriel wrote: > The problem was with one of the applications 'profile'. It seems it > already exists somewhere. Correct, there is a standard python module called profile. $ python Python 2.6.2 (r262:71600, May 7 2009, 21:32:12) [GCC 4.1.2 (Gentoo 4.1.2 p1.0.

Re: running django with wsgi over apache

2009-05-23 Thread Sam Chuparkoff
On Sat, 2009-05-23 at 16:55 -0300, Gabriel wrote: > I can make django work under wsgi. > > I configured apache to run wsgi and the test script works. > > This is the vhost conf: > > > ServerName test.banshee.lnx > DocumentRoot "/home/www/python" > ErrorLog /home/gabriel/pywks/test/

Re: please provide a html download of the doc

2009-05-23 Thread Sam Chuparkoff
Email me privately and I will send you the html docs. sdc --~--~-~--~~~---~--~~ 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

Re: adding errors to forms

2009-05-23 Thread Sam Chuparkoff
The reference you want is here: http://docs.djangoproject.com/en/dev/ref/forms/validation/#form-subclasses-and-modifying-field-errors Note particularly those first few paragraphs under 'Form subclasses and modifying field errors', and examples below. sdc --~--~-~--~~~--

Re: abstract and isinstance()

2009-05-22 Thread Sam Chuparkoff
On Fri, 2009-05-22 at 10:36 -0700, shadfc wrote: > I've got a few classes that inherit from an abstract class. At some > point, I want to check and make sure that an object is an instance of > the base class, but this always seems to fail. I've posted what I know > and what I think may be relevan

Re: Cannot reload a Django models module within a "manage.py shell" session

2009-05-21 Thread Sam Chuparkoff
Reloading your models module is not going to give you different model classes, because django tracks these classes by name. This is why the tutorial instructs you to start a new shell after you've modified your models. sdc --~--~-~--~~~---~--~~ You received this

Re: Ignoring Definite/Indefinite Articles when Sorting

2009-05-21 Thread Sam Chuparkoff
On May 21, 10:10 pm, Darryl Ross wrote: > I have searched around but not really found an answer to this. For a > project I am working on the customer wants a list of publications to be > sorted alphabetically, but ignoring the definite/indefinite articles > "the/a/an". You could create a new fie

Re: Installing django

2009-05-20 Thread Sam Chuparkoff
On Tue, 2009-05-19 at 11:06 -0700, LeonTheCleaner wrote: > Hi, > > I am trying to install django by using this: > > http://wiki.dreamhost.com/Django > > but there are a few things I don't understand. I see you asked another question about the best django host, and got a lot of replies to that

Re: MultiValueField with required=True problem

2009-05-20 Thread Sam Chuparkoff
On Wed, 2009-05-20 at 07:09 -0700, [CPR]-AL.exe wrote: > So, what is the best way to throw a ValidationError only if None of > values a entered in subclassed field? I don't know if you understood my post or read the code for MultiValueField. MultiValueField is designed to check for empty values a

Re: User attribute access from within profile model

2009-05-19 Thread Sam Chuparkoff
On Tue, 2009-05-19 at 12:12 -0700, neridaj wrote: > There are attributes for first_name and last_name, why wouldn't > user.first_name work? I'd expect an AttributeError is you are accessing an attribute that doesn't exist. Thus my assumption. sdc --~--~-~--~~~---~-

Re: MultiValueField with required=True problem

2009-05-19 Thread Sam Chuparkoff
On Mon, 2009-05-18 at 10:13 -0700, [CPR]-AL.exe wrote: > I've created a field+widget set that i use to render a number of > checkboxes and a TextInput with comma-separated values. > > The problem is, when i set required = True, I get a ValidationError if > only checkboxes are selected (but i don'

Re: User attribute access from within profile model

2009-05-18 Thread Sam Chuparkoff
On Mon, 2009-05-18 at 17:12 -0700, neri...@gmail.com wrote: > I have an Employee profile associated with Users who are staff, how do > I return the associated user attributes from within the profile model > i.e., 'full_name' from Users? Anytime I try to access the User > attributes from within the

Re: RequiredIfOtherFieldEquals error

2009-05-18 Thread Sam Chuparkoff
On Mon, 2009-05-18 at 01:03 -0700, Christian Martín Reinhold wrote: > Hello I am kind of new with django and I am trying to adapt a piece of > code to the 1.0 version. > > datetime = models.DateTimeField(blank=True, null=True, > validator_list=[RequiredIfOtherFieldEquals('status', '2',("A

Re: Does a django social sharing widget app exist?

2009-05-18 Thread Sam Chuparkoff
On Sun, 2009-05-17 at 22:47 -0700, Aaron Maxwell wrote: > If this exists, google doesn't seem to know about it. I haven't looked at this, but here's a link: http://tylerlesmann.com/2009/mar/09/announcing-django-sociable/ sdc --~--~-~--~~~---~--~~ You received

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Sam Chuparkoff
On Sun, 2009-05-17 at 20:01 -0700, Bobby Roberts wrote: > yeah i'm still lost... You don't need to change your form, just use form.cleaned_data in your view. Same example, a few more lines: >>> # our form ... >>> from django import forms >>> from django.contrib.auth.models import User >>> >>>

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Sam Chuparkoff
On Sun, 2009-05-17 at 18:43 -0700, Bobby Roberts wrote: > in my view i have this: > > > if request.method=='POST': > form=FrmIdMessage(request.POST) > if form.is_valid(): #process valid form here > assert False, request.POST.get('posted_to','') > [snip] You sho

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Sam Chuparkoff
On Sun, 2009-05-17 at 10:41 -0700, Bobby Roberts wrote: > from django import forms > from django.contrib.auth.models import User > > # pull a recordset of the users > userdata = User.objects.all() > > def myuserlist(self): > for i in userdata: > self[i.id]='%s %s' %(i.first_name,i.la

Re: quickest way to print template names

2009-05-17 Thread Sam Chuparkoff
On Sat, 2009-05-16 at 23:37 -0500, Alex Gaynor wrote: > There isn't a better solution, a Template doesn't store the file it > was rendered from (especially since that doesn't make sense for all > template loaders, such as if you render a template from a string), nor > does the context inherently h

Re: Formatting a Foreign key combo box in admin change form

2009-05-16 Thread Sam Chuparkoff
On Fri, 2009-05-15 at 15:12 -0700, nih wrote: > in the admin change form the select box only shows name.username (eg > nih) > is it possible to show the full name in the select box You are looking to override label_from_instance(). See here http://docs.djangoproject.com/en/1.0/ref/forms/fields/#

Re: User profile get_profile() error

2009-05-15 Thread Sam Chuparkoff
On Fri, 2009-05-15 at 19:53 -0400, Joshua Williams wrote: > When trying to access a user defined profile, using get_profile, I > am > getting an error when accessing the profile for a user. Just so I > have my bases covered, here is my model class: > > class UserDetail(models.Model): >

Re: Problem debugging with pdb

2009-05-15 Thread Sam Chuparkoff
On Fri, 2009-05-15 at 14:00 -0700, Joshua Russo wrote: > I can't seem to get pdb to stop at my break points for a page request. > I start it like so: > > (from the directory containing manage.py) python -m pdb manage.py > runserver Have you tried this? python -m pdb manage.py runserver --norelo

Re: temporarily log in as another user

2009-05-14 Thread Sam Chuparkoff
On Wed, 2009-05-13 at 05:21 -0700, Dave Brueck wrote: > Has anyone in this group implemented any sort of login-as-another-user > functionality with Django? I implemented "sticky superuser logins" about a year ago (the last time I worked with django until now), so I can attest it is a neat trick,

Re: Design Question

2009-05-11 Thread Sam Chuparkoff
On Mon, 2009-05-11 at 17:31 -0700, Glen Jarvis wrote: > Both forms have a 'name' attribute. And, both forms are in a template > together. (I mean that both form instances are created for the > specific instance of the model in question, and are displayed together > (very interleaved) in a template

Re: removing fields in modelformset

2009-05-11 Thread Sam Chuparkoff
On Mon, 2009-05-11 at 10:59 -0700, eric.frederich wrote: > Hmm, thats almost what I need. I guess I didn't fully explain what I > need. > I do need to limit the number of fields that are shown, but I also > need to make some of them view only. I don't think this "view only" feature exists. Googl

Re: removing fields in modelformset

2009-05-11 Thread Sam Chuparkoff
On Mon, 2009-05-11 at 07:55 -0700, eric.frederich wrote: > Hello, > > I need to set up a view for administrators of an application that I am > writing where they can edit a subset of fields on a particular model. > It was pretty simple... > > EnrollmentFormSet = modelformset_factory(Enrollment,