Re: Django on Apache (mod_python) administration cookie problem

2008-10-24 Thread M.Ganesh





Graham,
Option 3: I use other utilities like wordpress and phpMyAdmin, so I
cannot afford to disable php completely
Option 2: I use Linux Mint (Ubuntu variant) for developement and Debian
Etch for production. So for option 2, I will require two sets of
instructions, which means more trouble for you. So let me skip that.
Option 1: If this work around works for me, I'll get going and think of
better permanent solutions later
Kindly help me on option one (disabling PHP mhash)

Thanks in advance

Regards Ganesh

Graham Dumpleton wrote:

  Disabling the PHP mhash module is only a workaround even if it does
work.

The proper fix if it is this issue is to refresh your Python 2.4
installation to get fixed version from Debian repository, or even
perhaps upgrade to Python 2.5 and newer mod_python version which uses
Python 2.5.

Alternatively, disable PHP from Apache completely if you do not need
it.

Which of the three options don't you understand and are wanting more
detail for?

Graham

  
  
Thanks in advance

Regards Ganesh

Daniel bodom_lx Graziotin wrote:


  Thank you very much for your replies, Alvaro and Graham!
Removing php5-mhash solved the 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 on Apache (mod_python) administration cookie problem

2008-10-21 Thread M.Ganesh

Hi Daniel,

I am also facing the same problem. I really can't understand the 
technicalities of the solution offered in this thread. Since you seemed 
to have solved the problem, can you please give a little more details on 
how to do it

Thanks in advance

Regards Ganesh

Daniel bodom_lx Graziotin wrote:
> Thank you very much for your replies, Alvaro and Graham!
> Removing php5-mhash solved the 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: Cookie problem

2008-09-22 Thread M.Ganesh

plungerman wrote:
> On Sep 19, 11:40 am, "M.Ganesh" <[EMAIL PROTECTED]> wrote:
>   
>> Getting the following error message when I try to access the admin page
>> of my spanking new django 1.0 installation :
>> "Looks like your browser isn't configured to accept cookies. Please
>> enable cookies, reload this page, and try again."
>> 
>
> are you using a login form that is not using the
> django.contrib.auth.auth_views.login view for GET?  that is, you have
> a form that might be, say, part of your sidebar navigation and that
> form uses that a URI like /accounts/login/ as the action of a "post"
> form, which has as its view  django.contrib.auth.auth_views.login.  if
> that is the case, then you would be seeing the error you described
> above.  we have a couple of clients that wanted a login form on all
> pages in the header.  the action of the form is /accounts/login/ and
> the form would be replaced by user links like change password, update
> info, etc.  the form did not work at first and we saw the same error
> about cookies, which is because that view tries set a test cookie and
> if the test cookie is not present, then upon POST, the form returns
> the cookie error.  the only solution i found was to comment out the
> test cookie portion of the django source, which IMO is not necessary
> and sort of a relic from a time when folks would actually turn off
> cookies for privacy reasons.
>
>   
>> Other information :
>> 1. django 0.96 working well in the same laptop and browser. My
>> production site continues to run
>> 2. Using Firefox 3 on Linux Mint OS (an Ubuntu derivative)
>> 3. In Firefox preferences both 'Accept cookies from sites' and 'Accept
>> third-party cookies' options are enabled
>> 4. My google search brought-up Changeset 8509, but that's t
>> technical for me to comprehend
>> Thanks for the help in advance
>>
>> Regards Ganesh
>> 
Hi plungerman,


Thanks for your mail. I am not trying to do anything complicated (yet). 
I just setup Django 1.0, not even created any models. I just wanted to 
see the admin page before porting my models from the 0.96 installation. 
Could you please hint me how to find and comment out the test cookie 
portion? I am only 6 months old with python and django, but I am willing 
to make an attempt.

Regards Ganesh


--~--~-~--~~~---~--~~
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: [Fwd: Cookie problem]

2008-09-20 Thread M.Ganesh

Malcolm Tredinnick wrote:
> On Sun, 2008-09-21 at 07:17 +0530, M.Ganesh wrote:
>   
>> Anyone?
>>
>> 
>
> After all it's almost 24 hours since the last time you posted. And that
> was a repeat of the thing you sent 24 hours or so before that. On a
> weekend. It's amazing that people might actually be doing other things
> instead of dropping everything to debug your particular problem.
>
> Please show some appreciation that everybody helping out on this list is
> a volunteer! Everybody sees the email that is posted to the list.
> Posting the same question multiple times in multiple threads is only has
> the affect of being annoying. You're not going to get 10,000 people
> posting "I don't know", only people who actually know what the solution
> might be or have some time to debug it will post a reply. So if nobody's
> posted a reply, it means that nobody yet knows the answer.
>
> Malcolm
>
>   
Sorry, I didn't intend to be rude.

I couldn't figure out even an inelegant workaround to that problem, and 
couldn't progress even a bit. That was why I became little impatient.

Apologies once again

Ganesh


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



[Fwd: Cookie problem]

2008-09-20 Thread M.Ganesh

Anyone?

I tried with 'runserver' instead of apache. The problem didn't go away.

Kindly give me some pointers

Regards Ganesh


 Original Message 

Hi,

The  in my  apache  config file has ServerName django1.

I access the site with http://django1/admin/.  I get a login page. when 
I give my username and password, I get the message given below. When I 
check the firefox cookies there is a cookie with name sessionid for this 
django1 site.

What am I doing wrong?

Thanks in advance

Regards Ganesh

 Original Message 

Getting the following error message when I try to access the admin page 
of my spanking new django 1.0 installation :
"Looks like your browser isn't configured to accept cookies. Please 
enable cookies, reload this page, and try again."

Other information :
1. django 0.96 working well in the same laptop and browser. My 
production site continues to run
2. Using Firefox 3 on Linux Mint OS (an Ubuntu derivative)
3. In Firefox preferences both 'Accept cookies from sites' and 'Accept 
third-party cookies' options are enabled
4. My google search brought-up Changeset 8509, but that's t 
technical for me to comprehend

Thanks for the help in advance

Regards Ganesh






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



Cookie problem

2008-09-19 Thread M.Ganesh


Hi,

The  in my  apache  config file has ServerName django1.

I access the site with http://django1/admin/.  I get a login page. when 
I give my username and password, I get the message given below. When I 
check the firefox cookies there is a cookie with name sessionid for this 
django1 site.

What am I doing wrong?

Thanks in advance

Regards Ganesh

 Original Message 

Getting the following error message when I try to access the admin page 
of my spanking new django 1.0 installation :
"Looks like your browser isn't configured to accept cookies. Please 
enable cookies, reload this page, and try again."

Other information :
1. django 0.96 working well in the same laptop and browser. My 
production site continues to run
2. Using Firefox 3 on Linux Mint OS (an Ubuntu derivative)
3. In Firefox preferences both 'Accept cookies from sites' and 'Accept 
third-party cookies' options are enabled
4. My google search brought-up Changeset 8509, but that's t 
technical for me to comprehend

Thanks for the help in advance

Regards Ganesh




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



Cookie problem

2008-09-19 Thread M.Ganesh

Getting the following error message when I try to access the admin page 
of my spanking new django 1.0 installation :
"Looks like your browser isn't configured to accept cookies. Please 
enable cookies, reload this page, and try again."

Other information :
1. django 0.96 working well in the same laptop and browser. My 
production site continues to run
2. Using Firefox 3 on Linux Mint OS (an Ubuntu derivative)
3. In Firefox preferences both 'Accept cookies from sites' and 'Accept 
third-party cookies' options are enabled
4. My google search brought-up Changeset 8509, but that's t 
technical for me to comprehend

Thanks for the help in advance

Regards Ganesh


--~--~-~--~~~---~--~~
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: [Fwd: Custom field in JSON serializer]

2008-06-28 Thread M.Ganesh

