Re: Table or view does not exist - Oracle

2009-04-23 Thread jeffhg58


I am using pretty much the same setup you have except I use cx_oracle 5.0.1. 
Have you narrowed down 

what tables are missing? 
- Original Message - 
From: "Petry"  
To: "Django users"  
Sent: Thursday, April 23, 2009 6:57:45 AM GMT -06:00 US/Canada Central 
Subject: Re: Table or view does not exist - Oracle 


I'm using Python 2.6.2, cx_oracle 4.4.1 and django 1.1 beta 1 
SVN-10620 

anyone know what happend?? 

On 22 abr, 17:48, Petry  wrote: 
> I have the same problem. 
> 
> I ran the command "python manage.py syncdb" and the tables were 
> created. 
> 
> In the shell I run: 
> from django.contrib.auth.models import * 
> Permission.objects.all () 
> 
> and returned the objects 
> 
> but when I tried to use the runserver 
> 
> the error appears: Databaseerror: ORA-00942: table or view does not 
> exist 
> 
> On 24 fev, 11:10, Brandon Taylor  wrote: 
> 
> > Hi Karen, 
> 
> > Yes, that is exactly what I'm seeing. 
> 
> > On Feb 23, 6:02 pm, Karen Tracey  wrote: 
> 
> > > On Mon, Feb 23, 2009 at 10:15 AM, Brandon Taylor 
> > > wrote: 
> 
> > > > Hi everyone, 
> 
> > > > Still fighting with Oracle :( 
> 
> > > > Quick recap...my setup is: 
> 
> > > > OS X 10.5.6 (Intel), cx_Oracle-5.0.1 (Intel), instantclient_10_2, 
> > > > Django Trunk, Python 2.6.1 
> 
> > > > If I run Django in shell, I am able to connect to Oracle, retrieve 
> > > > objects via the ORM, etc. However, when I executing a view action 
> > > > while running Django using the built-in server, I get the error: 
> 
> > > > DatabaseError:ORA-00942: table or view does not exist 
> 
> > > > My Oracle person has confirmed that the username I'm using has 
> > > > permissions to view/create/drop/update. 
> 
> > > > Why would it work from the shell, using all of the same connection 
> > > > information from settings.py and fail from the built-in server? I 
> > > > don't know what else to try. 
> 
> > > Just to be clear -- you're seeing a difference in the ability to run (the 
> > > exact same) queries against Oracle when you use: 
> 
> > > python manage.py shell 
> 
> > > versus 
> 
> > > python manage.py runserver 
> 
> > > ? 
> 
> > > And you start both of those from the exact same command shell 
> > > environment? 
> 
> > > Karen 


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



Re: Running django test suite

2009-04-20 Thread jeffhg58


Regarding failures 1 and 2 in the error output for the django test suite which 
are listed here 

http://dpaste.com/34864/ . I recently ran the tests on svn revision 10604. 



Failure 1 - The error was referred to in ticket 
http://code.djangoproject.com/ticket/6802 . 

Should this ticket be reopened? 



Failure 2- Any recommendations on how to resolve the windows error? 



Thanks, 

Jeff 
- Original Message - 
From: jeffh...@comcast.net 
To: django-users@googlegroups.com 
Sent: Friday, April 17, 2009 1:19:05 PM GMT -06:00 US/Canada Central 
Subject: Re: Running django test suite 




Karen, 



Thanks so much for the explanation! Actually, I was incorrect I used the 
development version via SVN revision 10369. I just downloaded the latest 
version today. Also, I missed putting in the first error, a cut and paste 
problem. I included all the 3 errors are included here 



http://dpaste.com/34864/ 



Regarding failure 1: 



I am running Python 2.6 on Windows XP  using sqlite3. I do not believe I have 
anything running simultaneously trying to open the files while the test is 
trying to delete the files. I just downloaded the latest version today which is 
revision 10581 and still get the same error. 



Regarding the first error in the link above which was not included originally. 
I searched the tickets regarding this error. I found the following ticket which 
states that it was fixed 



http://code.djangoproject.com/ticket/6802 



Thanks, 

Jeff 










- Original Message - 
From: "Karen Tracey"  
To: django-users@googlegroups.com 
Sent: Friday, April 17, 2009 10:46:27 AM GMT -06:00 US/Canada Central 
Subject: Re: Running django test suite 

On Thu, Apr 16, 2009 at 1:26 PM, jeffhg58 < jeffh...@comcast.net > wrote: 




I recently installed django 1.1 beta and I needed to run the django 
test suite. So, under the tests directory I executed runtests.py. I 
received some errors when trying to execute all the tests. I was 
expected that all the tests would have passed. I am thinking it might 
be with my setup. Here are the errors I encountered. 

http://dpaste.com/34433/ 


First, I'm curious how you got tests for 1.1 beta? The tests weren't included 
in the tarfile until quite recently (post 1.1 beta, I believe, since my 
downloaded un-tarred copy of 1.1 does not have a tests directory).  If you are 
getting tests out of svn you just need to be careful that you are running a 
version that matches the code you are using -- if you use more-recent tests 
against backlevel code you are liable to hit test failures resulting from 
bugfixes where the bugfix changeset has included a test that fails prior to the 
code fix.  I don't believe that is what you are seeing here though. 

Second, the failure summary you point to lists 3 failure but I only see details 
of 2 failures listed above.  Is that output complete? 

As for the failures: 

