Re: Form wizard problem

2008-06-04 Thread tyman26

Unless I am really mistaken, I am pretty sure this is a bug.  The
"self.step" variable in "wizard.py" is never being updated after the
forms are submitted.  These are two possible fixes I found:

1.  In the method "def __call__(self, request, *args, **kwargs) :"
update the self.step variable after checking if the form is valid.
 **Coding
 Revision:
  if form.is_valid():
   ..
   if next_step == num:
.
   else:
form = self.get_form(next_step)
current_step = next_step
self.step = current_step   #this would be the
newly added code

2.  In the method "def render_template(self, request, form,
previous_fields, step, context=None):" replace "self.step" with the
functions "step" argument value instead.
 Coding*
 Previous:
  context.update(self.extra_context)
  return render_to_response(self.get_template(self.step),
dict(context,...
 Revision:
  context.update(self.extra_context)
  return render_to_response(self.get_template(step),
dict(context,...

If anyone can verify that they have the same problem, I will submit
this to a bug fix.  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
-~--~~~~--~~--~--~---



Form wizard problem

2008-06-04 Thread tyman26

Hi,
  I am having a problem getting the form wizard to load a different
template for each form.  I used the example provided where they name
their templates template_0.html, template_1.html ... and so then
override the function like this:

def get_template(self, step):
return 'vlis/production/order/template_%s.html'  % step

I stepped through the code with a debugger and noticed that every time
it his "get_template(self, step)" the variable step always stays at
0.  Shouldn't this increment for every step in the form?  Not sure if
this is just me doing something wrong or possibly a glitch.  Any help
would be much appreciated.

Regards,

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



direct_to_template and extra_content

2007-08-08 Thread tyman26

Is it possible to use a parameter from the url with the extra_content
dictionary when using the generic direct_to_template?  I know it
executes functions within the extra_content right before loading the
template, so I would think you should be able to access this someone.
Any help would be much appreciated, thanks!  Here is my code:

from django.conf.urls.defaults import *
from main_site.transaction.models import TransactionEvent

def getUserName(transaction_event_id):
..
return username

urlpatterns = patterns('django.views.generic.simple',
(r'^rollback/(?P\d+)','direct_to_template',
{'template': 'error_page/rollback.html', 'extra_context':
{'username':getUserName('??transaction_event_id??')}}),
)

As you can see I want to use the transaction_event_id from the url
with the getUserName function.  Is this even possible?


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



model and cascading

2007-07-18 Thread tyman26

Is it possible to set a property in my model that will set update
cascade/delete to true when the tables are generated?  I know models
automatically do this anyways when you delete or update, but if I am
working directly with database information it doesn't work
consistently.   I know it's possible to simply alter  the table within
my database, but if I rebuild the tables with django then I have to
redo this every time.  Is this my only solution?


--~--~-~--~~~---~--~~
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: loading xml through javascript

2007-07-10 Thread tyman26

Thanks for the advice, I added the information to the session and can
now access it through the xml page.  This doesn't seem like the best
way to do this, but it works.  Is this type of coding bad practice?



On Jul 9, 5:47 pm, Collin Grady <[EMAIL PROTECTED]> wrote:
> Unless the object supports post params, that's not possible. You have
> to submit the data through the XML request, you can't just hijack it
> from the other.
>
> The only other option I can see is if you do something like shoving
> everything in request.session and reading that in the other page.
>
> On Jul 9, 3:36 pm, tyman26 <[EMAIL PROTECTED]> wrote:
>
> > I'm using an activex control that loads data with xml via javascript.
> > I have no problem using django to build my xml file when I'm testing
> > examples with static information.  The problem comes in when I want to
> > pass dynamic information to the xml generated view.  For example, here
> > is a template called 'results.html' which loads my activex widget:
> > .
> > 
> > 
> > 
> > 
> > mygrid = new dhtmlXGridObject('gridbox');
> > ...
> > mygrid.loadXML("<a  rel="nofollow" href="http://192.168.xx.xx/search/buildXML&quot">http://192.168.xx.xx/search/buildXML&quot</a>;);
> > 
> > .
>
> > As you can see I load the xml document through the url called /search/
> > buildXML.   The only problem is I want request information from the
> > view that opens this template to also be available in the view that
> > creates my xml code. I don't want to have to pass it through the
> > url because the information is sensitive.  Does anybody know another
> > way around this?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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 menus with ul,li

2007-06-05 Thread tyman26

I am trying to build dynamic menus that are brought in from a
database.  I set up the table in this structure:
CREATE TABLE auth_menu
(
  menu_id serial NOT NULL,
  group_id int4 NOT NULL,
  parent_id int4,
  auth_permission_id int4,
  title varchar(35) NOT NULL,
  url varchar(100),
  order_index int4 NOT NULL,
.)

The top level menu is known by the fact that menu_id and group_id are
the same with a null parent_id, and then it goes parent, child If
the menu_id and group_id are the same, then we know its also a top
level menu, but still underneath the main_menu.  If its a bottom level
leaf, then none are the same.  I am stuck on how to build html with ul/
li lists or if it's even possible.  I am certain recursion is needed.
Does anyone have an idea where to look for a solution to this problem?


--~--~-~--~~~---~--~~
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: django admin users

2007-06-05 Thread tyman26

I just fixed it, the symlink I created for the admin media directory
was incorrect.   Thanks anyways!


On Jun 5, 10:58 am, "Justin Lilly" <[EMAIL PROTECTED]> wrote:
> based on user, user portion... did your database change at all? Is there two
> user columns?
>
> On 6/5/07, tyman26 <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > I saw a previous post about this same thing a couple weeks ago, but
> > there was no response to it.  Whenever I use the admin site and try to
> > access a user, I get this error message:
>
> > "TypeError at /admin/auth/user/3/"
> > "Cannot resolve keyword 'user' into field. Choices are: permissions,
> > user, user, id, name"
>
> > I recently converted the old login form with newforms and I'm thinking
> > that may have something to do with it, but I don't see why this would
> > conflict with anything.  I login basically the same exact way.  If
> > anyone has any ideas I would much appreciate it, thanks.
>
> > -Tyson
>
> --
> Justin Lilly
> University of South Carolina


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



django admin users

2007-06-05 Thread tyman26

I saw a previous post about this same thing a couple weeks ago, but
there was no response to it.  Whenever I use the admin site and try to
access a user, I get this error message:

"TypeError at /admin/auth/user/3/"
"Cannot resolve keyword 'user' into field. Choices are: permissions,
user, user, id, name"

I recently converted the old login form with newforms and I'm thinking
that may have something to do with it, but I don't see why this would
conflict with anything.  I login basically the same exact way.  If
anyone has any ideas I would much appreciate it, thanks.

-Tyson


--~--~-~--~~~---~--~~
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: special session-time usecase

2007-05-31 Thread tyman26

Ok, I just read into middleware a bit more and I see the possibilities
now.  I'm going to attempt to write this and I'll post the results
once I'm done.  This seems like something people might want at their
disposal.  Thanks for the assistance.


ringemup wrote:
> On May 31, 3:14 pm, tyman26 <[EMAIL PROTECTED]> wrote:
> > That makes a lot more sense to me now, thanks for the explanation!
> > The only thing that worries me is repetition.  It seems like it would
> > get very repetitive implementing this inside every view in the entire
> > project.  Is there somewhere else you can check everytime a request is
> > made?
>
> I'm pretty certain that that's what middleware does.


--~--~-~--~~~---~--~~
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: special session-time usecase

2007-05-31 Thread tyman26

That makes a lot more sense to me now, thanks for the explanation!
The only thing that worries me is repetition.  It seems like it would
get very repetitive implementing this inside every view in the entire
project.  Is there somewhere else you can check everytime a request is
made?


On May 31, 1:39 pm, ringemup <[EMAIL PROTECTED]> wrote:
> > I see what you are saying, but I want the user to be automatically
> > logged out after a period of inactivity for security purposes.
>
> Yes, this accomplishes that.
>
> > 1)  Do you mean I would check the last time they saved and then
> > compare it with a time limit everytime they alter a session?
>
> Yes, basically, except that you're setting a session parameter on
> every page load, which is what you're checking against, rather than
> against the last time the user saved something.
>
> > 2)  If the time limit has been surpassed, would I disallow the
> > transaction and then log them out?
>
> Yes.
>
> > I was hoping there was another way where somehow the system would
> > check constantly and expire old sessions and cookies automatically.
> > I'm still unsure how something could sit in the background and check
> > every minute, not  sure if its even possible.
>
> Why would you need to actively cause them to expire, as long as
> they're refused when someone tries to accomplish something with them?
> If you log the user out upon any request after the expiration time,
> you get the same effect.  The session becomes an expired session
> whether or not you delete the cookie, and whether or not the user ever
> returns to the site.  Not sure if I'm explaining this clearly.
>
> In pseudo-code...
>
> on every request:
>   if (session['last_activity'] > (now - 30min)):
> user.logout()
> session.destroy()
> session.create()
> session['last_activity'] = now
> redirect('/login_url')
>   else:
> session['last_activity'] = now
> execute_requested_view()


--~--~-~--~~~---~--~~
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: special session-time usecase

2007-05-31 Thread tyman26

I see what you are saying, but I want the user to be automatically
logged out after a period of inactivity for security purposes.

1)  Do you mean I would check the last time they saved and then
compare it with a time limit everytime they alter a session?
2)  If the time limit has been surpassed, would I disallow the
transaction and then log them out?

I was hoping there was another way where somehow the system would
check constantly and expire old sessions and cookies automatically.
I'm still unsure how something could sit in the background and check
every minute, not  sure if its even possible.


On May 31, 12:07 pm, ringemup <[EMAIL PROTECTED]> wrote:
> Why not store a parameter in the session indicating when it was last
> saved.  On each page load, first check that parameter and if it's too
> long ago, discard the session and begin a new one.  Then update the
> parameter with the current time.
>
> You may need middleware to accomplish this, but it ought to be
> extremely simple to implement.  It won't get rid of the actual cookies
> if the user doesn't return, but it will take care of session
> expiration, and the old cookies shouldn't matter, since they contain
> no session data except the ID, which you're invalidating after a
> certain amount of time anyway.
>
> On May 31, 12:54 pm, tyman26 <[EMAIL PROTECTED]> wrote:
>
> > I also need to implement this type of feature.  Did you find anything
> > on this?
>
> > On May 2, 12:29 pm, [EMAIL PROTECTED] wrote:
>
> > > Hi all,
>
> > > I use django.contrib.sessionswith SESSION_EXPIRE_AT_BROWSER_CLOSE=True.
>
> > > I need a way toexpireasessionon certain amount of time of inactivity in 
> > > the browser.
>
> > > Each new request to django should retrigger theexpiretime.
>
> > > Is there a possibility to modifiy thesessionmodule or build a middleware 
> > > which does this ?
>
> > > Regards,
> > > Dirk
> > > --
> > > "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
> > > Jetzt GMX TopMail testen:http://www.gmx.net/de/go/topmail


--~--~-~--~~~---~--~~
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: special session-time usecase

2007-05-31 Thread tyman26

I also need to implement this type of feature.  Did you find anything
on this?

On May 2, 12:29 pm, [EMAIL PROTECTED] wrote:
> Hi all,
>
> I use django.contrib.sessions with SESSION_EXPIRE_AT_BROWSER_CLOSE=True.
>
> I need a way toexpireasessionon certain amount of time of inactivity in the 
> browser.
>
> Each new request to django should retrigger theexpiretime.
>
> Is there a possibility to modifiy thesessionmodule or build a middleware 
> which does this ?
>
> Regards,
> Dirk
> --
> "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
> Jetzt GMX TopMail testen:http://www.gmx.net/de/go/topmail


--~--~-~--~~~---~--~~
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: newForms and self.clean_data

2007-05-18 Thread tyman26

Sorry about that, I probably should of noticed.  Thanks for the info!

On May 18, 12:01 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2007-05-18 at 09:49 -0700, tyman26 wrote:
> > Hi,
> >   I built an application with the development version of Django and
> > moved it to Apache.  After I moved it, the self.clean_data variable
> > stopped loading for some reason.  I know you have to validate the data
> > before this is availbable, but I am validating it.  It works fine in
> > the development version, but for some reason it doesn't work in
> > Apache.  Is there something I may be missing here?  Any help would be
> > much appreciated.
>
> Sounds like you aren't using the same codebase (for Django) on both
> machines.
>
> We recently renamed clean_data to cleaned_data and there have been at
> least two threads about that on this mailing list and it's mentioned on
> the BackwardsIncompatibleChanges wiki page.
>
> Regards,
> Malcolm


--~--~-~--~~~---~--~~
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 and self.clean_data

2007-05-18 Thread tyman26

Hi,
  I built an application with the development version of Django and
moved it to Apache.  After I moved it, the self.clean_data variable
stopped loading for some reason.  I know you have to validate the data
before this is availbable, but I am validating it.  It works fine in
the development version, but for some reason it doesn't work in
Apache.  Is there something I may be missing here?  Any help would be
much appreciated.

Here is the code:
#
view
#
def index(request, customer_no=None):
if request.POST:
InstanceForm = CustomerForm(request.POST)
if InstanceForm.is_valid():
instance = InstanceForm.save(True, customer_no)
return HttpResponseRedirect('/customer/%s' %
instance.customer_no)
else:
if customer_no is not None:
instance = Customer.objects.get(customer_no=customer_no)
InstanceForm = CustomerForm(instance=instance)
else:
InstanceForm = CustomerForm()
return render_to_response('customer/customer_index.html',
  {'form': InstanceForm,
'states':getStates()},
  RequestContext(request))

form

class CustomerForm(forms.Form):
def __init__(self, data=None, auto_id='id_%s', prefix=None,
 initial=None, instance=None):
..

#FUNCTION:
#  Saves the form to customer model
#--returns an instance of a Customer object

def save(self, commit, customer_no):
data_dict = {
'customer_no' : customer_no,
'customer_no_index' : customer_no_index,
'customer_no_group_id' : customer_no_group,
'contact_last' : self.clean_data['contact_last'],
'contact_first' : self.clean_data['contact_first'],
   
}
from main_site.customer.models import Customer
instance = Customer(**data_dict)
if commit:
instance.save()
return instance


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

2007-04-05 Thread tyman26

>def add_edit_model(request, id=None):
>   if id is not None:
>instance = MyModel.objects.get(id=id)
>InstanceForm = MyForm(instance=instance)
>else:
>InstanceForm = MyForm()

>if request.POST:
>form = InstanceForm(request.POST)
>if form.is_valid():
>form.save()
>return HttpResponseRedirect('/whatever/url/')
>return render_to_response('template.html', {'form': InstanceForm})

I looked at this previous posting that showed the proper way to
construct add/edit newForms.  I got most of it working, but I am
having trouble saving the edit form.

The line of code  "form = InstanceForm(request.POST)"  doesn't make
any sense.  The InstanceForm was already created so how can you pass
POST information to it again?  When I use this method I keep adding
new items when I really only want to update a current item.  Is there
some other way to pass the POST information to an instance form which
is already created?


--~--~-~--~~~---~--~~
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: do_html2python() in newform??

2007-04-02 Thread tyman26

Should I just manually check every Charfield value after a POST and
set it's value to 'None' when I find an empty string?  Not sure if
that's the best practise or not!


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



do_html2python() in newform??

2007-04-02 Thread tyman26

I noticed that manipulators use do_html2python() to update blank
values to null so that single quotes don't get inserted into records.
Is there anything like that for newForms?  I am trying to save a model
that I manually load information from my newForm data, but all the
blank fields get loaded like this ' '.  Does anyone know any easy way
around this?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: newbie question regarding newForm POST information

2007-03-30 Thread tyman26

I see what you are saying, but I was trying to do something a little
more complicated.  I wasn't trying to validate any data, but rather
load choices into a select box based on information from the POST.  I
have 2 select boxes in a form where one has info regarding all the
countries in the world.  Onces the user selects a country, I populate
another select box with all the states for that country.  I decided to
do most of this with javascript and got it working that way.

But then I ran into another problem.  If the page has an error and is
reloaded then the states aren't populated in the select box again.  I
had to update the constructor in my form and update those select boxes
manually with the correct choices.  What I didn't know previously was
a form constructor always has a self.data variable once a request is
passed in.  Here is my code if anyone is interested:

from main_site.static.models import StaticCountries, StaticRegions
def __init__(self, *args, **kwargs):
super(CustomerAdd, self).__init__( *args, **kwargs)

#checking if this is post information
if (self.is_bound == True):
#we have to check if the user selected a country in
mailing/shipping/or billing select boxes
#...if they did, then we have to populate the state select
box
#   with the corresponding states for that country
if (self.data.get('mailing_country') != "None"):
self.fields['mailing_state'].choices = ([x.region,
x.region] for x in
StaticRegions.objects.filter(country_code=self.data.get('mailing_country')).order_by("region"))



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



newbie question regarding newForm POST information

2007-03-30 Thread tyman26

Is it possible to access the POST information from within my forms.py
file after a page submission?  I am confused on how to access this
information from within the constructor of if I can even do this.

--
forms.py
--
from django import newforms as forms
class CustomerAdd(forms.Form):
def __init__(self, *args, **kwargs):
super(CustomerAdd, self).__init__( *args, **kwargs)


views.py

if request.method == 'POST':
form = CustomerAdd(request.POST)


--~--~-~--~~~---~--~~
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: maxlength is always 10 with text widget

2007-03-30 Thread tyman26

> txtfld_attrs_dict = { 'class': 'default_txt_field'}
> contact_first =
> forms.CharField(widget=forms.TextInput(attrs=txtfld_attrs_dict),max_length=25,label=u'Contact
>  First')

I figured out the problem, you have to set the dictionary
representation within the widget parameter if you use a variable for
the attributes.

For example:"attrs=dict(txtfld_attrs_dict)" instead of
"attrs=txtfld_attrs_dict"



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



maxlength is always 10 with text widget

2007-03-29 Thread tyman26

I have a charField in a newForm with a max_length=25, but when I load
the form it gets set to 10 everytime.  If I get rid of the widget,
then the max_length is set correctly at 25.   Does anyone know why the
widget would automatically set the maxlength to a default value?  Here
is my code:

txtfld_attrs_dict = { 'class': 'default_txt_field'}
contact_first =
forms.CharField(widget=forms.TextInput(attrs=txtfld_attrs_dict),max_length=25,label=u'
Contact First')


--~--~-~--~~~---~--~~
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: populating choice in newForm instance

2007-03-28 Thread tyman26

How would you go about reloading the page?  Would you submit the form
and post the information back again?   I guess I'm having trouble
figuring out how to reload the page and keep the same information that
was previously there, plus load the states in the select box.

On Mar 28, 12:48 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> On Mar 27, 5:10 pm, "tyman26" <[EMAIL PROTECTED]> wrote:
>
> > I guess a simpler quesiton would be:  How can I populate a text box
> > dynamically withinformationfrom thepostfrom the same form?  Or is
> > there maybe another way to accomplish this possibly with a custom
> > inclusion tag?  Any help would be much appreciated.  There must be
> > some easier way to do this.
>
> Once your web page has loaded and your user selected an option (the
> mailing country choice), the only ways I can think of modifying the
> contents of a second control on the same webpage is either modifying
> the data of the control dynamically using Javascript or reloading the
> page.
> Roberto Zoia


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

2007-03-28 Thread tyman26

Is there anyway to populate a choicefield after a form submission.
Once a user changes a choice in one select box, I want the form to
submit and then populate a different select box based on what they
chose.  I have a choicefield with a list of countries. Once the user
chooses a country I want all the states for that country to load into
another choicefield.  I can't figure out the best way to do this.  Am
I stuck using javascript for this scenario?


--~--~-~--~~~---~--~~
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: populating choice in newForm instance

2007-03-27 Thread tyman26

I guess a simpler quesiton would be:  How can I populate a text box
dynamically with information from the post from the same form?  Or is
there maybe another way to accomplish this possibly with a custom
inclusion tag?  Any help would be much appreciated.  There must be
some easier way to do this.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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 choice in newForm instance

2007-03-27 Thread tyman26

I have a form with 2 select boxes that I load into a template.
Initially the "mailing country" choice is loaded with all available
countries and the "mailing states" is empty because a country hasn't
been selected yet.  When a user selects a "mailing country" choice, I
want all the states from that country to populate in the "mailing
state" choice box.  I know this is all possible with javascript on the
fly, but I would rather not code it that way.  I have tried posting
the information back to the same page once the user changes the select
box, but if the user has any errors those are displayed too.  Can I
somehow reload the page and keep the information that was previously
there, and then restrict the errors from being shown.

Here is my code:
-
--FORMS.PY--
-
class CustomerAdd(forms.Form):

mailing_country =
forms.ChoiceField(widget=forms.Select(attrs={'onChange':'country_change()'}),
choices=StaticCountries().GetListForSelect(), label=u'Mailing
Country', required=False)

mailing_state =
forms.ChoiceField(choices=StaticRegions().GetListForSelect(None),
label=u'Mailing State', required=False)


--VIEWS.py---
-
def customer_add_view(request):
if request.method == 'POST':
form = CustomerAdd(request.POST)
"""
if form.is_valid():
entry = form.save(commit=False)
entry.save()
return HttpResponseRedirect("/")
"""
else:
form = CustomerAdd()
t = loader.get_template('customer/new_customer.html')
c = Context({
'form': form,
'is_valid':form.is_valid()
})
return HttpResponse(t.render(c))
--
TEMPLATE.PY---
--

function country_change(){
  document.forms[0].method = "get";
  document.forms[0].submit();
}


{{test}}


{{form.mailing_country.label}}{{form.mailing_country}}{{form.mailing_country.errors}}


{{form.mailing_state.label}}{{form.mailing_state}}{{form.mailing_state.errors}}






--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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 validation with newForms

2007-03-22 Thread tyman26

I want to create some custom validation methods for some fields in a
model that I have.  I use a form to display this model through a
view.  Anyways, does this mean I can't use
"forms.models.form_for_model(Employee)"?  Would I have to create this
form seperately from the model instead of appending it in the view?
It seems like that would be redundant.  I tried adding some validators
within the model itself, but when I test them through my view it
doesn't raise a validation error.


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



SESSION_EXPIRE

2007-03-19 Thread tyman26

Where do I set the 'SESSION_EXPIRE_AT_BROWSER_CLOSE = True'?  I added
this to the "settings" file and sync'd the database, but when I close
the browser the session still stays intact.  Do I have to add this
when the session is created?


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