Russell Keith-Magee wrote:
> On Sat, Jun 28, 2008 at 6:03 PM, M.Ganesh <[EMAIL PROTECTED]> wrote:
>   
>>  people who asked after me got their answers, sometimes
>> within 15 minutes. I've not got any answers 
>> 
>
> Don't worry - we still love you. :-)
>
>   
>> How do I extend this to do the following:
>>
>> data = serializers.serialize('xml', SomeModel.objects.all(),
>> fields=('name','size', '__unicode__'))
>> 
>
> You can't. fields can only contain the name of fields on your model.
>
> There is an enhancement request in the ticket system (#5711) which
> would add the ability to serialize arbitrary model attributes.
> However, there hasn't been a lot of work on that ticket, and I
> wouldn't expect to see a solution for v1.0.
>
> Yours,
> Russ Magee %-)
>
>   
Thank Will & Russell,

Sorry for being impatient.

Can I use the existing serializer with a list? If yes may be I can 
construct the list by hand and then serialize. The list will have less 
than 10 entries only

Regards Ganesh



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



[Fwd: Custom field in JSON serializer]

2008-06-28 Thread M.Ganesh

 people who asked after me got their answers, sometimes 
within 15 minutes. I've not got any answers 

Should I reword my query?

Regards Ganesh


 Original Message 

Hi All,

I picked up this sample code from django documentation:

from django.core import serializers
data = serializers.serialize('xml', SomeModel.objects.all(), 
fields=('name','size'))

How do I extend this to do the following:

data = serializers.serialize('xml', SomeModel.objects.all(), 
fields=('name','size', '__unicode__'))

Thanks in advance

Regards Ganesh




--~--~-~--~~~---~--~~
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: Models in multiple files and django command extensions

2008-06-27 Thread M.Ganesh

Vidja wrote:
> Hi all
>
> Thanks to the help of Magus on IRC i have been able to setup my models
> and their functions as separate files.
> This works great for maintenance (the models.py file is created
> automatically through a (ehm, perl) script)
> But unfortunately it breaks Django command extensions.
> This is the structure I have (between <> means directory):
>
> 
>   
>   views.py
>   __init__.py
>   
>   __init__.py
>   modelfile1.py
>   modelfile2.py
>   modelfile3.py
>
>
> in my __init__.py in  i'm importing modelfile1.py etc.
>
> I can use the models and methods in my views using 'from
> project.app.models import classname'
> So far so good, works like a charm exept that the django command
> extensions does not SEE the models using  shell_plus or graph_models.
> I guess it has something to do with app_label not set but I don't know
> how to.
>
> Could someone help me getting this kind of setup working with the
> command extensions?
>
>   
Do you mean this?

#modelfile1.py

class MyModel(models.Model):
..
..

class Meta:
   app_label = 'your.app.name'

Regards Ganesh

--~--~-~--~~~---~--~~
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: User Filtering

2008-06-27 Thread M.Ganesh



TiNo wrote:
> Maybe even nicer, a selectbox containing all users, and an input that
> pops up on focus to filter. That way the form degrades nicely when js
> is turned off. Makes a big selectbox though...
>
>   
Hi TiNo

I am also looking for a similar solution. Can you please point me to a 
tutorial, walk-through or something

Regards Ganesh


--~--~-~--~~~---~--~~
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 field in JSON serializer

2008-06-26 Thread M.Ganesh

Hi All,

I picked up this sample code from django documentation:

from django.core import serializers
data = serializers.serialize('xml', SomeModel.objects.all(), 
fields=('name','size'))

How do I extend this to do the following:

data = serializers.serialize('xml', SomeModel.objects.all(), 
fields=('name','size', '__unicode__'))

Thanks in advance

Regards Ganesh


--~--~-~--~~~---~--~~
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 use dynamic choice in a ChoiceField

2008-06-26 Thread M.Ganesh

mwebs wrote:
> Thanks Nathaniel,
>
> but where and how do I pass the Queryset? From my view?
> I am sorry but I dont understand completly
>
> class MyModelChoiceField(forms.ModelChoiceField):
> def label_from_instance(self, obj):
> return "My Object #%i" % obj.id
>
>
> class PictureForm(forms.Form):
> image  = forms.ImageField(label='Picture')
> gallery= MyModelChoiceField(..)
>   

No, don't be carried away by the example provided there, that is for a 
slightly complicated case.

class MyForm(forms.Form):
image=  forms.ImageField(label='Picture')
gallery   =  forms.ModelChoiceFiled(/your/query/goes/here)

def my_view(request):
if request.method == 'POST':
form = MyForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect(/sucess/page)
else:
form = MyForm()
return render_to_response('your_template.html, {'form': form})


Hope this helps

Regards Ganesh


--~--~-~--~~~---~--~~
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 use dynamic choice in a ChoiceField

2008-06-26 Thread M.Ganesh

mwebs wrote:
> Hello,
>
> I am trying to do something like this
>
> class PictureForm(forms.Form):
> image  = forms.ImageField(label='Picture')
> gallery= forms.ChoiceField(Gallery.objects.all())
>
> this just works fine, but I only want to pass several Galleries to the
> ChoiceField...
> something like:
>
> ...
> gallery = forms.ChoiceField(Gallery.objects.filter( ...))
>
> so how can I do this?
>
> Thanks,Toni
>
>   
Have a look at ModelChoiceField

http://www.djangoproject.com/documentation/newforms/#fields-which-handle-relationships


Regards Ganesh


--~--~-~--~~~---~--~~
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: help - limit_choices_to

2008-06-22 Thread M.Ganesh

Karen Tracey wrote:
> On Sat, Jun 21, 2008 at 9:23 PM, M.Ganesh <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
> Hi All,
>
> This question might have been answered so may times, but I am
> unable to
> glean the information I am looking for from the 260 odd entries that
> turn up while searching the mailing-list archives. So here I ask again
>
> #my models
> class entity(models.Model):
>name = models.Charfield()
>
> class address(models.Model):
>entity = models.FK(entity)
>  #entites can
> have multiple addresses
>street_address = models.TextField(...)
>
> class despatch(models.Model):
>sent_to = models.FK(entity, related_name = 'receiver')
>address = models.FK(address)
>sent_by = models.FK(entity, related_name = 'sender')
>
> Now when I show a form to enter 'despatch' data, after the user
> selects
> the sent_to 'sent_to' address, I want to show only the addresses
> of that
> entity in the 'address' selection. How do I do it?
>
> Note : I don't know java scripts, AJAX etc yet. If the above can be
> achieved only using  these,  then a  small  code snippet  will
>  help me
> start
>
>
> I have not had to do this myself, so have no code snippet to share.  
> It does seem like a commonly-discussed thing, but in a quick Google 
> search I didn't find anything that matched exactly.  This page:
>
> http://remysharp.com/2007/01/20/auto-populating-select-boxes-using-jquery-ajax/
>
> discusses doing exactly what you want with jQuery and Ajax...and PHP.  
> So not quite what you are looking for.  But this page:
>
> http://www.packtpub.com/article/enhancing-the-user-interface-with-ajax
>
> discusses adding jQuery to a Django app and doing other cool stuff 
> with it. So probably you can glean bits of information from both and 
> put it together to do what you are looking for.  I do believe you need 
> to learn a little Javascript/Ajax to do this.
>
> Karen
Thanks Karen for the leads. I'll follow those breadcrumbs

Regards Ganesh


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

2008-06-21 Thread M.Ganesh

Hi All,

This question might have been answered so may times, but I am unable to 
glean the information I am looking for from the 260 odd entries that 
turn up while searching the mailing-list archives. So here I ask again

#my models
class entity(models.Model):
name = models.Charfield()
  
class address(models.Model):
entity = models.FK(entity)  #entites can 
have multiple addresses
street_address = models.TextField(...)

class despatch(models.Model):
sent_to = models.FK(entity, related_name = 'receiver')
address = models.FK(address)
sent_by = models.FK(entity, related_name = 'sender')

Now when I show a form to enter 'despatch' data, after the user selects 
the sent_to 'sent_to' address, I want to show only the addresses of that 
entity in the 'address' selection. How do I do it?

Note : I don't know java scripts, AJAX etc yet. If the above can be 
achieved only using  these,  then a  small  code snippet  will  help me 
start

Thanks in advance

Regards Ganesh


--~--~-~--~~~---~--~~
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: Timestamped comment field

2008-06-20 Thread M.Ganesh

Chris H. wrote:
> On Jun 19, 12:53 am, "M.Ganesh" <[EMAIL PROTECTED]> wrote:
>   
>> Hi Chris,
>>
>> May be you can try this model :
>> ...
>> 
>
> While I could store each comment off as an instance of a Comments
> model, I don't really have a need to do so.  I'm wanting to have the
> comments stored as a TextField on the main object since there's no
> need to reference them individually.
>
> I suppose I could also create an Abstract Base Class for this,
> something like CommentableItemBase that would have the functionality
> defined there to keep it DRY.
>   
Sorry Chris, I am not able to understand what you mean.

1. Do you mean, you will have one big TextField per object and keep 
appending the comments about that object to the end of that TextField? 
How big will be your TextField then and how many comments you expect per 
object?

2. Are you talking about creating an abstract class similar to the model 
I showed? Go ahead and do it. In fact that was an abstract class in my 
code, and I changed it to a normal class before sending to avoid distraction

HTH

Ganesh


--~--~-~--~~~---~--~~
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: Timestamped comment field

2008-06-18 Thread M.Ganesh

Chris H. wrote:
> Greetings all,
>
> I'm trying to figure out the best DRY way of doing this.  I want to
> have a comments field on several of my models.  The idea behind this
> field is  that it would not actually be stored in the database,
> instead it would be appended to another field with a timestamp and the
> user.  Thus the database storage would look something like:
>
> - 17-JUN-2008 13:42 Bob -
> This is Bob's comment that is stored away and not overwritten by
> Chris's below...
>
> - 18-JUN-2008 17:25 Chris -
> Here is a comment by Chris...he only entered this
>
> The non-DRY way of doing this I imagine would be overriding the save
> function on my models.  I thought maybe I could do this with a custom
> field, but maybe not?
>
> Any thoughts and comments from the folks much smarter then me?? :)
>
> -C
>   
Hi Chris,