1 - The Windows error on attempting to delete a file is something we've seen 
before, and fixed (though I'm not sure in this particular place).  I cannot 
recreate the error on my Windows box with Python 2.6 and the beta 1.1 (nor 
current trunk) level code.  What exact level of Python 2.6 are you running? -- 
the specifics of this error have been dependent on Python level in the past.  
Are you running anything on this machine (like a virus scanner) that may be 
opening these files created by the tests while the test itself is 
simultaneously trying to delete them?  There was also at least one fix made 
after 1.1 beta that cleaned up some issues with temp files on Windows getting 
closed and deleted properly, so I'd be interested to know if you tried running 
with trunk level code if you still see this error. 

2 - I've not seen the markup test error before but it looks like it may be 
textile-level dependent.  I can recreate the problem with textile 2.1.3 (on 
Windows, where I previously had no textile installed) but not 2.0.10 (what I 
happen to have on Linux).  The test may be overly sensitive to slight changes 
in what textile produces.  I was going to say please open a ticket but upon 
searching I see this has already been reported: 

http://code.djangoproject.com/ticket/10843 

On the general question as to whether all the test should pass -- in an ideal 
world, yes, but we are not quite there yet.  There are OS and database backend 
issues that cause some known test failures.  Linux/sqlite generally runs 
cleanly, Windows/sqlite may, but it is dependent on Python level (Python 2.5 on 
Windows has a particularly problematic sqlite level that it shipped with).  I 
generally also see clean runs using MySQL/MyISAM (both Linux and Windows) but 
MySQL/InnoDB has many failures resulting from InnoDB's inability to do deferred 
constraint checking (there's a ticket open on that).  Some levels of PostgreSQL 
show failures with the admin_views test (again, there's a ticket open on it).  
Mos

Re: Running django test suite

2009-04-17 Thread jeffhg58


Karen, 



Thanks so much for the explanation! Actually, I was incorrect I used the 
development version via SVN revision 10369. I just downloaded the latest 
version today. Also, I missed putting in the first error, a cut and paste 
problem. I included all the 3 errors are included here 



http://dpaste.com/34864/ 



Regarding failure 1: 



I am running Python 2.6 on Windows XP  using sqlite3. I do not believe I have 
anything running simultaneously trying to open the files while the test is 
trying to delete the files. I just downloaded the latest version today which is 
revision 10581 and still get the same error. 



Regarding the first error in the link above which was not included originally. 
I searched the tickets regarding this error. I found the following ticket which 
states that it was fixed 



http://code.djangoproject.com/ticket/6802 



Thanks, 

Jeff 










- Original Message - 
From: "Karen Tracey"  
To: django-users@googlegroups.com 
Sent: Friday, April 17, 2009 10:46:27 AM GMT -06:00 US/Canada Central 
Subject: Re: Running django test suite 

On Thu, Apr 16, 2009 at 1:26 PM, jeffhg58 < jeffh...@comcast.net > wrote: 




I recently installed django 1.1 beta and I needed to run the django 
test suite. So, under the tests directory I executed runtests.py. I 
received some errors when trying to execute all the tests. I was 
expected that all the tests would have passed. I am thinking it might 
be with my setup. Here are the errors I encountered. 

http://dpaste.com/34433/ 


First, I'm curious how you got tests for 1.1 beta? The tests weren't included 
in the tarfile until quite recently (post 1.1 beta, I believe, since my 
downloaded un-tarred copy of 1.1 does not have a tests directory).  If you are 
getting tests out of svn you just need to be careful that you are running a 
version that matches the code you are using -- if you use more-recent tests 
against backlevel code you are liable to hit test failures resulting from 
bugfixes where the bugfix changeset has included a test that fails prior to the 
code fix.  I don't believe that is what you are seeing here though. 

Second, the failure summary you point to lists 3 failure but I only see details 
of 2 failures listed above.  Is that output complete? 

As for the failures: 

1 - The Windows error on attempting to delete a file is something we've seen 
before, and fixed (though I'm not sure in this particular place).  I cannot 
recreate the error on my Windows box with Python 2.6 and the beta 1.1 (nor 
current trunk) level code.  What exact level of Python 2.6 are you running? -- 
the specifics of this error have been dependent on Python level in the past.  
Are you running anything on this machine (like a virus scanner) that may be 
opening these files created by the tests while the test itself is 
simultaneously trying to delete them?  There was also at least one fix made 
after 1.1 beta that cleaned up some issues with temp files on Windows getting 
closed and deleted properly, so I'd be interested to know if you tried running 
with trunk level code if you still see this error. 

2 - I've not seen the markup test error before but it looks like it may be 
textile-level dependent.  I can recreate the problem with textile 2.1.3 (on 
Windows, where I previously had no textile installed) but not 2.0.10 (what I 
happen to have on Linux).  The test may be overly sensitive to slight changes 
in what textile produces.  I was going to say please open a ticket but upon 
searching I see this has already been reported: 

http://code.djangoproject.com/ticket/10843 

On the general question as to whether all the test should pass -- in an ideal 
world, yes, but we are not quite there yet.  There are OS and database backend 
issues that cause some known test failures.  Linux/sqlite generally runs 
cleanly, Windows/sqlite may, but it is dependent on Python level (Python 2.5 on 
Windows has a particularly problematic sqlite level that it shipped with).  I 
generally also see clean runs using MySQL/MyISAM (both Linux and Windows) but 
MySQL/InnoDB has many failures resulting from InnoDB's inability to do deferred 
constraint checking (there's a ticket open on that).  Some levels of PostgreSQL 
show failures with the admin_views test (again, there's a ticket open on it).  
Most test failures I know of have either tickets open for them or doc notes ( 
http://docs.djangoproject.com/en/dev/ref/databases/#sqlite-3-3-6-or-newer-strongly-recommended
 ) that cover them. 

Karen 




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



Running django test suite

2009-04-16 Thread jeffhg58

I recently installed django 1.1 beta and I needed to run the django
test suite. So, under the tests directory I executed runtests.py. I
received some errors when trying to execute all the tests. I was
expected that all the tests would have passed. I am thinking it might
be with my setup. Here are the errors I encountered.

http://dpaste.com/34433/

Thanks,
Jeff
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django-registration - outputting errors

2009-03-23 Thread jeffhg58


The way I have implemented this is to have to the validation occur at 
password2. 

Instead of having the check in clean, I would have the validation in 
clean_password2. 

Hope that helps. 
- Original Message - 
From: neri...@gmail.com 
To: "Django users"  
Sent: Monday, March 23, 2009 3:33:04 PM GMT -06:00 US/Canada Central 
Subject: django-registration - outputting errors 


Hello, 

I just started my first django project and I'm not sure how to print 
the errors from non_field_errors(). Here is the snippet from 
registration.forms.py: 

    def clean(self): 
        """ 
        Verifiy that the values entered into the two password fields 
        match. Note that an error here will end up in 
        ``non_field_errors()`` because it doesn't apply to a single 
        field. 

        """ 
        if 'password1' in self.cleaned_data and 'password2' in 
self.cleaned_data: 
            if self.cleaned_data['password1'] != self.cleaned_data 
['password2']: 
                raise forms.ValidationError(_(u'You must type the same 
password each time')) 
        return self.cleaned_data 

Here is my template snippet: 

{% if form.non_field_errors %} 
Print the errors. 
{% endif %} 

Thanks for any help, 

J 


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



Admin datetime picker

2009-03-18 Thread jeffhg58

>From converting over to Django 1.1 from 0.97, I had the admin datetime
widget displayed on
my search screen. With the latest version of django, it seems that the
datetime widget only displays if the user is an administrator.

I have narrowed down the problem that the javascript catalog is only
accessed for the admin users.

In my base.html I have



 
 

Activating admin site

2009-03-18 Thread jeffhg58

At the beginning of the urls.py file

from django.contrib import admin

admin.autodiscover()

In my urls.py I changed accessing my admin.site

from

r'^admin/(.*)', admin.site.root),

to

(r'^admin/', include(admin.site.urls)),

But when I access my admin I get errors when trying to logout the link
that is displayed is

http://127.0.0.1:8000/admin/admin/logout/

instead of

http://127.0.0.1:8000/admin/logout/

when using the admin.site.root

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Admin datetime widgets for non-admin users

2009-03-09 Thread jeffhg58

I am in the process of upgrading my site to Django version 1.1. In the
previous version of
0.97 I was using the datetime widgets from the admin.

But, since I have upgrade the widgets no longer display if the user
does not
have access to the admin site. When I login as a user who has admin
capabilities, the datetime widgets display

I have this in my base.html








order_by foreign key

2009-02-16 Thread jeffhg58

I have seen other posts on this topic but it seems that it was on the
old trunk. I am using
Django version 1.1 and I am unable to sort by foreign key

When I try and execute the following query

Result.objects.select_related().order_by('StatusId.Status')

 I get 0 rows retrieved.

Is that the correct way to order by foreign keys?

Here are the models in question

class Result( models.Model):
TestName = models.CharField( max_length=100)
TestVersion =  models.CharField( max_length=50,
null=True)
ExecutionStartDate =   models.DateTimeField( verbose_name = "Start
Date",
null=True)
StatusId = models.ForeignKey( Status,
verbose_name = "Status",
db_column='StatusId',
 
related_name="OverallStatus")
AutoStatusId = models.ForeignKey( Status,
verbose_name = "Status",
db_column='AutoStatusId',
related_name="AutoStatus")
PrintVerifyStatusId =  models.ForeignKey( Status,
verbose_name = "Status",
 
db_column='PrintVerifyStatusId',
 
related_name="PrintVerifyStatus")
ImageVerifyStatusId =  models.ForeignKey( Status,
verbose_name = "Status",
 
db_column='ImageVerifyStatusId',
 
related_name="ImageVerifyStatus")
ExecutionTime =models.DecimalField( max_digits=10,
decimal_places=4)
StationId =models.ForeignKey( Station,
verbose_name = "Station",
db_column='StationId')
SubmitDate =   models.DateTimeField( verbose_name="Submit
Date",
null=True)
Owner =models.CharField( max_length=100)
ProjectId =models.ForeignKey( Project,
verbose_name = "Project",
db_column='ProjectId')
PhaseId =  models.ForeignKey( Phase,
verbose_name = "Phase",
db_column='PhaseId')
TestTypeId =   models.ForeignKey( Type,
verbose_name = "Test
Type",
db_column='TestTypeId')
UserInterventionFlag = models.BooleanField( default=False)
CurrentFlag =  models.BooleanField( default=True)
ActiveFlag =   models.BooleanField( default=True)
objects =  models.Manager() # The default manager.

config_objects =   ResultManager()


class Status( models.Model):
Status =   models.CharField( max_length=100)
AutoFlag = models.BooleanField()

Thanks,
Jeff
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



order_by Ignore case

2009-02-11 Thread jeffhg58

I currently have a field which has upper and lower case characters. Is
there a way for the django api to ignore case using the order_by. In
postgresql sql I was able to convert the field to upper case when
doing the sort and the results are what I expected.

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Access production database via development environment

2009-01-20 Thread jeffhg58

I was wondering if anyone has been able to access their production
environment via the development environment. Because of the amount of
data on the production environment, it would be advantageous to be
able to just connect to the production database for query purposes.

P.S. I tried modifying the settings file but that did not seem to
work.

Thanks,
Jeff
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Drop down list not seeing newly added record

2009-01-07 Thread jeffhg58


Thanks for  your feedback. I will implement the changes that were suggested.



-- Original message -- 
From: Daniel Roseman  

> 
> On Jan 7, 7:47 am, jeffhg58 wrote: 
> > I have a 2 forms. One to add a new author and then another form for 
> > Articles which has a drop down list to reference the authors. The 
> > behavior I am seeing is that when I add a new author and then go to 
> > the New Article form which references the author it does not display 
> > the new record. Also, I put in some print statements in the New 
> > Article form class and those statements are only executed when I go to 
> > my home page. 
> > 
> > Here are my code snippets 
> > 
> > def welcome(request): 
> > 
> > print 'in welcome' 
> > 
> > if request.GET: 
> > if request.GET.has_key( 'newarticle'): 
> > 
> > print 'going to new article' 
> > 
> > return HttpResponseRedirect( '/melsite/newarticle') 
> > if request.GET.has_key( 'newauthor'): 
> > print 'going to new author' 
> > 
> > return HttpResponseRedirect( '/melsite/newauthor') 
> > else: 
> > 
> > print 'retrieving articles' 
> > 
> > articles = Article.objects.filter 
> > (type_index__type='Poem').order_by('title') 
> > 
> > return render_to_response('stories/welcome.html', {'title': 
> > 'Poems', 'articles': articles}) 
> > 
> > def newarticle( request): 
> > 
> > print 'in new article request' 
> > from storyforms import NewArticle 
> > 
> > if request.method == 'POST': 
> > print 'in new article post' 
> > new_data = request.POST.copy() 
> > articleform = NewArticle(new_data) 
> > if form.is_valid(): 
> > form.save( new_data) 
> > articles = Article.objects.filter 
> > (type_index__type='Poem').order_by('title') 
> > 
> > return render_to_response('stories/welcome.html', 
> > {'title': 'Poems', 'articles': articles}) 
> > else: 
> > print 'in setting up new article' 
> > #from storyforms import NewArticle 
> > articleform = NewArticle() 
> > print 'after setting up new article' 
> > print 'rendering article' 
> > return render_to_response('stories/add_story.html', {'form': 
> > articleform}) 
> > 
> > class NewArticle( forms.Form): 
> > 
> > articletypelist=[] 
> > authorlist = [] 
> > 
> > print 'in new article class' 
> > 
> > articletypes = ArticleType.objects.all().order_by( 'type') 
> > articletypelist.append( selecttuple) 
> > for articletype in articletypes: 
> > choicestr = "choice%s" % str( articletype.id) 
> > typetuple = choicestr, articletype.type 
> > articletypelist.append( typetuple) 
> > authors = Author.objects.all().order_by( 'last_name') 
> > print 'authors in new article are ', authors 
> > authorlist.append( selecttuple) 
> > for author in authors: 
> > choicestr = "choice%s" % str( author.id) 
> > authorname = author.first_name + ' ' + author.last_name 
> > authortuple = choicestr, authorname 
> > authorlist.append( authortuple) 
> > 
> > ArticleType = forms.ChoiceField( choices=articletypelist) 
> > Author = forms.ChoiceField( choices=authorlist) 
> > Title = forms.CharField() 
> > Content = forms.CharField( widget=forms.Textarea) 
> > print 'end of new article def' 
> > 
> > Thanks, 
> > Jeff 
> 
> As Karen says, logic in the class declaration is only executed once, 
> when the form is first imported. Authorlist and articletypelist are 
> much better implemented as class methods on the relevant models: 
> 
> class Author(models.Model): 
> ... 
> @classmethod 
> def get_authorlist(cls): 
> return [('choice%s' % a.id, '%s %s' % (a.first_name, 
> a.last_name)) 
> for a in cls.objects.all().order_by('last_name')] 
> 
> Then in your view or template you can do Author.get_authorlist() to 
> return the up-to-date list. 
> 
> However, a much better solution is to use ModelChoiceField for the 
> Articletype and Author fields. These populate the list dynamically 
> from a queryset: 
> 
> class NewArticle(forms.Form): 
> ... 
> Author = forms.ModelChoiceField(queryset=Author.objects.order_by 
> ('last_name')) 
> 
> -- 
> 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-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
-~--~~~~--~~--~--~---



Drop down list not seeing newly added record

2009-01-07 Thread jeffhg58

I have a 2 forms. One to add a new author and then another form for
Articles which has a drop down list to reference the authors. The
behavior I am seeing is that when I add a new author and then go to
the New Article form which references the author it does not display
the new record. Also, I put in some print statements in the New
Article form class and those statements are only executed when I go to
my home page.

Here are my code snippets

def welcome(request):

print 'in welcome'

if request.GET:
if request.GET.has_key( 'newarticle'):

print 'going to new article'

return HttpResponseRedirect( '/melsite/newarticle')
if request.GET.has_key( 'newauthor'):
print 'going to new author'

return HttpResponseRedirect( '/melsite/newauthor')
else:

print 'retrieving articles'

articles = Article.objects.filter
(type_index__type='Poem').order_by('title')

return render_to_response('stories/welcome.html', {'title':
'Poems', 'articles': articles})

def newarticle( request):

print 'in new article request'
from storyforms import NewArticle


if request.method == 'POST':
print 'in new article post'
new_data = request.POST.copy()
articleform = NewArticle(new_data)
if form.is_valid():
form.save( new_data)
articles = Article.objects.filter
(type_index__type='Poem').order_by('title')

return render_to_response('stories/welcome.html',
{'title': 'Poems', 'articles': articles})
else:
print 'in setting up new article'
#from storyforms import NewArticle
articleform = NewArticle()
print 'after setting up new article'
print 'rendering article'
return render_to_response('stories/add_story.html', {'form':
articleform})

class NewArticle( forms.Form):

articletypelist=[]
authorlist = []

print 'in new article class'

articletypes = ArticleType.objects.all().order_by( 'type')
articletypelist.append( selecttuple)
for articletype in articletypes:
choicestr = "choice%s" % str( articletype.id)
typetuple = choicestr, articletype.type
articletypelist.append( typetuple)
authors = Author.objects.all().order_by( 'last_name')
print 'authors in new article are ', authors
authorlist.append( selecttuple)
for author in authors:
choicestr = "choice%s" % str( author.id)
authorname = author.first_name + ' ' + author.last_name
authortuple = choicestr, authorname
authorlist.append( authortuple)

ArticleType = forms.ChoiceField( choices=articletypelist)
Author = forms.ChoiceField( choices=authorlist)
Title = forms.CharField()
Content = forms.CharField( widget=forms.Textarea)
print 'end of new article def'

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Blank content from unit testing

2008-10-30 Thread jeffhg58
Here is the pasted code. I am wondering how to verify the content of 
search_form when I initially go to
that url

http://dpaste.com/87795/

-- Original message -- 
From: "Karen Tracey" <[EMAIL PROTECTED]> 
On Thu, Oct 30, 2008 at 11:50 AM, <[EMAIL PROTECTED]> wrote:

But, when I initialling go to '/resultsdb/search_form/' and the request is not 
a get but I a WSGIRequest how to test the content? Because in my view the only 
redirect after a request.GET occurs during an if conditional of when a certain 
button is pressed


I can't parse your question in the first sentence.  Code snippets might help.  
There is no content if you are getting a 302, it is a redirect and the only 
thing you can then examine would be the redirect Location.  Somehow the path 
your code is taking in response to a get on '/resultsdb/search_form/' is 
getting to a point where it returns a redirect, not a response.

You've also got another thread that I hadn't seen when I first responded on 
this one, where someone responded pointing out the likely line in your view you 
are hitting.  I gather from your last sentence you don't believe you can be 
hitting that line, but apparently you are. I couldn't get that far in reading 
the view code because it gets badly mangled in an email interface; dpaste.com 
would be a better place for putting code.

Karen



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Blank content from unit testing

2008-10-30 Thread jeffhg58
But, when I initialling go to '/resultsdb/search_form/' and the request is not 
a get but I a WSGIRequest how to test the content? Because in my view the only 
redirect after a request.GET occurs during an if conditional of when a certain 
button is pressed

Jeff
-- Original message -- 
From: "Karen Tracey" <[EMAIL PROTECTED]> 
On Thu, Oct 30, 2008 at 10:25 AM, jeffhg58 <[EMAIL PROTECTED]> wrote:


I am currently the django test client and I have run across a
stumbling block.

When I do a get command for my main screen which is get('/resultsdb/
search_form/'), the status code
returns a 302 with no content.
But, if a do a get on say ('/login/') or a subsequent window besides
the main window such as ('/resultsdb/newresults/') and get a status
code of 200 with the content of the window.

Any help would be greatly appreciated. I am stumped on this.



Well a 302 is a redirect, so it won't have content.  response['Location'] will 
tell you where it is redirecting to, which might give you a hint.


Karen


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



302 status code in django test client

2008-10-30 Thread jeffhg58

I am having difficulty trying to test out the content of the main
window because it returns the status code
of 302. Here is the snippet of my view. So, when I first call the
search_form the request falls out of the
if request. GET. Does anyone have an idea on how I can test the
content of this page?

Thanks,
Jeff

def search_form(request):



if request.GET:

global_vars.search_data = request.GET.copy()
form = SearchForm(global_vars.search_data) # Instantiate
and load POST data

if form.is_valid(): # Validate data
 page_num = search(global_vars.search_data)

 if request.has_key('getrecs'):

  rl = ResultList(request, page_num, 'Result')



  c = template.RequestContext(request, {
  'count': rl.result_count,
  'rl': rl,
  })
  renderfile = resultsdir + '/results_list.html'
  return render_to_response([renderfile],
context_instance=c)

 if request.has_key('getcsv'):
  # Create the HttpResponse object with the
appropriate CSV header.
  response = HttpResponse(mimetype='text/csv')
  response['Content-Disposition'] = 'attachment;
filename=somefilename.csv'

  qs = Result.objects.filter(**global_vars.query_dict)
  qs = qs.exclude(**global_vars.exclude_query_dict)


  writer = csv.writer(response)
  writer.writerow(['row 1', 'ID', 'Test Name',
'Project', 'Phase', 'Test Type', 'Station',
  'Start Date', 'Owner', 'Status',
'Test Configuration'])
  for i in range(len(qs)):
  rowtext = 'row ' + str(i+2)
  id = str(qs[i].id)
  tname = qs[i].TestName
  projname = str(qs[i].ProjectId)
  phase = str(qs[i].PhaseId)
  testtype = str(qs[i].TestTypeId)
  station = str(qs[i].StationId)
  startdate = str(qs[i].ExecutionStartDate)
  owner = qs[i].Owner
  status = str(qs[i].StatusId)
  configdata =
ConfigResult.objects.filter(ResultsId='%s' %qs[i].id)
  Configstr = ''
  for configresult in configdata:
  if Configstr != '':
  Configstr += ','
  Configstr += str(configresult)
  writer.writerow([rowtext, id, tname, projname,
phase, testtype, station,
  startdate, owner, status,
Configstr])



  return response
 if request.has_key('newresults'):
  #redirectaddr = resultsdir + '/newresults/'
  return HttpResponseRedirect('/resultsdb/newresults')

else:

form = SearchForm()


# Create the FormWrapper, template, context, response.


s = template.RequestContext(request, {
 'form': form})

renderfile = resultsdir + '/search_form.html'
return render_to_response([renderfile], context_instance=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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Blank content from unit testing

2008-10-30 Thread jeffhg58

I am currently the django test client and I have run across a
stumbling block.

When I do a get command for my main screen which is get('/resultsdb/
search_form/'), the status code
returns a 302 with no content.
But, if a do a get on say ('/login/') or a subsequent window besides
the main window such as ('/resultsdb/newresults/') and get a status
code of 200 with the content of the window.

Any help would be greatly appreciated. I am stumped on this.

Thanks,
Jeff
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Using datepicker outside of admin

2008-10-03 Thread jeffhg58

Before Django 1.0, I was successful able to use the datepicker outside
of admin within my own application.
But, since the upgrade I get a runtime error with a syntax error on
line 1. This error occurs with the following line



This error only occurs when the user does not have administrative
capabilities.

Does anyone know or how to resolve the error?

Thanks,
Jeff
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



User Login with Django 1.0

2008-09-25 Thread jeffhg58

I just recently upgraded to Django 1.0, but when I log in with users
that I have created I get up a popup window
stating syntax error and after I login the clock and calendar objects
are lost.

Has anyone else experienced this issue?

Thanks,
Jeff
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Rendering splitdatetime widget with upgrade

2008-02-03 Thread jeffhg58
Matt,

Thanks so much for the info. That fixed my problem

Jeff

-- Original message -- 
From: Matt McClanahan <[EMAIL PROTECTED]> 

> 
> On Feb 3, 6:30 am, jeffhg58 wrote: 
> 
> > I just recently upgrading my trunk to revision 7054 and I noticed that 
> > the form I have that uses the splitdatetime 
> > widget no longer renders correctly. 
> 
> This issue has been reported in ticket #6113. The ticket has a patch 
> which you can apply if you want until the issue is addressed. 
> http://code.djangoproject.com/ticket/6113 
> 
> Matt 
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Rendering splitdatetime widget with upgrade

2008-02-03 Thread jeffhg58

I just recently upgrading my trunk to revision 7054 and I noticed that
the form I have that uses the splitdatetime
widget no longer renders correctly.

On my form it displays my field like
 Start Date/Time:* 

instead of actually rendering the date and time fields.

Here is a snippet of form:

event_date = forms.SplitDateTimeField(widget=SplitDateTimeWidget())

Here is a snippet of my html file





Start Date/Time:* {{ form.event_date }}

{% if form.event_date.errors %}
*** {{ form.event_date.errors|join:", " }}
{% endif %}




Any help would be greatly appreciated

Thanks,
Jeff

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Using send_mail seems slow

2008-01-31 Thread jeffhg58

When trying to send email to one user it seems that the send_mail
command takes about 6 seconds.

Does anyone have any suggestions on how to improve the response time.

Also, it seems consistent whether or not I use the development
environment or my production web site.

Thanks,
Jeff
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



initializing select date widget

2008-01-13 Thread jeffhg58

Hi,

I have a question regarding the selectdatewidget. I am using a
datefield for birthdate which is optional.
How do you use the selectdate widget to default it to blank or not
entered. When I use the selectdate widget, it displays a date of
January 1. I am trying to determine whether or not the user entered a
birthdate.

I have defined the models with null=true and blank=true

Thanks,
Jeff
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Page not showing correct data

2007-12-29 Thread jeffhg58
Just wanted to let you know that fixed the problem.

Thanks so much.

Jeff

-- Original message -- 
From: "Karen Tracey" <[EMAIL PROTECTED]> 
On Dec 25, 2007 9:18 PM, <[EMAIL PROTECTED]> wrote:

After reloading the page the browser does not show the new data.

Here is the odd thing, if I wait about 10 minutes before clicking on the link 
then the new data appears.

Any suggestions?

Sounds like you've enabled some form of caching 
(http://www.djangoproject.com/documentation/cache/ ). 

Karen



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Page not showing correct data

2007-12-25 Thread jeffhg58
After reloading the page the browser does not show the new data.

Here is the odd thing, if I wait about 10 minutes before clicking on the link 
then the new data appears.

Any suggestions?

Jeff

-- Original message -- 
From: l5x <[EMAIL PROTECTED]> 

> 
> After reloading the page (f5) browser shows new data? 
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Page not showing correct data

2007-12-25 Thread jeffhg58

Hi,

In my site, the user has the ability to update an event. After the
event is updated, the user is brought back to
the event calendar page. Within the event calendar, there is a link
for the event details. The problem I am having is that the event
details page is showing the old data, even though the database is
showing that the event was updated.

If anyone has any ideas on what my problem might be it would be
greatly appreciated.

Thanks,
Jeff
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Update using dictionary

2007-12-16 Thread jeffhg58
Just wanted to reply to myself that I fixed my problem. I needed to store all 
the values from my get into the dictionary

Thanks,
Jeff

-- Original message -- 
From: jeffhg58 <[EMAIL PROTECTED]> 

> 
> Hi, 
> 
> I currently have an update form which contains a dictionary of the 
> field names and values. 
> I was wondering how you perform the update using a dictionary. 
> 
> Here is a snippet of my code 
> 
> def save(self, new_data, event_id): 
> eventdetrec = Events.objects.get(pk=event_id) 
> event_dict = {} 
> 
> So, now if I populate event_dict how would I be able to update 
> eventdetrec and then perform the save 
> 
> Thanks, 
> Jeff 
> 
> 
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Update using dictionary

2007-12-16 Thread jeffhg58

Hi,

I currently have an update form which contains a dictionary of the
field names and values.
I was wondering how you perform the update using a dictionary.

Here is a snippet of my code

def save(self, new_data, event_id):
 eventdetrec = Events.objects.get(pk=event_id)
 event_dict = {}

So, now if I populate event_dict how would I be able to update
eventdetrec and then perform the save

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: windows vista, localhost server lag (very slow), with zonealarm (even if off...)

2007-09-17 Thread jeffhg58
Thanks so much for the info. I have been trying to figure it out why it has 
been taking so long on my local machine.



-- Original message -- 
From: francois <[EMAIL PROTECTED]> 

> 
> Oops, forgot to mention this is obviously for the local web sever on 
> the vista machine ( ie using localhost or 127.0.0.1 urls ) 
> 
> On Sep 18, 12:13 am, francois wrote: 
> > Hello, 
> > 
> > This is not a problem coming from Django but it took me some time => 
> > I post here for other users who would search here for a solution 
> > 
> > The problem: 
> > - few seconds lags on vista for each http request to be considered by 
> > the server (with the internal server or apache and whatever browser). 
> > 
> > A solution found on the net (see link below), works for me: 
> > - uninstall ZoneAlarm, reboot, choose another firewall 
> > 
> > http://www.eggheadcafe.com/software/aspnet/30715202/3-second-lag-when... 
> > 
> > francois 
> 
> 
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Datetimefield error using form_as_model

2007-08-17 Thread jeffhg58
I am using 0.97-pre. I also am  using new forms with a similar date field at 
work for a different website and I do not encounter the error, though I am 
using the form_for_model instead I am using the custom form. But, I will try 
and compare the two and see where the differences might be.

Thanks,
Jeff

-- Original message -- 
From: Malcolm Tredinnick <[EMAIL PROTECTED]> 

> 
> On Thu, 2007-08-16 at 05:25 -0700, jeffhg58 wrote: 
> > Hi, 
> > 
> > I am using a form_as_model with newforms and when I do a save I get 
> > the following error message on the form: 
> > 
> > format is %Y-%m-%d %H:%M:%S. 
> 
> Grepping through the source code, the string "format is" does not appear 
> anywhere in the source in the for you describe. Which version of Django 
> are you using? 
> 
> [...] 
> > views.py 
> > 
> > AddEventFormClass = forms.form_for_model(Events) 
> > 
> > if request.method == 'POST': 
> > # If data was POSTed, we're trying to create a new Event. 
> > form = AddEventFormClass(request.POST) 
> > 
> > 
> > # Check for errors. 
> > print 'errors is ', form.errors 
> > if form.is_valid(): 
> > form.save() 
> > return HttpResponseRedirect("/tct/events/%s/" % city_id) 
> > 
> > The errors occur before the form.is_valid check 
> 
> What do you mean? Does an actual exception get raised? Or are you saying 
> that something is printed out on the line where your print statement is? 
> 
> Perhaps you could paste the actual traceback or printed output rather 
> than trying to summarise the results, because it's not clear what is 
> really going on. 
> 
> Also, what is in the POSTed data for the field in question? Is it valid 
> data? 
> 
> Regards, 
> Malcolm 
> 
> -- 
> If Barbie is so popular, why do you have to buy her friends? 
> http://www.pointy-stick.com/blog/ 
> 
> 
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Datetimefield error using form_as_model

2007-08-16 Thread jeffhg58

Hi,

I am using a form_as_model with newforms and when I do a save I get
the following error message on the form:

format is %Y-%m-%d %H:%M:%S.

This occurs with the event_date field.

Can you someone point me in the right direction to help me resolve
this issue.

Here are snippets of my models and views

models.py

# Events
class Events(models.Model):
   city_name = models.ForeignKey(Cities)
   event_name = models.CharField(maxlength=250)
   event_details = models.TextField()
   event_date = models.DateTimeField()
   contact_name = models.CharField(maxlength=100, null=True,
blank=True)
   contact_phone = models.PhoneNumberField(null=True, blank=True)
   contact_url = models.CharField(maxlength=100, null=True,
blank=True)
   location = models.CharField(maxlength=100, null=True, blank=True)
   address = models.CharField(maxlength=255, null=True, blank=True)
   city = models.CharField(maxlength=100, null=True, blank=True)
   state = models.ForeignKey(States, null=True, blank=True)
   zip = models.CharField(maxlength=12, null=True, blank=True)
   owner = models.ForeignKey(User,related_name="owner",blank=True,
editable=False)

views.py

AddEventFormClass = forms.form_for_model(Events)

if request.method == 'POST':
# If data was POSTed, we're trying to create a new Event.
form = AddEventFormClass(request.POST)


# Check for errors.
print 'errors is ', form.errors
if form.is_valid():
form.save()
return HttpResponseRedirect("/tct/events/%s/" % city_id)

The errors occur before the form.is_valid check

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Multi field validation with clean method

2007-08-10 Thread jeffhg58
I was finally able to figure it out as I saw on another post. Instead, of
using the RaiseValidation error I did the following:

self.errors.update(annotation=ErrorList([u'You must enter an Annotation 
Type.']))

Thanks for all your help,

Jeff

-- Original message -- 
From: rskm1 <[EMAIL PROTECTED]> 

> 
> On Aug 9, 7:34 pm, [EMAIL PROTECTED] wrote: 
> > So, if I use clean_annotationvalue to do both how would I be able to put an 
> error 
> > message on the annotation type ... 
> 
> I think you were on the right track the first time. Philosophically, 
> the Form's clean() method is where you're supposed to be doing the 
> inter-field validations, and you don't have to worry about field 
> sequence there either. 
> 
> So now your question boils down to a simple "How do I associate the 
> error message with a specific field, from the form's clean() method?" 
> 
> Normally, if you raise a ValidationError exception from 
> YourForm.clean(), the message appears in a "special" section of the 
> form._errors collection named "__all__", accessed from the template as 
> {{ form.non_field_errors }}. 
> But if you can figure out how to manually inject the message into 
> yourform._errors yourself, you could make it appear on any field you 
> want. Well, *theoretically* anyway; I haven't tried that myself, 
> since I always *want* the inter-field validation errors to appear in a 
> different spot. 
> 
> 
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Multi field validation with clean method

2007-08-09 Thread jeffhg58
So, if I use clean_annotationvalue to do both how would I be able to put an 
error
message on the annotation type when a value is entered but no annotation type 
is entered.
Wouldn't that error message appear under the annotationvalue field

Jeff

-- Original message -- 
From: Collin Grady <[EMAIL PROTECTED]> 

> 
> The clean_foo functions are run in order. 
> 
> So in your situation, clean_annotationtype will only have access to 
> the annotationtype value, but clean_annotationvalue will be able to 
> see both, since clean_annotationtype has already been run. 
> 
> 
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Multi field validation with clean method

2007-08-09 Thread jeffhg58

I have run across an issue trying to implement the clean method.

I have 2 fields an annotation type and annotation value. I am trying
to validate that if one
value is entered the other value cannot be blank or empty.

Initially, I tried to implement the clean method at the field level.
The problem I encounter is
that the annotation value does not show up in the cleaned_data in the
clean_annotationtype function. This occurs even if I enter data in the
annotation value field.

The annotation value does appear in the cleaned_data in the
clean_annotationvalue function.

I can correctly validate both fields when I implement the clean method
at the form level. But,
I was trying to have the error message appear in either the annotation
type or annotation value field depending upon the error message.

Would appreciate any direction with this issue.

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to get selected value set in newforms

2007-08-02 Thread jeffhg58
I think the problem is related to passing the resultsdict dictionary to the 
DisplayForms.
Once, I did not pass in the dictionary then the initial value works.

Jeff

-- Original message -- 
From: [EMAIL PROTECTED] 

Nis,

Thanks for the reply. I tried your example and that does not work. Here is the 
snippet of my code:

views.py

def displayresults(request, object_id):
 result = Result.objects.get(pk=object_id)
 
 startdatevalue = ''
starttimevalue = ''
startdatestr = '%s' % result.ExecutionStartDate
if startdatestr != 'None':
   startdatevalue = "%04d-%02d-%02d" % ( 
result.ExecutionStartDate.year, result.ExecutionStartDate.month, 
   result.ExecutionStartDate.day)
   starttimevalue = "%02d:%02d:%02d" % ( 
result.ExecutionStartDate.hour, result.ExecutionStartDate.minute,
   result.ExecutionStartDate.second)
 
 result_dict = {'TestName': result.TestName,
 'TestVersion': result.TestVersion,
 'ExecutionStartDate_date': startdatevalue,
 'ExecutionStartDate_time': starttimevalue,
 'SubmitDate': result.SubmitDate,
 'ExecutionTime': result.ExecutionTime,
 'Owner': result.Owner,
 'Project': result.ProjectId,
 'Phase': result.PhaseId,
 'Testtype': result.TestTypeId,
 'Station': result.StationId,
 'UserIntervention': result.UserInt erventionFlag,
}
   form = DisplayResults(result_dict)

resultforms.py:
class DisplayResults(forms.Form):
   TestName = forms.CharField()
TestVersion = forms.CharField()
ExecutionStartDate_date = forms.DateField()
ExecutionStartDate_time = forms.TimeField()
SubmitDate = forms.CharField()
ExecutionTime = forms.CharField()
Owner = forms.CharField()
Project = forms.CharField()
Phase = forms.CharField()
Testtype = forms.CharField()
status = forms.ChoiceField(required=False,choices 
=(('choice1','Choice1'),('choice2','Choice 2')), initial = 'choice2' )

Here is the html output:

Status:
Choice1
Choice 2


Jeff

-- Original message -- 
From: Nis Jørgensen <[EMAIL PROTECTED]> 

> 
> [EMAIL PROTECTED] skrev: 
> > I am still having problems setting the select widget to the 3rd value in 
> > the 
> drop down list. 
> > Looking further it seems that the html does not have the 
> > selected="selected" 
> value in any of the items. 
> > The documentation states that if use a bound form you will see that in the 
> html. 
> 
> "initial" data are showed in an UNBOUND form. If the form is bound, it 
> shows the data you bound it to. This is clearly stated in the 
> documentation - I assume you mistyped here. 
> 
> > How would you go about getting the selected value in the html for a 
> choicefield. I tried the initial parameter in the choicefield and that does 
> not 
> change which value is selected. It always happens to be the first in the 
> list. 
> > 
> > Any help would greatly appreciated. 
> 
> For an unbound form, it works for me: 
> 
> """ 
> $ cat forms.py 
> from django import newforms as forms 
> 
> class SearchForm (forms.Form): 
> campaign = forms.ChoiceField(required=False,choices 
> =(('choice1','Choice1'),('choice2','Choice 2')), initial = 'choice2' ) 
> sf = SearchForm() 
> print sf 
> 
> $ python forms.py 
> Campaign:> name="campaign" id="id_campaign"> > Choice1 > Choice 2 > 
> """ 
> 
> Can you please 
> 
> a) Confirm that the above works for you 
> b) Post a self-contained example which shows your problem 
> 
> Nis 
> > 
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to get selected value set in newforms

2007-08-02 Thread jeffhg58
Nis,

Thanks for the reply. I tried your example and that does not work. Here is the 
snippet of my code:

views.py

def displayresults(request, object_id):
 result = Result.objects.get(pk=object_id)
 
 startdatevalue = ''
starttimevalue = ''
startdatestr = '%s' % result.ExecutionStartDate
if startdatestr != 'None':
   startdatevalue = "%04d-%02d-%02d" % ( 
result.ExecutionStartDate.year, result.ExecutionStartDate.month, 
   result.ExecutionStartDate.day)
   starttimevalue = "%02d:%02d:%02d" % ( 
result.ExecutionStartDate.hour, result.ExecutionStartDate.minute,
   result.ExecutionStartDate.second)
 
 result_dict = {'TestName': result.TestName,
 'TestVersion': result.TestVersion,
 'ExecutionStartDate_date': startdatevalue,
 'ExecutionStartDate_time': starttimevalue,
 'SubmitDate': result.SubmitDate,
 'ExecutionTime': result.ExecutionTime,
 'Owner': result.Owner,
 'Project': result.ProjectId,
 'Phase': result.PhaseId,
 'Testtype': result.TestTypeId,
 'Station': result.StationId,
 'UserIntervention': result.UserInterventionFlag,
}
   form = DisplayResults(result_dict)

resultforms.py:
class DisplayResults(forms.Form):
   TestName = forms.CharField()
TestVersion = forms.CharField()
ExecutionStartDate_date = forms.DateField()
ExecutionStartDate_time = forms.TimeField()
SubmitDate = forms.CharField()
ExecutionTime = forms.CharField()
Owner = forms.CharField()
Project = forms.CharField()
Phase = forms.CharField()
Testtype = forms.CharField()
status = forms.ChoiceField(required=False,choices 
=(('choice1','Choice1'),('choice2','Choice 2')), initial = 'choice2' )

Here is the html output:

Status:
Choice1
Choice 2


Jeff

-- Original message -- 
From: Nis Jørgensen <[EMAIL PROTECTED]> 

> 
> [EMAIL PROTECTED] skrev: 
> > I am still having problems setting the select widget to the 3rd value in 
> > the 
> drop down list. 
> > Looking further it seems that the html does not have the 
> > selected="selected" 
> value in any of the items. 
> > The documentation states that if use a bound form you will see that in the 
> html. 
> 
> "initial" data are showed in an UNBOUND form. If the form is bound, it 
> shows the data you bound it to. This is clearly stated in the 
> documentation - I assume you mistyped here. 
> 
> > How would you go about getting the selected value in the html for a 
> choicefield. I tried the initial parameter in the choicefield and that does 
> not 
> change which value is selected. It always happens to be the first in the 
> list. 
> > 
> > Any help would greatly appreciated. 
> 
> For an unbound form, it works for me: 
> 
> """ 
> $ cat forms.py 
> from django import newforms as forms 
> 
> class SearchForm (forms.Form): 
> campaign = forms.ChoiceField(required=False,choices 
> =(('choice1','Choice1'),('choice2','Choice 2')), initial = 'choice2' ) 
> sf = SearchForm() 
> print sf 
> 
> $ python forms.py 
> Campaign:> name="campaign" id="id_campaign"> > Choice1 > Choice 2 > 
> """ 
> 
> Can you please 
> 
> a) Confirm that the above works for you 
> b) Post a self-contained example which shows your problem 
> 
> Nis 
> 
> 
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to get selected value set in newforms

2007-08-02 Thread jeffhg58
I am still having problems setting  the select widget to the 3rd value in the 
drop  down list.
Looking further it seems that the html does not have the selected="selected" 
value in any of the items.
The documentation states that if use a bound form you will see that in the html.
How would you go about getting the selected value in the html for a 
choicefield. I tried the initial parameter in the choicefield and that does not 
change which value is selected. It always happens to be the first in the list.

Any help would greatly appreciated.

Thanks,
Jeff

-- Original message -- 
From: [EMAIL PROTECTED] 

I must be missing something here because when I change the statement
to status = forms.ChoiceField(required=False, choices=statlist, 
initial="choice3")

it still displays the 1st record in the list when I am trying to have the 3rd 
choice be the selected
value.

Jeff

-- Original message -- 
From: Thomas Guettler <[EMAIL PROTECTED]> 

> 
> Am Mittwoch, 1. August 2007 15:58 schrieb jeffhg58: 
> > In newforms when I use the choicefield, I haven't been able to figure 
> > out how to set the value to say the third value in the drop down list. 
> > I tried setting the initial=3 but that did not seem to work. 
> > 
> > Here is the definition of the choicefield 
> > 
> > status = forms.ChoiceField(required=False, choices=statlist) 
> 
> Hi, 
> 
> if choices=(("a", "Letter A",) ... 
> 
> you set initial to "a". Simple, isn't it? 
> 
> Thomas 
> 
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to get selected value set in newforms

2007-08-01 Thread jeffhg58
I must be missing something here because when I change the statement
to status = forms.ChoiceField(required=False, choices=statlist, 
initial="choice3")

it still displays the 1st record in the list when I am trying to have the 3rd 
choice be the selected
value.

Jeff

-- Original message -- 
From: Thomas Guettler <[EMAIL PROTECTED]> 

> 
> Am Mittwoch, 1. August 2007 15:58 schrieb jeffhg58: 
> > In newforms when I use the choicefield, I haven't been able to figure 
> > out how to set the value to say the third value in the drop down list. 
> > I tried setting the initial=3 but that did not seem to work. 
> > 
> > Here is the definition of the choicefield 
> > 
> > status = forms.ChoiceField(required=False, choices=statlist) 
> 
> Hi, 
> 
> if choices=(("a", "Letter A",) ... 
> 
> you set initial to "a". Simple, isn't it? 
> 
> Thomas 
> 
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to get selected value set in newforms

2007-08-01 Thread jeffhg58

In newforms when I use the choicefield, I haven't been able to figure
out how to set the value to say the third value in the drop down list.
I tried setting the initial=3 but that did not seem to work.

Here is the definition of the choicefield

status = forms.ChoiceField(required=False, choices=statlist)

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: SplitDateTimeField error

2007-07-26 Thread jeffhg58
Found out my problem. The form declaration should be SplitDateTimeField not 
DateTimeField

Thanks,
Jeff

-- Original message -- 
From: jeffhg58 <[EMAIL PROTECTED]> 

> 
> I was wondering if anyone has experienced this problem before. 
> 
> I have a search screen where I use a SplitDateTimeField widget. 
> 
> It seems that I get the following error when I do the is_valid 
> function 
> 
> The error is 
> 
> TypeError at /resultsdb/ 
> expected string or buffer 
> Request Method: GET 
> Request URL: http://127.0.0.1:8000/resultsdb/ 
> Exception Type: TypeError 
> Exception Value: expected string or buffer 
> Exception Location: c:\python25\lib\_strptime.py in strptime, line 
> 307 
> Python Executable: c:\Python25\python.exe 
> Python Version: 2.5.0 
> 
> 
> if request.GET: 
> new_data = request.GET.copy() 
> print 'new_data is ', new_data 
> form = SearchForm(new_data) 
> 
> if form.is_valid(): 
> 
> Here is a snippet of my form declaration 
> 
> executionstartdate = forms.DateTimeField(required=False, 
> widget=forms.widgets.SplitDateTimeWidget) 
> 
> Thanks, 
> Jeff 
> 
> 
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



SplitDateTimeField error

2007-07-26 Thread jeffhg58

I was wondering if anyone has experienced this problem before.

I have a search screen where I use a SplitDateTimeField widget.

It seems that I get the following error when I do the is_valid
function

The error is

TypeError at /resultsdb/
expected string or buffer
Request Method: GET
Request URL: http://127.0.0.1:8000/resultsdb/
Exception Type: TypeError
Exception Value: expected string or buffer
Exception Location: c:\python25\lib\_strptime.py in strptime, line
307
Python Executable: c:\Python25\python.exe
Python Version: 2.5.0


if request.GET:
new_data = request.GET.copy()
print 'new_data is ', new_data
form = SearchForm(new_data)

if form.is_valid():

Here is a snippet of my form declaration

executionstartdate = forms.DateTimeField(required=False,
widget=forms.widgets.SplitDateTimeWidget)

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Newforms - attributes for splitdatetimewidget

2007-07-20 Thread jeffhg58

Hi,

I am just digging into the newforms functionality. I am looking at the
splitdatetimewidget.
I am trying to having a different attributes for the first field and
the second field, and would like to know how to go about doing it.

Here is the snippet of my code

calendar_widget =
forms.widgets.SplitDateTimeWidget(attrs={'class':"vDateField
required", 'size':10})

AddEventFormClass.base_fields['event_date'].widget = calendar_widget

I am trying to use the class of vTimeField for the second field.

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Unable to see user id

2007-06-17 Thread jeffhg58
That was the problem. Thanks so much!

Jeff

-- Original message -- 
From: Pedro Lima <[EMAIL PROTECTED]> 

> 
> Are you sending the RequestContext into the template? 
> 
> render_to_response('page.html', RequestContext(request,{}) 
> 
> 
> On Jun 17, 4:06 pm, jeffhg58 wrote: 
> > I am having a problem seeing the user id on my web pages. Basically, I 
> > am referencing 
> > {{ user.username }} in my html template. 
> > In my views I have imported from django.contrib.auth.models import 
> > User and I am using the login decorator. I have no issues with logging 
> > in to the site, just can't seem to figure out why 
> > the user id is not displaying. Any help would be greatly appreciated. 
> > 
> > Thanks, 
> > Jeff 
> 
> 
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Unable to see user id

2007-06-17 Thread jeffhg58

I am having a problem seeing the user id on my web pages. Basically, I
am referencing
{{ user.username }} in my html template.
In my views I have imported from django.contrib.auth.models import
User and I am using the login decorator. I have no issues with logging
in to the site, just can't seem to figure out why
the user id is not displaying. Any help would be greatly appreciated.

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: installing django on vista?

2007-05-26 Thread jeffhg58
I had the same problem with vista. Basically, you need to update the 
environment variables to where you have python installed. I can only speak to 
the python being unrecognized. For some reason, it took me a while to get it 
working correctly. But, in the interim you should be able to use the full path 
for python and it should work. Hope that helps

-- Original message -- 
From: blabla <[EMAIL PROTECTED]> 

> 
> Hi thanks for the responses, 
> I followed your steps, and am having some problems still, 
> python still is unrecognized command, 
> withy my directory in the command prompt at C:\django>i enter the 
> command setup.py install and recieve error 
> package init file '\django\__init__.py' not found ( or not a regular 
> file) 
> error: package directory '\django\bin' does not exist 
> 
> and which case both instance exist, any thoughts on this one? 
> 
> 
> 
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Full history branch unable to retrieve audit trail information

2007-05-14 Thread jeffhg58

Not sure if many people have used the full history branch. But, I can
see the ChangeLog information via the admin site. But, when I try and
get information via the shell
I get ChangeLog is not defined. Is there something I need to import to
be able to recognize the ChangeLog table.

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using Django Models outside of Django

2007-05-07 Thread jeffhg58
I think this documentation will provide what you are looking for

http://code.djangoproject.com/wiki/InitialSQLDataDiangoORMWay

jeff

-- Original message -- 
From: johnny <[EMAIL PROTECTED]> 

> 
> I have a python script that runs in a multi threaded manner for 
> backend to update certain flags in the table. I want to use django 
> models to do this. I was wondering if I import the django models just 
> like any other python, would that work? 
> 
> Also, what about the database connection, can I just create a database 
> connection inside the python script and use Django Models? 
> 
> 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Tables not displaying in admin with full-history branch

2007-05-05 Thread jeffhg58

I downloaded the full-history branch and I noticed that my tables were
no longer
displaying in admin, even when I had the class admin defined within my
models.py.

Does anyone know how to get back the tables in the admin?

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



apache with mod python and vista

2007-04-24 Thread jeffhg58

Not sure which is the culprit but I am trying to setup mod_python with
apache on my vista home
computer. When I tried and access http://localhost/mysite I always get
404 error. Looking at the logs it is expecting mysite to be under C:/
Program Files/Apache Group/Apache2/htdocs
even though I have modified the document root in the httpd config
file. I am using the same config file from an windows xp machine and
that works fine.

BTW, when I access http://localhost that brings up the apache page

Any direction to help resolve this issue would be greatly appreciated.

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



User authorization using apache

2007-04-16 Thread jeffhg58

I am sure this question has been asked before but haven't been able to
find the answer.

I am using the django decorator for user authentication.

My views has the line
@login_required

And my urls.py has the line

(r'^accounts/login/$', 'django.contrib.auth.views.login'),

It works fine in the django development environment, but when I try
and use mod_python it gives me the error message that /accounts/login
is not found.

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Customer manipular checks

2007-04-13 Thread jeffhg58

Hi,

I developed a customer manipulator and several of the fields contain
the is_required check. The only thing I am having difficulty with is
that when I submit the request and one of the fields is not populated
the text of all the other fields are removed. I wanted to keep the
text for all the fields. This did not happen when I was using an Add
Manipulator.
Any suggestions?

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Log out problems

2007-04-11 Thread jeffhg58
James,

Thanks for the explanation. I am going to change my logout to do a redirect

Jeff

-- Original message -- 
From: "James Bennett" <[EMAIL PROTECTED]> 

> 
> On 4/11/07, jeffhg58 wrote: 
> > The only problem I am having is when I log out and either hit the back 
> > button or go to my home 
> > page from the browser it does not give me the login prompt window. 
> 
> This is kind of tricky and exposes a pseudo-bug in Django. 
> 
> What's happening is this: 
> 
> 1. At the time the request starts, you're logged in, and so the 
> AuthenticationMiddleware sets 'request.user' so that it returns your 
> User object, which in turn returns True on an 'is_authenticated()' 
> check. 
> 2. At the time that you hit the 'login_required' decorator, you 
> haven't yet hit the view code which logs you out, so you pass that 
> check and don't get redirected to a login form. 
> 3. When the 'logout' view logs you out, it doesn't reset 
> 'request.user', so any template rendering which uses an 
> 'is_authenticated()' check will get confused (this is the bug). 
> 4. When the response comes back to your browser, it includes cookie 
> headers which make the logout persist. 
> 
> So if you use the 'logout' view and return a template directly from 
> it, the template may "think" you're logged in even though you're not 
> (you can't actually do anything which requires authentication, it's 
> just that 'request.user' wasn't updated before the template rendered). 
> If you instead have 'logout' redirect to another URL, you'll see 
> everything working intuitively, because that involves a new request 
> which starts out with 'request.user' as an AnonymousUser. 
> 
> Hitting the back button probably causes the behavior you're seeing 
> because some browsers don't actually hit the server on a "back" and 
> instead reload the page from cache, which means you'll see the same 
> thing you saw when you were logged in previously. 
> 
> The confusing aspects of this can be handled by having Django reset 
> 'request.user' on authentication changes (it also doesn't do so on 
> login, which can be somewhat counterintuitive when using things like 
> the registered comments model), so I'll file a ticket for that. 
> 
> -- 
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct." 
> 
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Log out problems

2007-04-11 Thread jeffhg58

I am having a problem when I log out from my site.

Here is the scenario I am using the @login_required for logging into
my site.
Then I have the link to log out very similar to the admin pages.
The only problem I am having is when I log out and either hit the back
button or go to my home
page from the browser it does not give me the login prompt window.
But, when I hit the home button link on the logout page, I get the
login window.

Here is a snippet of my logout function:

def logout_view(request, template_name='registration/
logged_out.html'):
logout(request)
 return render_to_response(template_name, {'title': _('Logged
out')}, context_instance=template.RequestContext(request))

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Calendar widgets not displaying in admin

2007-04-08 Thread jeffhg58
I figured out my problem was missing some files in the admin/media/js directory.



-- Original message -- 
From: "jeffhg58" <[EMAIL PROTECTED]> 

> 
> I have recently purchased a new computer with Windows Vista and have 
> encountered 
> the problem that the calendar widgets are not being displayed in the 
> admin site. I was wondering if anyone came across this problem or have 
> any suggestions. I have enabled javascript in my browser as well. 
> 
> Thanks, 
> Jeff 
> 
> 
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Calendar widgets not displaying in admin

2007-04-08 Thread jeffhg58

I have recently purchased a new computer with Windows Vista and have
encountered
the problem that the calendar widgets are not being displayed in the
admin site. I was wondering if anyone came across this problem or have
any suggestions. I have enabled javascript in my browser as well.

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: cx_Oracle

2007-04-06 Thread jeffhg58
I ran across the same error and I went searching through some of the fixes and 
I find it one of the
fixes for this problem. Off the top of my head I do not know which fix it was. 
But, after I got past this error I ran into some other errors. At this point, I 
had to switch to postgresql until Oracle becomes more stable

Jeff

-- Original message -- 
From: "zundra" <[EMAIL PROTECTED]> 

> 
> Is anyone having success using Oracle with Django? I see that oracle 
> support from the bolder sprint was rolled into trunk however when I 
> issue the command: 
> 
> $python manage.py syncdb 
> 
> I get the error message: 
> 
> return Database.Cursor.execute(self, query, params) 
> cx_Oracle.DatabaseError: ORA-00911: invalid character 
> 
> I currently have the latest trunk release checked out (4939) and I'm 
> also using cx_Oracle 4.3. 
> 
> I don't get any errors when I issue: 
> 
> $python manage.py sqlall 
> 
> Is there something I'm missing or is this a legitimate bug? If so 
> I'll file a ticket asap because I really, really need this to 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Storing milliseconds

2007-03-28 Thread jeffhg58
Basically, I  have django create the table and the snippet from models.py is:

ExecutionStartDate = models.DateTimeField(verbose_name = "Start Date")

And, then I have python load script which is loading the data with simple 
insert statements:

The data in the input file is
created = 22 Nov 2006 13:43:24.43

Through my django scripts it is truncating the .43.

I would assume that if milliseconds is supported that I would have to specify 
it in my models.py definitions.

Thanks,
Jeff

-- Original message -- 
From: "Jeremy Dunck" <[EMAIL PROTECTED]> 

> 
> On 3/27/07, Jonas Maurus wrote: 
> > 
> > On Mar 27, 7:58 pm, "jeffhg58" wrote: 
> .. 
> > > in the database. I am using a datetime field and when I insert the 
> > > record the milliseconds is being truncated. 
> > 
> > I find that strange, because Postgres doesn't natively support a 
> > column-type "datetime". Nevertheless, you can use a timestamp column 
> > for millisecond resolution 
> 
> He means Django's DateTimeField. 
> 
> Django creates a column of type 'timestamp with time zone' for 
> DateTimeField. The postgres docs claim microsecond resolution for 
> both with and without timezone. 
> 
> Can you share some code demonstrating the trouble? 
> 
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Storing milliseconds

2007-03-27 Thread jeffhg58

I am using a postgresql database and was wondering if anyone knew how
to store milliseconds
in the database. I am using a datetime field and when I insert the
record the milliseconds is being truncated.

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Help using rowcolor with cycle command

2007-02-01 Thread jeffhg58

When I display a row, I am trying to display a row in a specific
color.
But, I am a bit confused as to how it should work within the cycle
command.

Here is my line of code.

{% for item in result %}
{{ item }}{% endfor %}

How do you set rowcolors where you want the background of the line to
display in green.

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Custom Manipulator and update foreign key pointer

2007-01-16 Thread jeffhg58


I have a customer manipulator and I am trying to figure out during the
save function how to
get a foreign key pointer updated with a new value.

Here is my save function:

def save(self, new_data):

   print 'new_data is ', new_data
   new_status = new_data['status']
   newstatusid = int(new_status[len('choice')])
   r = Result(
StatusId = newstatusid
   )

But, I get an type error message stating that StatusId needs to be a
class of the Status Table not an int value.

Can anyone tell me what is the best way to get the foreign key pointer
updated.

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Calendar widget example

2007-01-02 Thread jeffhg58


I have a search form where I would like to add the calendar widget for
the date fields.

I have been looking at the admin code but I wanted to know if there was
any other examples out there.

Looking at some other threads I have implemented these steps

1) add an entry to my site's urlpatterns
(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', {'packages':
'django.conf'}),


2) add the following code to the start of the "form" template page.




But, I seem to get hung up on how you implement the specify text field
to display
the calendar widget.

Thanks,
Jeff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to default checkboxfield in customer manipulator

2006-12-03 Thread jeffhg58

I am trying to set the checkboxfield default value to checked but not
sure how you do it.

Here is my formfield for the checkbox

forms.CheckboxField(field_name="current"),

I tried ading checked="checked" but that did not work.

Thanks,
Jeff


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Setting checkbox to check as default value

2006-12-03 Thread jeffhg58

I have a custom manipulator and I am trying to set the checkbox default
to checked.

For example, my field name is:

forms.CheckboxField(field_name="current"),

Not sure how you to do it. I tried putting the attribute after the
field name which did not work.

I also tried right before the formwrapper call as such

# No POST, so we want a brand new form without any data or errors.
errors = {}
new_data['current'] = "checked='checked'"

Thanks,
Jeff


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Populating select field in custom manipulator

2006-11-29 Thread jeffhg58

I am trying to use a customer manipulator to build a search screen. One
of my
fields is a select field but I get an error to many values to unpack.

Any help would be greatly appreciated.

views.py

class SearchResults(forms.Manipulator):
def __init__(self):
projects = ['Gen2', 'CRMC']
self.fields = (
forms.TextField(field_name="resultsid"),
forms.TextField(field_name="testname", length=30),
forms.TextField(field_name="startdate"),
forms.TextField(field_name="enddate"),
forms.TextField(field_name="submitdate"),
forms.TextField(field_name="submitenddate"),
forms.TextField(field_name="owner"),
forms.SelectField(field_name="project", choices=projects),
   }

def create_results(request):
manipulator = Results.AddManipulator()

if request.method == 'POST':
# If data was POSTed, we're trying to create a new Results.
new_data = request.POST.copy()

# Check for errors.
errors = manipulator.get_validation_errors(new_data)

if not errors:
# No errors. This means we can save the data!
manipulator.do_html2python(new_data)
new_results = manipulator.save(new_data)

# Redirect to the object's "edit" page. Always use a
redirect
# after POST data, so that reloads don't accidently create
# duplicate entires, and so users don't see the confusing
# "Repost POST data?" alert box in their browsers.
return HttpResponseRedirect("/results/edit/%i/" %
new_results.id)
else:
# No POST, so we want a brand new form without any data or
errors.
errors = new_data = {}


# Create the FormWrapper, template, context, response.
form = forms.FormWrapper(manipulator, new_data, errors)
return render_to_response('results/create_form.html', {'form':
form})

Thanks,
Jeff


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Drop down not displaying foreign key values

2006-11-12 Thread jeffhg58

Hi,

I am relatively new with Django. With the admin interface I have a main
table with foreign key table to supporting files. When I try and add a
new record, the drop down field is only displaying the value of Status
Object instead of the value of the Status field in the supporting
table. Not exactly sure what the problem is. Any help would be greatly
appreciated.

Here is my models.py script

from django.db import models

class Status(models.Model):
Status = models.CharField(maxlength=50)

class Admin:
list_display = ['Status']



class Station(models.Model):
StationName = models.CharField(maxlength=50)

class Admin:
list_display = ['StationName']

class Project(models.Model):
ProjectName = models.CharField(maxlength=50)

class Admin:
list_display = ['ProjectName']

class Phase(models.Model):
PhaseName = models.CharField(maxlength=50)

class Admin:
list_display = ['PhaseName']

class Type(models.Model):
TypeText = models.CharField(maxlength=50)
Category = models.CharField(maxlength=50)

class Admin:
list_display = ['TypeText', 'Category']

class Results(models.Model):
TestName = models.CharField(maxlength=50)
TestVersion = models.CharField(maxlength=50)
ExecutionStartDate = models.DateTimeField('Execution Start Date')
StatusId = models.ForeignKey(Status)
ExecutionTime = models.IntegerField(core=True)
StationId = models.ForeignKey(Station)
SubmitDate = models.DateTimeField('Submit Date')
Owner = models.CharField(maxlength=50)
ProjectId = models.ForeignKey(Project)
PhaseId = models.ForeignKey(Phase)
TestTypeId = models.ForeignKey(Type)
UserIntervention = models.BooleanField()

class Admin:
list_display = ['TestName', 'TestVersion']

Thanks,
Jeff


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---