May be you can try this model :

class Comment(models.Model):
comment = models.TextField(max_length=300)
added_by = models.CharField(max_length=25)   #or a FK to auth.users
dateadded = models.DateTimeField(auto_now_add=True)

content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()

content_object = generic.GenericForeignKey()

def __unicode__(self):
return self.comment

class Meta:
ordering = ["dateadded"]
   
You have to include 'django.contrib.contenttypes' in your INSTALLED_APPS 
though

HTH

Regards Ganesh



--~--~-~--~~~---~--~~
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: iterate over alphabet in template

2008-06-18 Thread M.Ganesh

Ned Batchelder wrote:
> If you wanted to keep the alphabet issue out of the view, you could 
> also do this:
>
> {% for letter in "ABCDEFGHIJKLMNOPQRSTUVWXYZ" %}
>
> --Ned.
> http://nedbatchelder.com
>
Super. I was just wondering how to do it.

Thanks Ned

Regards Ganesh


--~--~-~--~~~---~--~~
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: iterate over alphabet in template

2008-06-17 Thread M.Ganesh

Joel Bernstein wrote:
> For an easy (but locale-dependent) way to get a list of the uppercase
> characters in Python, try string.uppercase
>
> http://www.python.org/doc/2.3/lib/module-string.html
>
> Just add that list to your context, and you should be ready to go.
>
> On Jun 17, 12:03 pm, "Richard Dahl" <[EMAIL PROTECTED]> wrote:
>   
>> I would probably just pass in a python list with all of the letters in the
>> alphabet, then just
>> {% for l in alphabet_list %} ...
>> -richard
>>
>> On 6/17/08, M.Ganesh <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>> 
>>> Hi All,
>>>   
>>> I am relatively new to both python and django. Please help me to do this :
>>>   
>>> {% for letter in [A to Z] %} < how do I write this line in a template?
>>>{{letter}}
>>> {% endfor %}
>>>   
>>> Thanks in advance
>>> Regards Ganesh
>>>   
Hi Richard and Joel,

Thanks for your lightning fast replies. I tried this and it worked :

#my view function
return render_to_response(template,
  {'object_name' : object.__name__,
   'app_label' : object._meta.app_label,
object_list_name : object_list,
   'base_template'  : base_template,
   'alphabet_string' : ascii_uppercase },
   RequestContext(request))

#my template
{% for letter in alphabet_string %}
{{ letter }}  - 
{% endfor %}

Thanks once again

Regards Ganesh


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



iterate over alphabet in template

2008-06-17 Thread M.Ganesh

Hi All,

I am relatively new to both python and django. Please help me to do this :

{% for letter in [A to Z] %} < how do I write this line in a template?
{{letter}}
{% endfor %}


Thanks in advance
Regards Ganesh



--~--~-~--~~~---~--~~
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: Add filters to the Users List/Page in the admin app

2008-06-13 Thread M.Ganesh

Rajesh Dhawan wrote:
> Hi Rishabh,
>
>   
>> This is what I was thinking, but I thought there was a glimmer of hope of
>> achieving this without moving over to newforms-admin. Is there absolutely no
>> way to do this using trunk??
>> 
>
> There is:
>
> 1. You can tweak the django.contrib.auth models.py file in your local
> installation i.e. tweak list_filters to your needs in User.Admin inner
> class there.
>
> 2. You can disable the auth application, make a copy of it in your own
> Python path, say /my/pythonapps/auth and tweak it there.
>
> 3. You can "monkey patch" the list_filters option on the Admin inner
> class This is highly ugly but won't require you to change the Django
> Admin class. Basically, in one of your root level Python modules'
> __init__.py insert this:
>
> from django.contrib.auth.models import User
> User._meta.admin.list_filter = None # <--- or replace with whatever
> filter you want
>
>   
>> I'll give newforms-admin a shot on my dev box over the weekend and see what
>> comes out of it. I will research this too, but are there any backwards
>> incompatible changes between the current trunk and the newforms-admin
>> branch?? I'm thinking the qs-rf merge maybe introduced some issues...
>> 
>
> Apart from the admin classes being specified in a different way and
> the URLs.py syntax for including admin being different, there should
> be no backward incompatible changes. The newforms-admin (nfa) branch
> fairly frequently imports latest trunk changes. Here's the last merge
> from trunk to nfa: (http://code.djangoproject.com/changeset/7604) In
> particular, all qs-rf changes from trunk are already in nfa.
>
> Hope this helps you decide.
>
>   
Hi Rajesh,

Is it possible for present admin and nf-admin to co-exist?

i.e I change my apps/models to nf-admin one-by-one. So a app/model will 
have old admin until it is changed to nf-admin

Is it possible?

Thanks in advance

Regards Ganesh


--~--~-~--~~~---~--~~
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: Importing data from 'MS Access' .mdb files

2008-06-10 Thread M.Ganesh

Peter Herndon wrote:
> Two possibilities come to mind.  First, is the Python ADODBAPI module:
>  http://sourceforge.net/projects/adodbapi
>
> Second, as an *extremely* useful tool for this sort of thing, may I
> suggest Navicat for MySQL on Windows?  The Windows version allows you
> to import .mdb files and do data transfers directly into MySQL, with
> some mapping.  It may not afford you the entire power of Python for
> manipulating the data, but it will give you a very nice leg up on the
> process.  Not free, but not too expensive, and there is an evaluation
> version so you can see what it will do for you.
>
> If you need to script data transfers and manipulations for multiple
> runs, then the ADODBAPI module will work well.  For figuring out what
> you need to do, Navicat will be a big help, and if your manipulations
> are not extensive, will possibly be entirely sufficient.  Plus, it
> makes a really nice MySQL admin tool (that being its primary purpose).
>
>   
Thanks Peter, I'll have a look.

Thanks for the pointers

Regards Ganesh


--~--~-~--~~~---~--~~
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: Importing data from 'MS Access' .mdb files

2008-06-09 Thread M.Ganesh

chefsmart wrote:
> You may follow these steps:
>
> 1. install the MySQL ODBC connector (currently version 5.1)
> 2. create an empty database
> 3. create a DSN pointing to your newly created empty database
> 4. open your .mdb file in Access
> 5. select your table in Access and go to File->Export...
> 6. In the "save as type", choose ODBC databases(), give a name for the
> table in mysql, and then choose your DSN created in step 3 above.
>
> That's all.
>
> On Jun 9, 7:38 am, Julien <[EMAIL PROTECTED]> wrote:
>   
>> The MySQL migration toolkit has worked quite well for 
>> me:http://www.mysql.com/products/tools/migration-toolkit/
>>
>> On Jun 9, 10:23 am, bacccr <[EMAIL PROTECTED]> wrote:
>>
>> 
>>> also, you can export your data from access to xml (within vb) file and
>>> then load it into your mysql db with python. there is a lot of
>>> options, select the way you familiar with.
>>>   
>>> On 9 июн, 04:30, "Jeffrey Johnson" <[EMAIL PROTECTED]> wrote:
>>>   
>>>> Use access on your Windows PC, Get the ODBC drivers for MySQL, map the
>>>> tables and copy the data in by hand.
>>>> 
>>>> Jeff
>>>> 
>>>> On Sun, Jun 8, 2008 at 10:54 AM, M.Ganesh <[EMAIL PROTECTED]> wrote:
>>>> 
>>>>> Hi All,
>>>>>   
>>>>> I am looking for tools/methods to read(if possible also write) data from
>>>>> .mdb files which are copied into my linux box with python. I require
>>>>> this for coercing existing legacy data into MySQL with some change in
>>>>> the data structure. The ultimate aim is to replace an application
>>>>> developed in VB with django
>>>>>   
>>>>> Thanks in advance
>>>>> Regards Ganesh
>>>>>   
Hi Jeffery, bacccr, Julien, chefsmart & Garrett,

Thanks for all your responses. All the suggested methods are suitable 
for one time migration. Actually I am planning to migrate from VB to 
django in phases. So I may have to update data many times. i.e first 
export a few tables (doing some re-arrangement). After it settles down, 
export few more tables, as well as the new data entered in the phase I 
tables through the VB app. Basically one-time-export-of-tables will not 
work for me. So, if only I can access 'ms access' tables through python, 
I can write a few functions to check if the data has already reached 
MySQL table,  if not add it. The actual .mdb files are in a Windows box, 
so if the setup will require a Windows box it is okay, but it will be 
convenient if I can copy those .mdb files to my linux box, do the 
initial developement and testing and finally point the functions to the 
original .mdb files.

In short I am looking for a way to read(/write) tables in a .mdb file, 
through python.

Any pointers?

Thanks for your time once again

Ganesh


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



Importing data from 'MS Access' .mdb files

2008-06-08 Thread M.Ganesh

Hi All,

I am looking for tools/methods to read(if possible also write) data from 
.mdb files which are copied into my linux box with python. I require 
this for coercing existing legacy data into MySQL with some change in 
the data structure. The ultimate aim is to replace an application 
developed in VB with django

Thanks in advance
Regards Ganesh


--~--~-~--~~~---~--~~
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: Help - m2m field in my model

2008-06-07 Thread M.Ganesh

[EMAIL PROTECTED] wrote:
> The point for those "magic methods" in python is to provide a common
> api to them, it's the same reason you do len(sequence) instead of
> sequence.__len__(), or the reason we do 3 + 4 instead of 3.__add__(4).
>
>   
Thanks for your time

Regards Ganesh


--~--~-~--~~~---~--~~
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: Help - m2m field in my model

2008-06-07 Thread M.Ganesh

[EMAIL PROTECTED] wrote:
> Don't use the internal method, instead do unicode(self.location_type)
> + ' - '
>
>   
Done.

BTW is there any specific reason for this suggestion? 

Thanks
Ganesh


--~--~-~--~~~---~--~~
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: Help - m2m field in my model

2008-06-06 Thread M.Ganesh

Rajesh Dhawan wrote:
>   
>> My model :
>>
>> class phonenumber(models.Model):
>> location_type = models.ForeignKey(location_type)
>> location_description = models.CharField(max_length=50, blank=True)
>>
>> def __unicode__(self):
>> if self.location_description:
>> retval = self.location_description + ' - '
>> else:
>> retval = self.location_type + ' - '
>> return retval
>>
>> class Meta:
>> app_label = 'contacts'
>>
>> I get an error saying :
>> TypeError at /contacts/phonenumber/
>> unsupported operand type(s) for +: 'location_type' and 'str'
>>
>> How do I get the location_type __unicode__ for the fk?
>> 
>
> Emily's suggestion of renaming your ForeignKey to LocationType is a
> good one. If you want to follow more well-defined conventions while
> coding in Python look at PEP 8 here: http://www.python.org/dev/peps/pep-0008/
>
> Adding __unicode__ or __str__ methods to your location_type class is
> not sufficient for the above to work because the + operator can not be
> used in this way where location_type is not a string.
>
> Here are ways that would work:
>
> retval = unicode(self.location_type) + ' - '
> retval = '%s-' % self.location_type
>
> For these two snippets to work 'correctly', you should define
> __unicode__ on your location_type model class. The two snippets above
> will still work without this method, but you will get Python's
> internal representation of location_type.
>
> For a better understanding of this look at __repr__, __str__, and
> __unicode__ here: http://docs.python.org/ref/customization.html
>
>   
Thanks everybody, the following worked:
retval = self.location_type.__unicode__() + ' - '

Emily & Rajesh:
This is my first django project and I was  eager to have it up and 
running. Sure I'll read up on coding conventions and change my code 
accordingly. Thanks once again

Regards Ganesh


--~--~-~--~~~---~--~~
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 - m2m field in my model

2008-06-06 Thread M.Ganesh

Hi,

Excuse me for the dumb question.

My model :

class phonenumber(models.Model):
location_type = models.ForeignKey(location_type)
location_description = models.CharField(max_length=50, blank=True)

def __unicode__(self):
if self.location_description:
retval = self.location_description + ' - '
else:
retval = self.location_type + ' - '
return retval
  
class Meta:
app_label = 'contacts'


I get an error saying :
TypeError at /contacts/phonenumber/
unsupported operand type(s) for +: 'location_type' and 'str'

How do I get the location_type __unicode__ for the fk?

Thanks in advance

Regards Ganesh



--~--~-~--~~~---~--~~
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: generic relations

2008-06-06 Thread M.Ganesh

Filippo Santovito wrote:
> Hi all,
> I've read http://www.djangoproject.com/documentation/models/generic_relations/
> .
> How can I share a tag between Animal and Vegetables?
>
>   
have a look at http://code.google.com/p/django-tagging/

Ganesh


--~--~-~--~~~---~--~~
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-tagging installation problem

2008-06-04 Thread M.Ganesh

Myles Braithwaite wrote:
> I have a patch for version 0.2.1 to get it working with django trunk.
>
> http://media.mylesbraithwaite.com/uploads/files/2008-05-29/django-tagging-0.2.1_fix_for_django_trunk.patch
>  
> ---
> *Myles Braithwaite*
> [EMAIL PROTECTED]
>
> Please consider the trees before print this email.
>
> On 2-Jun-08, at 11:05 PM, M.Ganesh wrote:
>
>>
>> Hi,
>>
>> Running 'python manage.py syncdb' after including 'tagging' in the
>> INSTALLED_APPS throws the following error.
>>
>> My django version : (0, 97, 'pre') r7543 (trunk)
>> Python version : Python 2.5.1 (r251:54863, Mar  7 2008, 03:41:45)
>> django tagging version : (0, 2.1001, None)
>>
>> How do I fix this?
>>
>> Thanks in advance
>>
>> Regards Ganesh
>>
>> Traceback (most recent call last):
>>  File "manage.py", line 11, in 
>>execute_manager(settings)
>>  File
>> "/usr/lib/python2.5/site-packages/django/core/management/__init__.py",
>> line 272, in execute_manager
>>utility.execute()
>>  File
>> "/usr/lib/python2.5/site-packages/django/core/management/__init__.py",
>> line 219, in execute
>>self.fetch_command(subcommand).run_from_argv(self.argv)
>>  File
>> "/usr/lib/python2.5/site-packages/django/core/management/base.py", line
>> 72, in run_from_argv
>>self.execute(*args, **options.__dict__)
>>  File
>> "/usr/lib/python2.5/site-packages/django/core/management/base.py", line
>> 85, in execute
>>self.validate()
>>  File
>> "/usr/lib/python2.5/site-packages/django/core/management/base.py", line
>> 112, in validate
>>num_errors = get_validation_errors(s, app)
>>  File
>> "/usr/lib/python2.5/site-packages/django/core/management/validation.py",
>> line 28, in get_validation_errors
>>for (app_name, error) in get_app_errors().items():
>>  File "/usr/lib/python2.5/site-packages/django/db/models/loading.py",
>> line 126, in get_app_errors
>>self._populate()
>>  File "/usr/lib/python2.5/site-packages/django/db/models/loading.py",
>> line 55, in _populate
>>self.load_app(app_name, True)
>>  File "/usr/lib/python2.5/site-packages/django/db/models/loading.py",
>> line 70, in load_app
>>mod = __import__(app_name, {}, {}, ['models'])
>>  File "/usr/lib/python2.5/site-packages/tagging/models.py", line 9, in
>> 
>>from tagging.managers import TagManager, TaggedItemManager
>>  File "/usr/lib/python2.5/site-packages/tagging/managers.py", line 6,
>> in 
>>from django.db.models.query import QuerySet, parse_lookup
>> ImportError: cannot import name parse_lookup
>>
Thanks Myles, I've already switched to svn version of django-tagging. 
Thanks for offering the patch

Regards Ganesh


--~--~-~--~~~---~--~~
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-tagging installation problem

2008-06-03 Thread M.Ganesh

Matthias Kestenholz wrote:
> On Tue, 2008-06-03 at 08:35 +0530, M.Ganesh wrote:
>   
>> Hi,
>>
>> Running 'python manage.py syncdb' after including 'tagging' in the 
>> INSTALLED_APPS throws the following error.
>>
>> My django version : (0, 97, 'pre') r7543 (trunk)
>> Python version : Python 2.5.1 (r251:54863, Mar  7 2008, 03:41:45)
>> django tagging version : (0, 2.1001, None)
>>
>> How do I fix this?
>>
>> [...]
>> from tagging.managers import TagManager, TaggedItemManager
>>   File "/usr/lib/python2.5/site-packages/tagging/managers.py", line 6, 
>> in 
>> from django.db.models.query import QuerySet, parse_lookup
>> ImportError: cannot import name parse_lookup
>>
>> 
>
>
> You need to install a more recent version of django-tagging. The version
> you have does not work post queryset-refactor merge.
>
>
> Matthias
>   
Thanks Matthias, I downloaded r137 and it installed and 'syncdb'ed.  A 
small observation though. With the packaged version I could do 'import 
tagging  tagging.VERSION' directly on the python interpretor. However, 
with the new version I could do it only in the django shell.

Anyway, thanks for pointing me in the right direction

Regards Ganesh


--~--~-~--~~~---~--~~
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-tagging installation problem

2008-06-02 Thread M.Ganesh

Hi,

Running 'python manage.py syncdb' after including 'tagging' in the 
INSTALLED_APPS throws the following error.

My django version : (0, 97, 'pre') r7543 (trunk)
Python version : Python 2.5.1 (r251:54863, Mar  7 2008, 03:41:45)
django tagging version : (0, 2.1001, None)

How do I fix this?

Thanks in advance

Regards Ganesh

Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_manager(settings)
  File 
"/usr/lib/python2.5/site-packages/django/core/management/__init__.py", 
line 272, in execute_manager
utility.execute()
  File 
"/usr/lib/python2.5/site-packages/django/core/management/__init__.py", 
line 219, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/usr/lib/python2.5/site-packages/django/core/management/base.py", line 
72, in run_from_argv
self.execute(*args, **options.__dict__)
  File 
"/usr/lib/python2.5/site-packages/django/core/management/base.py", line 
85, in execute
self.validate()
  File 
"/usr/lib/python2.5/site-packages/django/core/management/base.py", line 
112, in validate
num_errors = get_validation_errors(s, app)
  File 
"/usr/lib/python2.5/site-packages/django/core/management/validation.py", 
line 28, in get_validation_errors
for (app_name, error) in get_app_errors().items():
  File "/usr/lib/python2.5/site-packages/django/db/models/loading.py", 
line 126, in get_app_errors
self._populate()
  File "/usr/lib/python2.5/site-packages/django/db/models/loading.py", 
line 55, in _populate
self.load_app(app_name, True)
  File "/usr/lib/python2.5/site-packages/django/db/models/loading.py", 
line 70, in load_app
mod = __import__(app_name, {}, {}, ['models'])
  File "/usr/lib/python2.5/site-packages/tagging/models.py", line 9, in 

from tagging.managers import TagManager, TaggedItemManager
  File "/usr/lib/python2.5/site-packages/tagging/managers.py", line 6, 
in 
from django.db.models.query import QuerySet, parse_lookup
ImportError: cannot import name parse_lookup



--~--~-~--~~~---~--~~
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: url parameters go missing

2008-05-31 Thread M.Ganesh

Karen Tracey wrote:
> On Sat, May 31, 2008 at 3:29 AM, M.Ganesh <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
> Karen Tracey wrote:
> > On Fri, May 30, 2008 at 9:48 PM, Karen Tracey
> <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote:
> >
> > On Fri, May 30, 2008 at 7:53 PM, M.Ganesh
> <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> > <mailto:[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>>> wrote:
> >
> >
> > Hi All,
> >
> > I have this url to start a note_l1 addition :
> > '/contacts/note_l1/add/?entity=2'
> >
> > This reaches the server and my code intact. An 'Add; page is
> > displayed.
> > After I fill the form and press the 'Add' button only the
> > '/contacts/note_l1/add/' portion reaches the server. the
> > '?entity=2'  is
> > missing. I want to use this 'entity=2' info to redirect
> to the
> > relevant
> > page. Unable to figure out what is happening. Can somebody
> > kindly have a
> > look.
> >
> > The details are here : http://dpaste.com/hold/53853/
> >
> > Thanks in advance
> >
> >
> > The url used for the form's POST is specified on the 
> action
> > attribute.  What are you specifying for action= in your
> template?
> > Dot goes back to the same page, but I don't believe it carries
> > along query strings.  So if you want your POST to include a
> query
> > string I think you'll need to pass it through from the GET
> > handling part of your view into your template so it can be
> > included as part of the form's action attribute.
> >
> >
> > Oops, also meant to mention probably a more common way of handling
> > this kind of thing is via a hidden field in your form.
> >
> > Karen
> Thanks Karen for your suggestion. But I further played around with the
> above setup and have some intriguing observations.
>
> Instead of adding a 'note_l1' object, I tried adding a 'emailid'
> object.
> The view function worked as expected. The differences   between the
> 'note_l1' and 'emailid' objects, as far as I could see are :
> 1. 'emailid' is a plain model whereas 'note_l1' is inherited from an
> abstract model.
> 2. 'note_l1'  involves genericRelations
>
>
> The really significant difference between your other models and your 
> new emailid model is email id has an 'entity' field.  So when you POST 
> the form to create a new emailid this line of code:
>
> if request.REQUEST.has_key('entity'):
>
> returns True.  But it's pulling 'entity' from the post data, not from 
> the query string.  As you note in your annotation of the runserver 
> output, there is no query string included in the POST.  The entity 
> value you get here will be whatever the user has selected for 'Entity' 
> in the posted form, it is not going to be tied at all to the 'entity' 
> query parameter on the original url.
>  
>
> Yes, it is action = "." indeed in the template
>
>
> So based on experimentation (I haven't bothered to look it up in any 
> standard), I believe this is where you lose the query string.  Form 
> action="." goes back to the url used for the GET, minus any query string.
>
> Karen
>
> The details (Version 2.0) are here : http://dpaste.com/hold/53887/
>
> My Django version 0.97-pre-SVN-7543
>  
> Hope you can spend some more time on this.
>
> Thanks in advance
>  
> Regards Ganesh
>
Thanks Karen, for providing the insight into 'POST' behavior. I'll use 
hidden fields to achieve my purpose.

Incidentally,  I  tried the above code with Apache-mod_python as well. 
The access.log of apache is here : http://dpaste.com/hold/54002/.  There 
POST request also get the url parameters. Still it behaves the same way 
as with runserver.

Thanks for your time once again
Regards Ganesh


--~--~-~--~~~---~--~~
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: url parameters go missing

2008-05-31 Thread M.Ganesh

Karen Tracey wrote:
> On Fri, May 30, 2008 at 9:48 PM, Karen Tracey <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> On Fri, May 30, 2008 at 7:53 PM, M.Ganesh <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
> Hi All,
>
> I have this url to start a note_l1 addition :
> '/contacts/note_l1/add/?entity=2'
>
> This reaches the server and my code intact. An 'Add; page is
> displayed.
> After I fill the form and press the 'Add' button only the
> '/contacts/note_l1/add/' portion reaches the server. the
> '?entity=2'  is
> missing. I want to use this 'entity=2' info to redirect to the
> relevant
> page. Unable to figure out what is happening. Can somebody
> kindly have a
> look.
>
> The details are here : http://dpaste.com/hold/53853/
>
> Thanks in advance
>
>
> The url used for the form's POST is specified on the  action
> attribute.  What are you specifying for action= in your template? 
> Dot goes back to the same page, but I don't believe it carries
> along query strings.  So if you want your POST to include a query
> string I think you'll need to pass it through from the GET
> handling part of your view into your template so it can be
> included as part of the form's action attribute.
>
>
> Oops, also meant to mention probably a more common way of handling 
> this kind of thing is via a hidden field in your form.
>
> Karen
Thanks Karen for your suggestion. But I further played around with the 
above setup and have some intriguing observations.

Instead of adding a 'note_l1' object, I tried adding a 'emailid' object. 
The view function worked as expected. The differences   between the 
'note_l1' and 'emailid' objects, as far as I could see are :
1. 'emailid' is a plain model whereas 'note_l1' is inherited from an 
abstract model.
2. 'note_l1'  involves genericRelations

Yes, it is action = "." indeed in the template

The details (Version 2.0) are here : http://dpaste.com/hold/53887/

My Django version 0.97-pre-SVN-7543

Hope you can spend some more time on this.

Thanks in advance

Regards Ganesh


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



url parameters go missing

2008-05-30 Thread M.Ganesh

Hi All,

I have this url to start a note_l1 addition : 
'/contacts/note_l1/add/?entity=2'

This reaches the server and my code intact. An 'Add; page is displayed. 
After I fill the form and press the 'Add' button only the 
'/contacts/note_l1/add/' portion reaches the server. the '?entity=2'  is 
missing. I want to use this 'entity=2' info to redirect to the relevant 
page. Unable to figure out what is happening. Can somebody kindly have a 
look.

The details are here : http://dpaste.com/hold/53853/

Thanks in advance

Regards Ganesh


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



Many to Many field and the template

2008-05-25 Thread M.Ganesh

Hi All,

Unable to find a relevent info in the mail archives/ documentation. I am 
getting this error :

TemplateSyntaxError at /contacts/entity/8/show/
Could not parse the remainder: ' et in entity.entity_type.all' from 'for 
et in entity.entity_type.all'

#my model
class entity(models.Model):
name = models.CharField(max_length=25, unique=True, db_index=True)
full_name = models.CharField(max_length=100)
entity_type = models.ManyToManyField(entity_type, blank=True)

def __unicode__(self):
return self.name

class Admin:   
list_display = ('name', 'full_name')
   
class Meta:
ordering = ["name"]
app_label = 'contacts'


class entity_type(models.Model):
name = models.CharField(max_length=50)

def __unicode__(self):
return self.name

class Admin:
pass

class Meta:
ordering = ["name"]
app_label = 'contacts'

#my template_snippet
{{ entity.name }}
{{ entity.full_name }}
{{entity.entity_type.count }}
{{ for et in entity.entity_type.all }}< {{ for et in 
entity.entity_type_set.all }} also doesn't work
{{ et.name }}
{{ endfor}}
   
How do I get a list of entity_type given a entity instance?

Thanks in advance

Regards Ganesh


--~--~-~--~~~---~--~~
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: admin and foreign key problem

2008-05-25 Thread M.Ganesh

Karen Tracey wrote:
> On Sat, May 24, 2008 at 11:11 PM, M.Ganesh <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
> Hi All,
>
> Having some problem with foreign key and admin interface :
>
> 
> #models---
> class tagword(models.Model):
>name = models.CharField(max_length=50)
>
>def __unicode__(self):
>return self.name <http://self.name>
>
>class Admin:
>pass
>
>class Meta:
>ordering = ["name"]
>app_label = 'common_utils'
>
> class tag(models.Model):
>tagword = models.ForeignKey(tagword)
>
>content_type = models.ForeignKey(ContentType)
>object_id = models.PositiveIntegerField()
>
>content_object = generic.GenericForeignKey()
>
>def __unicode__(self):
>return self.tagword
>
>class Admin:
>pass
>
>class Meta:
>ordering = ["tagword"]
>app_label = 'common_utils'
> 
> #
>
> I get the following error while I try to access
> /admin/common_utils/tag/
>
> TypeError at /admin/common_utils/tag/
> coercing to Unicode: need string or buffer, tagword found
>
> What is my mistake?
>
>
> Your __unicode__ function for tag is returning a tagword object.  Try 
> returning self.tagword.__unicode__() instead.
>
> Karen
>

Thanks Karen, it worked

Regards Ganesh



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



admin and foreign key problem

2008-05-24 Thread M.Ganesh

Hi All,

Having some problem with foreign key and admin interface :

#models---
class tagword(models.Model):
name = models.CharField(max_length=50)

def __unicode__(self):
return self.name

class Admin:
pass

class Meta:
ordering = ["name"]
app_label = 'common_utils'
   
class tag(models.Model):
tagword = models.ForeignKey(tagword)

content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()

content_object = generic.GenericForeignKey()

def __unicode__(self):
return self.tagword

class Admin:
pass
   
class Meta:
ordering = ["tagword"]
app_label = 'common_utils'
#

I get the following error while I try to access /admin/common_utils/tag/

TypeError at /admin/common_utils/tag/
coercing to Unicode: need string or buffer, tagword found

What is my mistake?

Thanks in advance

Regards Ganesh


--~--~-~--~~~---~--~~
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: class diagram from models.py

2008-05-22 Thread M.Ganesh

Juanjo Conti wrote:
> Several times I tried to generate an UML class diagram from my python
> classes. I have used epydoc and the buil-in feature of SPE but the
> resulting diagram did not like me.
>
> Is there a way to generate an UML class diagram from models.py? a
> stanalone app or command?
>
> Thanks you,
>   
Try modelviz.py (do a Google search)

Regards Ganesh


--~--~-~--~~~---~--~~
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 use a string in filter()

2008-05-17 Thread M.Ganesh

caustic wrote:
>
> On May 17, 9:13 am, "M.Ganesh" <[EMAIL PROTECTED]> wrote:
>   
>> Hi All,
>>
>> I am back with another query
>>
>> I have this (generic) view function
>>
>> --8><
>> def object_list(request, object, filter_string = None):
>> if filter_string:
>> object_list = object.objects.filter(filter_string)
>> else:
>> object_list = object.objects.all()
>>
>> return render_to_response(object.__name__ + '_list.html',
>>   {object.__name__ + '_list': object_list},
>>   RequestContext(request))
>> --8><
>>
>> Now this function works when I don't pass on the filter_string, and I
>> get the entire object list. But when I pass on a value for filter_string
>> (say 'entity=2') I get this error :
>>
>> 'unicode' object has no attribute 'get_sql'
>>
>> How do I pass strings to filter_string and get a filtered object list?
>> 
> You cannot. You should pass either an instance of django.db.models.Q
> or a set of keyword arguments.
> This means you should change code in the object_list caller to do
> something like this:
>
> object_list(request, model.Object, Q(entity=2))
>   
Hmm. I'll have to read about Q objects...

Thanks for the pointer

Regards Ganesh


--~--~-~--~~~---~--~~
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 use a string in filter()

2008-05-16 Thread M.Ganesh

Hi All,

I am back with another query

I have this (generic) view function

--8><
def object_list(request, object, filter_string = None):
if filter_string:
object_list = object.objects.filter(filter_string)
else:
object_list = object.objects.all()
   
return render_to_response(object.__name__ + '_list.html',
  {object.__name__ + '_list': object_list},
  RequestContext(request))
--8><

Now this function works when I don't pass on the filter_string, and I 
get the entire object list. But when I pass on a value for filter_string 
(say 'entity=2') I get this error :

'unicode' object has no attribute 'get_sql'


How do I pass strings to filter_string and get a filtered object list?

Thanks in advance

Ganesh


--~--~-~--~~~---~--~~
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: Reference to the url of the current page in a template

2008-05-16 Thread M.Ganesh

Scott Moonen wrote:
> Ganesh,
>
> First ensure that your TEMPLATE_CONTEXT_PROCESSORS contains:
>
> TEMPLATE_CONTEXT_PROCESSORS = (
>   . . .
> 'django.core.context_processors.request',
>   . . .
> )
>
> Then you can use the variable {{ request.path }} in your templates, 
> assuming that the URLs are all on the same host.  If not, you'll need 
> to use something like {{ request.META.HTTP_HOST }}://{{ request.path }}.
>
>   -- Scott
>
>
> On Fri, May 16, 2008 at 12:58 PM, M.Ganesh <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
> Hi,
>
> I don't know how to clearly explain what I want to know. Let me
> try once
> again...
>
> I have a small controlpanel page which I include in all my other
> pages.
> This control panel page has got a link to 'login' page. Users are
> allowed to view the pages without login, but they have to login if
> they
> want to make any changes to the data. So if somebody realises he wants
> to change the data he is currently viewing, he will click the login
> link. Now I want him to be brought back to the page he was viewing
> before logging in. The trouble is because the 'login' link is in a
> template which will get included to a arbitrary page. In other words :
>
> #my controlpane.html
>
> {% if user.is_anonymous %}
>Welcome 
>   Please login
>login
> {% else %}
>blah blah
> {% endif %}
>
>
> Regards Ganesh
>
Hi Alex and Scott,
That worked like a charm. Thanks a ton.

My next task is to use this path to redirect. I'll get back if need more 
help

Regards Ganesh


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



Reference to the url of the current page in a template

2008-05-16 Thread M.Ganesh

Hi,

I don't know how to clearly explain what I want to know. Let me try once 
again...

I have a small controlpanel page which I include in all my other pages. 
This control panel page has got a link to 'login' page. Users are 
allowed to view the pages without login, but they have to login if they 
want to make any changes to the data. So if somebody realises he wants 
to change the data he is currently viewing, he will click the login 
link. Now I want him to be brought back to the page he was viewing 
before logging in. The trouble is because the 'login' link is in a 
template which will get included to a arbitrary page. In other words :

#my controlpane.html

{% if user.is_anonymous %}
Welcome 
   Please login
login
{% else %}
blah blah
{% endif %}


Regards Ganesh


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



passing a string to model.objects.filter() method

2008-05-15 Thread M.Ganesh

Hi All

#my function code
def object_list(request, object, filter_string = None):
if filter:
object_list = object.objects.filter(filter_string)
else:
object_list = object.objects.all()
   
return render_to_response(object.__name__ + '_list.html',
  {object.__name__ + '_list': object_list},
  RequestContext(request))

When I call this with a string value for filter_string like below:

def location_list(request):
if request.has_key('entity'):
return object_list(request, location, 'entity_id=' + 
request['entity'])
else:
return object_list(request, location)
   
I get the following error message.

'unicode' object has no attribute 'get_sql'



How to pass on a string to the filter() method?

Thanks in advance

Regards Ganesh


--~--~-~--~~~---~--~~
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: Getting back to the same page after completing a task in another page

2008-05-15 Thread M.Ganesh

Adi Jörg Sieker wrote:
>
> On 13.05.2008, at 16:18, phillc wrote:
>
>>
>> "I am new to web programming"
>> "I am trying to use my own loginpage "
>>
>> is there a reason that contrib.auth doesnt meet your needs?
>>
> Good question. :)
>
> adi
>
Yes, I do agree, these two statements put next to each other sound very 
inconsistent. My reasons for having a my own login page:
1. I trying to develop an address book kind of application for our 
internal use.
2. It turns out I am mostly doing CRUD.
3. Actually 'admin as the app' should suit my requirement. The catch 
was, I want to show only selected models to the selected people, where 
as the admin (with oldforms) shows all the models. Of course I can auth 
middleware to restrict access, but people will know what models exist.
4. newforms-admin was promising, but I got repeatedly bitten by a bug 
which was about some modules getting reloaded more than once (sorry, I 
don't remember the ticket number, but the ticket confirm it to be a yet 
to be fixed bug)
5. So I decided to roll-out my own admin kind of functionality, but 
without nice css formatting etc (Frankly I don't know css yet)
6. The login page that comes with contrib.auth is too colourful compared 
to other pages, and also exposes the admin page to the users unnecessarily.
The reason may be unconvincing, but that is what it is.

Anyway thanks for having a close look

Regards Ganesh


--~--~-~--~~~---~--~~
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: Getting back to the same page after completing a task in another page

2008-05-12 Thread M.Ganesh

Adi Jörg Sieker wrote:
> Hi,
> On 12.05.2008, at 22:07, Adi Jörg Sieker wrote:
>
>> but the idea is the same.
>>
>> def login_view(request, next_url_from_page):
> this might need to be a default parameter like:
> def login_view(request, next_url_from_page=None):
>
>> if request.method == 'POST':
>> do your login stuff
>> if user is logged in:
>>return HttpResponseRedirect(request.POST['next_url'])
> typo, that should read.
> return HttpResponseRedirect(request.POST['next_url_from_form'])
>>
>> return direct_to_template(request, 'login.html', {'form': login_form, 
>> 'next_url_from_page' : next_url_from_page })
>>
>> in your login template:
>> 
>>
>> > value="{{next_url_from_page}}"
>> >
>>
>> your view that needs login:
>> def view_which_needs_login(request, *args, **kwargs):
>> if user not logged in:
>>return HttpResponseRedirect("/your_login_page?next=%s" 
>> %(request.path))
>>
>>
>>
>> I hope that helps.
>>
>> Regards
>>Adi
>>
>>
>>
>>
>>> Regards Ganesh
Thanks Adi for your detailed reply. I'll give it a try and let you know.

Thanks for your time

Regards Ganesh


--~--~-~--~~~---~--~~
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: Getting back to the same page after completing a task in another page

2008-05-12 Thread M.Ganesh

Valts Mazurs wrote:
> On Mon, May 12, 2008 at 4:13 PM, M.Ganesh <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
> Thanks Ronny for your response, however this doesn't answer my
> requirement. Probably I've to state my requirement more clearly.
>  I have
> various pages for general viewing where authentication is not
> required.
> But if a user decides to add a record, he has to first login. I
> take him
> to a login page for that. After he logs in I want to bring him back to
> the same page. Note that a user can come to the login page from any of
> the different pages. Hence the 'previous page' is not always the same.
>
>
> Then you have 2 possible ways to go:
> 1) use referrer info from HTTP request to figure out which page the 
> user has came from
> 2) embed previous_page variable in URL or POST request to login page.
>
> After successful login you can easily redirect the user back to the 
> page where he has came from.
>
> Regards,
> Valts.
>
Thanks Valts, but I am new to web programming (coming from VB world). 
Can you please give me a little more detail or pointers to some 
documentation

Regards Ganesh



--~--~-~--~~~---~--~~
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: Getting back to the same page after completing a task in another page

2008-05-12 Thread M.Ganesh

Adi Jörg Sieker wrote:
>
> On 12.05.2008, at 15:13, M.Ganesh wrote:
>
>> Thanks Ronny for your response, however this doesn't answer my
>> requirement. Probably I've to state my requirement more clearly.  I have
>> various pages for general viewing where authentication is not required.
>> But if a user decides to add a record, he has to first login. I take him
>> to a login page for that. After he logs in I want to bring him back to
>> the same page. Note that a user can come to the login page from any of
>> the different pages. Hence the 'previous page' is not always the same.
>>
>> Thanks in advance for any pointers
>>
> If you are using contrib.auth and it's login view. Then just pass it a 
> request variable called next with the url you want it to redirect to 
> after successful login or even better use the login_required decorator 
> that does it all for you.
> See also the fine documentation 
> at 
> http://www.djangoproject.com/documentation/authentication/#the-login-required-decorator
>
> Regards
>adi
Thanks adi, but I am trying to use my own loginpage

Regards Ganesh


--~--~-~--~~~---~--~~
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: Getting back to the same page after completing a task in another page

2008-05-12 Thread M.Ganesh

Ronny Haryanto wrote:
> On Sun, May 11, 2008 at 11:55 AM, M.Ganesh <[EMAIL PROTECTED]> wrote:
>   
>> I am displaying a list of records in a page. I have a link in that page
>> which will take me to a form for adding one more record. How do I come
>> back to the previous page after adding a record?
>> 
>
> If the "previous page" is always the same, then you could return a
> HttpResponseRedirect to that view in your view method that handles the
> adding of one record.
>
>   
>> I remember seeing somewhere a trick involving something like > href=/list/add/?next=request.get_full_path>Add..
>> 
>
> Alternatively, you could probably record the user's trail or view
> history in the database, then show it somewhere in the page, so the
> user can decide themselves which page they want to go back to.
>
> Ronny
>
>   
Thanks Ronny for your response, however this doesn't answer my 
requirement. Probably I've to state my requirement more clearly.  I have 
various pages for general viewing where authentication is not required. 
But if a user decides to add a record, he has to first login. I take him 
to a login page for that. After he logs in I want to bring him back to 
the same page. Note that a user can come to the login page from any of 
the different pages. Hence the 'previous page' is not always the same.

Thanks in advance for any pointers

Regards Ganesh


--~--~-~--~~~---~--~~
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 views.generic.create_update.create_object

2008-05-11 Thread M.Ganesh

Karen Tracey wrote:
> On Sun, May 11, 2008 at 5:55 AM, M.Ganesh <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
> Hi all
>
> I am a django rookie.
>
> Is it true that "views.generic.create_update.create_object" generate a
> oldform?  (the documentation says so!)
>
>
> The docs are generally accurate.  Searching the in the ticket tracker 
> for generic create_update reveals:
>
> http://code.djangoproject.com/ticket/3639
>
> It's got a patch you could try, and is apparently just waiting for a 
> good time to check it in since it is a backwards-incompatible change.
>
> Karen
>
Thanks Karen for confirming. I've added myself to the cc list of the ticket

Regards Ganesh


--~--~-~--~~~---~--~~
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 views.generic.create_update.create_object

2008-05-11 Thread M.Ganesh

Hi all

I am a django rookie.

Is it true that "views.generic.create_update.create_object" generate a 
oldform?  (the documentation says so!)

I have a template which renders a newform created with 'forms.Modelform' 
to my satisfaction. However when I try to use the same template in 
create_object generic view, I only get a blank form.

Kindly clarify

Regards Ganesh



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



Getting back to the same page after completing a task in another page

2008-05-10 Thread M.Ganesh

Hi all,

Trying to learn django.

I am displaying a list of records in a page. I have a link in that page 
which will take me to a form for adding one more record. How do I come 
back to the previous page after adding a record?

I remember seeing somewhere a trick involving something like Add..

Can somebody give me a sample snippet..

Thanks in advance

Regards Ganesh




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



UTF-8 encoding

2008-03-09 Thread M.Ganesh

Hi All,

I am using MySQL. How to select UTF-8 encoding for the CharFields  and  
TextFields in the models I create?

Regards Ganesh


--~--~-~--~~~---~--~~
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: ModelForm ManyToMany add

2008-03-07 Thread M.Ganesh

Malcolm Tredinnick wrote:
> On Thu, 2008-03-06 at 15:24 +0100, Alper Çugun wrote:
>
>   
>> If I have a model with a ManyToMany relation, the django admin shows
>> multiselect widgets with a plus so you can add the related objects on
>> the spot. Is there a way to duplicate this functionality when
>> rendering a form for the same model using newforms.ModelForm?
>> 
>
> http://groups.google.com/group/django-users/browse_frm/thread/8204c2d706efd177/13338d63bceb81fb
>
> Regards,
> Malcolm
>
>   

Hi Malcolm,

The OP is asking for multiselect widget, which we get by mentioning 
'filter_interface=models.HORIZONTAL' in the models field.The link you 
have provided is for showing multiple form objects in one web page.

Incidentally my mail requesting for the same information is still pending

Regards Ganesh


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



Widgets from admin app

2008-03-06 Thread M.Ganesh

Hi,

How do I go about using the widgets that are used in the admin app in my 
own app?

Regards Ganesh


--~--~-~--~~~---~--~~
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: Iteration not working inside template

2008-03-06 Thread M.Ganesh

Malcolm Tredinnick wrote:
> On Thu, 2008-03-06 at 09:17 +0530, M.Ganesh wrote:
>   
>> Hi,
>>
>> I've pasted a minimalist code here: http://dpaste.com/hold/38198/
>>
>> Only the table caption and the table headers show-up in the web page. 
>> The LunchEnrty_list.count also shows up correctly, but there are no 
>> table rows.
>> 
>
> You are trying to iteratate over LunchEntries_list.all, but
> LunchEntries_list is defines as LunchEntries.objects.all(). Querysets,
> which is what LunchEntries_list is, do not have an all() method. Only
> model managers (LunchEntries.objects) have an all().
>
> So drop the "all" bit in your tempate iteration.
>
> Malcolm
>
>   
Hi Malcom and Michael,

Yes. Dropping the *.all* worked

Thanks a lot

Regards Ganesh


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



Iteration not working inside template

2008-03-05 Thread M.Ganesh

Hi,

I've pasted a minimalist code here: http://dpaste.com/hold/38198/

Only the table caption and the table headers show-up in the web page. 
The LunchEnrty_list.count also shows up correctly, but there are no 
table rows.

What am I missing

TIA
Regards Ganesh


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



initial value not working when used with SelectDateWidget

2008-03-05 Thread M.Ganesh

Hi,

I want to show the current date in the Date field. It works 
'SelectDateWidget' when I use the default widget. If I use 
'SelectDateWidget' then I always get 1st January 2008. Is there a way to 
use 'SelectDateWidget' and still get current date in the input box? The 
code is pasted in the link below:
http://dpaste.com/hold/38055/

Thanks in advance
Regards Ganesh

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



initial value not working when used with SelectDateWidget

2008-03-05 Thread M.Ganesh

Hi,

I want to show the current date in the Date field. It works 
'SelectDateWidget' when I use the default widget. If I use 
'SelectDateWidget' then I always get 1st January 2008. Is there a way to 
use 'SelectDateWidget' and still get current date in the input box? The 
code is pasted in the link below:
http://dpaste.com/hold/38055/

Thanks in advance
Regards Ganesh


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