drag and drop rows on django admin

2011-07-25 Thread rahul jain
Tried this snippet but not working

http://djangosnippets.org/snippets/2306/

Anyone else tried it, I would like to drag and drop rows on django admin.

Thanks.

RJ

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



Re: Best & Easiest Python/Django Forum App to install

2011-07-25 Thread Peter Murphy
Wildcard,

Have you checked DjangoPackages? More Forum apps than you can poke a
stick at, and all compared for features supported:

http://djangopackages.com/grids/g/forums/

Best regards,
Peter

On Jul 26, 8:37 am, wildcard  wrote:
> I would like some steering in my planning so that I am headed in the
> right direction, concerning Django Forum apps and where to find them,
> as I am a bit lost looking for them.
>
> I have built my first server (Debian). I've used OpenVZ which appears
> to work great and allows me now to create websites. I want to use
> Python as my language of choice, which I am learning also, (and since
> I only want to learn one language) I want all the apps I pick to be
> Python based as Python impresses me the most.
>
> I have selected the Satchmo app for my eCommerce needs, which uses
> Django, and since that framework will already be installed (and I only
> want to learn one framework :) ) I am looking for a python and/or
> Django based FORUM to implement.and hopefully one that is pretty
> much ready to go after the install, or requires little to no
> programming to set up.
>
> My needs in a forum are pretty simple:
>         Only members can post, but everyone
>  can read
>         Registration-
>                 Case Sensitive Passwords
>                 email click link to activate
>         email notification of reply option
>         Subscribe to Thread option (email notification)
>         Views count
>         Replies count
>         Search Forum for matching threads
>
> It would also be nice if I could put this forum in it's own VE
> container and use it for multiple types of forums which are not
> apparent to each other, thus users coming in on separate links only
> see the forum they chose to visit from other specialized VE
> containers.is that possible?
>
> Thanks for your help! I am pretty excited about Django and Python! :)

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



snippet

2011-07-25 Thread rahul jain
Tried this snippet but not working

http://djangosnippets.org/snippets/2306/

Anyone else tried it, I would like to drag and drop rows on django admin.

Thanks.

RJ

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



Re: Django hosting

2011-07-25 Thread Gour-Gadadhara Dasa
On Mon, 25 Jul 2011 21:40:23 -0400
william ratcliff  wrote:

> +1 webfaction

I used webfaction, but then moved to http://djangohosting.ch/
(http://djangoeurope.com) - nice ping from Europe, great support &
prices and the setup is even more flexible than at Webfacton.


Sincerely,
Gour


-- 
“In the material world, conceptions of good and bad are
all mental speculations…” (Sri Caitanya Mahaprabhu)

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810





signature.asc
Description: PGP signature


Re: Detecting if i18n/10n are installed from a template

2011-07-25 Thread h3
Just answered my own question .. if request.LANGUAGE_CODE isn't in
context .. it's not.

Meh.

On Jul 25, 11:00 pm, h3  wrote:
> Is there a mechanisme to detect if i18n/10n are installed from the
> template code ?
>
> I don't see anything about it in the official doc..

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



Detecting if i18n/10n are installed from a template

2011-07-25 Thread h3
Is there a mechanisme to detect if i18n/10n are installed from the
template code ?

I don't see anything about it in the official doc..

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



Re: Django hosting

2011-07-25 Thread Brad Montgomery
I've been using rackspace's Cloud servers.  They give you a nice platform 
and charge only for what you use (so low-traffic sites end up being very 
affordable). 

However, you should play close attention to a service 
like https://gondor.io/ - it's an extremely easy-to-use service that makes 
hosting django projects almost trivial.

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



Best & Easiest Python/Django Forum App to install

2011-07-25 Thread wildcard
I would like some steering in my planning so that I am headed in the
right direction, concerning Django Forum apps and where to find them,
as I am a bit lost looking for them.

I have built my first server (Debian). I've used OpenVZ which appears
to work great and allows me now to create websites. I want to use
Python as my language of choice, which I am learning also, (and since
I only want to learn one language) I want all the apps I pick to be
Python based as Python impresses me the most.

I have selected the Satchmo app for my eCommerce needs, which uses
Django, and since that framework will already be installed (and I only
want to learn one framework :) ) I am looking for a python and/or
Django based FORUM to implement.and hopefully one that is pretty
much ready to go after the install, or requires little to no
programming to set up.

My needs in a forum are pretty simple:
Only members can post, but everyone
 can read
Registration-
Case Sensitive Passwords
email click link to activate
email notification of reply option
Subscribe to Thread option (email notification)
Views count
Replies count
Search Forum for matching threads

It would also be nice if I could put this forum in it's own VE
container and use it for multiple types of forums which are not
apparent to each other, thus users coming in on separate links only
see the forum they chose to visit from other specialized VE
containers.is that possible?

Thanks for your help! I am pretty excited about Django and Python! :)

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



SVN Django: Having trouble using contrib.staticfiles to see default admin page CSS

2011-07-25 Thread Michael Blume
I have 'django.contrib.staticfiles' in my INSTALLED_APPS and
STATIC_URL="/static/"

If I go to my admin page, it attempts to load the base css file from
/static/admin/css/base.css, and fails.

If I open this url in my browser I get

"/home/mike/workspace/django/django/contrib/admin/media/css/base.css"
does not exist
You're seeing this error because you have DEBUG = True in your Django
settings file. Change that to False, and Django will display a
standard 404 page.

(I'm using setup.py develop to run django directly from my home folder
-- I don't *think* this is relevant)

If I go digging, I can see that the relevant css actually exists at

/home/mike/workspace/django/django/contrib/admin/static/admin/css/base.css

I don't understand the mis-match between where Django is looking for
the file and where the file actually exists in the provided directory
structure, given that I don't have anything fancy going on in my
settings. This looks to me like a bug, but I couldn't find any
discussion of such, so I wanted to check with the users list first to
make sure I'm not missing anything.

-Mike

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



Re: A problem about rpc4django

2011-07-25 Thread Kejun He
Hi,

Thanks for your reply.

And i have resolved this error. It just because i defined a function in a
__init__.py file which is used to register RPC function,
the project back to normal when i moved the function to other file.

So strange it is

regards,
kejun

On Tue, Jul 26, 2011 at 8:02 AM, Mike Dewhirst wrote:

> On 25/07/2011 6:04pm, Kejun He wrote:
>
>> Hi,
>>
>> A strange problem! The same project about RPC could work normally in
>> Linux, but it reported a error "global name 'dispatcher' is not defined" on
>> development server(http://127.0.0.1:8000) in Windows OS.
>>
>> Did anyone meet this problem before?
>> Could you tell me how to fix it?
>>
>>
> It is difficult to see the traceback right to the end when you use html in
> your email. It seems to have been truncated. You should switch to the
> copy-and-paste view.
>
> Speaking for myself, when something is not found on one machine but is ok
> on another it usually means I have forgotten to install a component..
>
> Has the project been working on the Windows machine at an earlier time?
>
> Mike
>
>
>  Thank you!
>>
>>
>> ==traceback===**
>>
>>
>>Traceback Switch to copy-and-paste view
>>
>> 
>> >
>>
>>  * |C:\Python25\Lib\site-**packages\django\core\handlers\**base.py|Â inÂ
>>|get_response|
>>   100. response = callback(request, *callback_args,
>>**callback_kwargs) ...
>>▶ Local vars 
>> 
>> >
>>  * |C:\Python25\Lib\site-**packages\django\views\**decorators\csrf.py|Â
>>in |wrapped_view|
>>23. resp = view_func(*args, **kwargs) ...
>>▶ Local vars 
>> 
>> >
>>  * |C:\Python25\Lib\site-**packages\django\views\**decorators\csrf.py|Â
>>in |wrapped_view|
>>36. return view_func(*args, **kwargs) ...
>>▶ Local vars 
>> 
>> >
>>  * |E:\gmadmin\rpc4django\views.**py| in |serve_rpc_request|
>>   201. methods = dispatcher.list_methods() ...
>>▶ Local vars 
>> 
>> >
>>
>>
>>
>>
>> regards,
>> he
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to django-users+unsubscribe@**
>> googlegroups.com .
>> For more options, visit this group at http://groups.google.com/**
>> group/django-users?hl=en
>> .
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>

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



Re: Django hosting

2011-07-25 Thread william ratcliff
+1 webfaction

On Mon, Jul 25, 2011 at 5:00 PM, fred.se...@sunrise.com <
fred.se...@sunrise.com> wrote:

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

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



Re: Doubt : Redirect after registration

2011-07-25 Thread vaibhav agarwal
Hi.

Yes I did set AUTHENTICATION_BACKENDS to
django.contrib.auth.backends.ModelBackend in settings.py . Also doesnt
Django by default set AUTHENTICATION_BACKENDS to the value even if I
dont set it in the settings.py folder? Inspite of this , the solution
hasnt worked :(.

Thanks
Vaibhav

On Jul 24, 11:45 pm, KP  wrote:
> Hi Vaibhav,
>
> Just checking - Did you set the AUTHENTICATION_BACKENDS to
> django.contrib.auth.backends.ModelBackend in settings.py
>
> Thanks,
> KP
>
> On Jul 24, 4:16 pm, vaibhav agarwal  wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I am using Django 1.3. I have started building my first site in django
> > and it seems real fun . I am learning a lot from it . But I have a
> > small problem . I want to login a user after he registers and then
> > redirect him to the home page of the site . For this I tried , the
> > stuff given in the 
> > linkhttp://stackoverflow.com/questions/3222549/how-to-automatically-login...
> > but it does not work for me . When I tried this , the user is directed
> > to the home page but since that has the login_required function , it
> > asks the user to manually login which I dont want . How do I rectify
> > this ?
>
> > Thanks in advance for the help .
>
> > Cheers
>
> > Vaibhav

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



how to create a hidden field

2011-07-25 Thread webcomm
I haven't been able to find anything documenting how to create a
hidden field.  I see this is done with the HiddenField widget but
don't know how to use that.  I tried the following but the field still
shows...

class NewsForm(ModelForm):
itemid =
forms.IntegerField(widget=forms.HiddenInput,required=False)

class Meta:
model = News


Thanks,
Ryan

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



Managing static files - beginner's question

2011-07-25 Thread Rodney Topor
I'm trying to learn the new way of managing static files introduced in
version 1.3.  The documentation says that TEMPLATE_CONTEXT_PROCESSORS
is defined to include django.core.context_processors.static by
default, and that you can then refer to static files in your templates
by writing something like .  However, the settings.py files in my new projects does *not*
contain a definition of TEMPLATE_CONTEXT_PROCESSORS.  Should it?  If
so, what might have gone wrong?  If not, where do I find the
definition of TEMPLATE_CONTEXT_PROCESSORS?  (I know I can add the
definition to settings.py to access the static files as above.)

Rodney

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



Re: TimeField with minute-resolution in forms

2011-07-25 Thread Brian
Is that not the opposite problem? I enter a value, which is correctly 
rejected if I specify a non-zero seconds value, but when I try to edit it 
again, the value in the form's entry-box has been rendered as "hh:mm:00". 
Surely its the "from_python" method that I need to override - if such a 
thing exists? 

Brian

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



Re: TimeField with minute-resolution in forms

2011-07-25 Thread Andre Terra
I'm mostly guessing, but you can try defining a custom widget for the
field. I'm not sure how much of the behavior of datetime fields
depends on the javascript that gets slapped to them. So instead, maybe
you could override the field's to_python method to append/replace the
seconds as needed, or basically always setting them to 00. Now that I
think of it, this is probably the easiest solution.

Cheers,
AT

On 7/25/11, Brian  wrote:
> Hi,
>
> I have a form with a TimeField and I'd like it to only accept values
> in the form hh:mm, as opposed to hh:mm:ss.
>
> The form is a ModelForm and I've overridden the 'time' field with a
> TimeField where I've specified the input_formats as ['%H:%M']. This
> works fine when entering value for a new instance of the model, but
> when I edit an existing instance, the value that I entered as '12:30'
> is rendered as '12:30:00' and so the instance fails to save.
>
> Without much hope of success (and that proved wildly optimistic), I
> tried changing the rendering of the form as follows:
>  {% if field.label == "Time" %}
>  {{ field | time:"H:i" }}
>  {% else %}
> {{ field }}
>  {%endif%}
> But that didn't work even a little bit.
>
> Do I need to subclass TimeField? Is there a method that controls the
> "output_formats"?
> Or maybe that's not the way to do it. Could anyone offer any advice?
>
> Thanks in advance,
>
> Brian
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
Sent from my mobile device

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



TimeField with minute-resolution in forms

2011-07-25 Thread Brian
Hi,

I have a form with a TimeField and I'd like it to only accept values
in the form hh:mm, as opposed to hh:mm:ss.

The form is a ModelForm and I've overridden the 'time' field with a
TimeField where I've specified the input_formats as ['%H:%M']. This
works fine when entering value for a new instance of the model, but
when I edit an existing instance, the value that I entered as '12:30'
is rendered as '12:30:00' and so the instance fails to save.

Without much hope of success (and that proved wildly optimistic), I
tried changing the rendering of the form as follows:
 {% if field.label == "Time" %}
 {{ field | time:"H:i" }}
 {% else %}
{{ field }}
 {%endif%}
But that didn't work even a little bit.

Do I need to subclass TimeField? Is there a method that controls the
"output_formats"?
Or maybe that's not the way to do it. Could anyone offer any advice?

Thanks in advance,

Brian

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



Re: A problem about rpc4django

2011-07-25 Thread Mike Dewhirst

On 25/07/2011 6:04pm, Kejun He wrote:

Hi,

A strange problem! The same project about RPC could work normally in 
Linux, but it reported a error "global name 'dispatcher' is not 
defined" on development server(http://127.0.0.1:8000) in Windows OS.


Did anyone meet this problem before?
Could you tell me how to fix it?



It is difficult to see the traceback right to the end when you use html 
in your email. It seems to have been truncated. You should switch to the 
copy-and-paste view.


Speaking for myself, when something is not found on one machine but is 
ok on another it usually means I have forgotten to install a component..


Has the project been working on the Windows machine at an earlier time?

Mike



Thank you!


==traceback===


Traceback Switch to copy-and-paste view


  * |C:\Python25\Lib\site-packages\django\core\handlers\base.py|Â inÂ
|get_response|
   100. response = callback(request, *callback_args,
**callback_kwargs) ...
▶ Local vars 
  * |C:\Python25\Lib\site-packages\django\views\decorators\csrf.py|Â
in |wrapped_view|
23. resp = view_func(*args, **kwargs) ...
▶ Local vars 
  * |C:\Python25\Lib\site-packages\django\views\decorators\csrf.py|Â
in |wrapped_view|
36. return view_func(*args, **kwargs) ...
▶ Local vars 
  * |E:\gmadmin\rpc4django\views.py| in |serve_rpc_request|
   201. methods = dispatcher.list_methods() ...
▶ Local vars 




regards,
he
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


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



Re: in my model, how can I tell when I'm saving a new item

2011-07-25 Thread Ian Clelland
On Mon, Jul 25, 2011 at 4:05 PM, webcomm  wrote:

> > Thanks.  Any idea why the following isn't working in my News class?
> > The processing doesn't get to that exit call, even if it's a new item.
> >
> > def save(self, *args, **kwargs):
> > if not hasattr(self,'id'):
> > import sys
> > sys.exit('must be a new item')
> > super(News, self).save(*args, **kwargs)
>
>
> hasattr doesn't work in this situation, or I'm not using it right.  In
> any case, the following works:
>
>def save(self, *args, **kwargs):
> if not self.id:
>import sys
>sys.exit('a new item')
> super(News, self).save(*args, **kwargs)
>

webcomm,

Whether you have defined an 'id' field in your model, or let Django do it
for you, each of your objects will "have" an id attribute, and so
hasattr(my_object, 'id') will always be true. The *value* of that attribute
might be None, though, and that's why works when you simply test self.id,
like you did above.

hasattr is generally useful in a function when you are not sure what kind of
object has been passed in, or if you want to tell whether an object has been
augmented with a specific attribute. When you know that the attribute
exists, then you can use getattr(self, "id"), or just access the attribute
directly (like "self.id")


That being said, though, there are situations where you can't rely on an id
being a guarantee that the object already exists. Like any field, it is
possible to specify the id when creating an object in memory, like this:

new_object = News(id=1, headline="Breaking news!", content="Database
broken!")
new_object.save()

This object will have an id set when the save() method checks for it, and so
any code that you needed to run for new items will be skipped.

In fact, this is exactly what happens when you load fixtures, either with
"manage.py loaddata", or by using fixtures in tests.

If there is code that absolutely has to run when a new object is created,
(or code that needs to run on update, but absolutely cannot run on new
objects before insertion), then you may be better off using a post-save
signal handler, and checking the "created" argument that gets passed to it.


-- 
Regards,
Ian Clelland


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



Re: in my model, how can I tell when I'm saving a new item

2011-07-25 Thread webcomm
> Thanks.  Any idea why the following isn't working in my News class?
> The processing doesn't get to that exit call, even if it's a new item.
>
>     def save(self, *args, **kwargs):
>         if not hasattr(self,'id'):
>             import sys
>             sys.exit('must be a new item')
>         super(News, self).save(*args, **kwargs)


hasattr doesn't work in this situation, or I'm not using it right.  In
any case, the following works:

def save(self, *args, **kwargs):
if not self.id:
import sys
sys.exit('a new item')
super(News, self).save(*args, **kwargs)

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



Re: Fieldsets in Admin Inline

2011-07-25 Thread Micky Hulse
On Mon, Jul 25, 2011 at 2:57 PM, Juergen Schackmann
 wrote:
> is there a way to define fieldsets in the Inline?
> If could not find anything in the docs, but to me the idea sounds quite
> reasonable; so I am wondering if I just dont find it?!?!?!

Not tested myself, but have you tried the normal fieldsets = () in a
standard admin.StackedInline class?

Found this via a quick Goog search:

http://www.softwarematrix.cn/blog/django/add-fieldsets-with-admin-stackedinline

Seems like that should work... I normally don't used the "Stacked"
look for my inlines, so hopefully I don't send you down the wrong
path.

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



Re: Setting LOGIN_URL dynamically, for different users, based on app?

2011-07-25 Thread dpapathanasiou


On Jul 25, 12:23 pm, Alexey Luchko  wrote:
> On 23.07.2011 18:13,dpapathanasiouwrote:
> I've got a question on the solution.  Does it allow access to the other app
> by direct url after successful login and redirect?

No, because the decorator function checks the Group of request.user
and rejects the request if it's the wrong Group for this app.

Each app has its own signup function, and every new user gets exactly
one Group assignment, based on from which he registered.

One possible hole, though, is through the admin site: if a rogue
administrator assigns a user both Groups, then that user would gain
access exactly as you describe.

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



Re: in my model, how can I tell when I'm saving a new item

2011-07-25 Thread webcomm
On Jul 25, 3:57 pm, Javier Guerra Giraldez  wrote:
> On Mon, Jul 25, 2011 at 2:50 PM, webcomm  wrote:
> > try:
> >  self.id
> > except NameError:
> >  # run this code if it is a new item
> > else:
> >  # run this code if this is a previously saved item
>
> works, but it's nicer to use "if hasattr(obj,field): "

Thanks.  Any idea why the following isn't working in my News class?
The processing doesn't get to that exit call, even if it's a new item.

def save(self, *args, **kwargs):
if not hasattr(self,'id'):
import sys
sys.exit('must be a new item')
super(News, self).save(*args, **kwargs)

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



Fieldsets in Admin Inline

2011-07-25 Thread Juergen Schackmann
Hi all,
is there a way to define fieldsets in the Inline?
If could not find anything in the docs, but to me the idea sounds quite 
reasonable; so I am wondering if I just dont find it?!?!?!
Thanks
Juergen

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



Re: 3-legged-OAuth Logout

2011-07-25 Thread Vignesh Sunder
Thanks for the reply..But I feel this could be a security issue,
considering the fact that the user (say user1) would not be aware of
the fact that he/she has not yet been logged out of Twitter. If
another user (say user2) gets hold of the system before user1's
cookie/session gets timed out, and happens to access Twitter.com,
there is a bright chance that user1's information can get compromised.
Please correct me if I am wrong in assuming that most of the users who
browse the internet today are still 'innocent' !

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



Re: Django hosting

2011-07-25 Thread fred.se...@sunrise.com
I used webfaction and they were most helpful.

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



Re: Django hosting

2011-07-25 Thread Ethan Poole
You have many options for deployment, but if you just want some simple
hosting which support Django, a number of providers are listed here:
http://djangofriendly.com/hosts/

On 25 Juli, 09:18, nicolas HERSOG  wrote:
> I ve never deploy my "crazy and test django web apps" yet but you should
> look this way :  https://docs.djangoproject.com/en/1.3/howto/deployment/
>
> On Mon, Jul 25, 2011 at 4:12 PM, Jacob Scherffenberg
> wrote:
>
>
>
>
>
>
>
> > Hello me and a friend have created a small django web application for
> > a company, and are now as good as done, but none of us really knows
> > how to host a django project properly
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



Re: in my model, how can I tell when I'm saving a new item

2011-07-25 Thread Javier Guerra Giraldez
On Mon, Jul 25, 2011 at 2:50 PM, webcomm  wrote:
> try:
>  self.id
> except NameError:
>  # run this code if it is a new item
> else:
>  # run this code if this is a previously saved item

works, but it's nicer to use "if hasattr(obj,field): "


> More generally, what do you think of this statement:  "If there are
> any cases where you don't absolutely know if a variable is defined,
> you have a broken design."

it's generally reasonable; but in this case it's not about an
undefined variable; it's an attribute.  Since the ID value is defined
only by the database, it's reasonable to leave it undefined until it's
defined :-)



-- 
Javier

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



Re: in my model, how can I tell when I'm saving a new item

2011-07-25 Thread webcomm
I'm still learning python, so have to ask about how this would be
done.  Something like the following?

try:
  self.id
except NameError:
  # run this code if it is a new item
else:
  # run this code if this is a previously saved item

More generally, what do you think of this statement:  "If there are
any cases where you don't absolutely know if a variable is defined,
you have a broken design."
That's at 
http://stackoverflow.com/questions/1592565/determine-if-variable-is-defined-in-python/1592578#1592578
I've worked on many scripts where it wasn't possible to know if a
variable is defined, so I'm surprised to see someone vehemently argue
that this should never happen.

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



Re: Django + PyPy = ?

2011-07-25 Thread Bill Freeman
It still doesn't seem like a Django issue, but a pypy issue.  You need
to be able to run stuff from other than the pypy-dist/bin directory
for pypy to be useful.

One possibility is that you are actually getting a different pypy
executable.  Say (on *nix) "which pypy" from one of those other
directories and see if it mentions the correct pypy.

I don't know a lot about pypy per seh, but does running it from
pypy-dist/bin mean that you haven't run setup.py to install it in your
environment?

For python itself, there are a limited number of places it looks for
site.py on startup, which, in turn, builds up sys.path, so that it
knows where to get stuff for imports that aren't relative to the
current directory.  Probably pypy is similar.  I still think that it's
not installed correctly.

On Mon, Jul 25, 2011 at 2:09 PM, Dmitry Pisklov  wrote:
> It doesn't make any difference. This error appears if you start pypy from
> directory other than /pypy-dist/bin. If I start it right from there:
>
> ./pypy
> Python 2.7.1 (b590cf6de419, Apr 30 2011, 02:00:34)
>
>
> [PyPy 1.5.0-alpha0 with GCC 4.4.3] on linux2
>
>
> Type "help", "copyright", "credits" or "license" for more information.
>
>
> And now for something completely different: ``PyPy is an exciting technology
>
>
> that lets you to write fast, portable, multi-platform interpreters with less
>
>
> effort''
>
>
> from django.core.management import execute_manager
>
>
> Traceback (most recent call last):
>
>
>   File "", line 1, in 
>
>
> ImportError: No module named django.core
>
>
>
>
> No error you mentioned, but still it doesn't work.
> Cheers,
> D
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/8aRQYvpY3lkJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: in my model, how can I tell when I'm saving a new item

2011-07-25 Thread Dmitry Pisklov
Have a look at this doc:
https://docs.djangoproject.com/en/1.3/ref/models/instances/#how-django-knows-to-update-vs-insert

Basically, it says, that given you're not going to assign primary key prior 
to saving your object to DB, you may rely on PK field's value, e.g. if it's 
None - it's new model, otherwise it's existing object.

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



Re: in my model, how can I tell when I'm saving a new item

2011-07-25 Thread Javier Guerra Giraldez
On Mon, Jul 25, 2011 at 2:03 PM, webcomm  wrote:
> I want to override the save method in one of my models.  How do I know
> if I'm calling save on a newly created item or on one that is already
> in the database?  How to make that distinction in my save method?

if it has an id, it's not new

-- 
Javier

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



object value distinct for ForeignKey

2011-07-25 Thread Alfredo Alessandrini
Hi,

I've a model testDB with a foreignkey "country" related to another database.

I need to retrieve the unique value of country.common_name.

With this

country_list = testDB.objects.values('country').distinct

I can retrieve the unique value, but only the ID.

In [63]: testDB.objects.values('country').distinct
Out[63]: 

How can I  retrieve the attribute "common_name" of the country object?


thanks in advance,

Alfredo

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



in my model, how can I tell when I'm saving a new item

2011-07-25 Thread webcomm
I want to override the save method in one of my models.  How do I know
if I'm calling save on a newly created item or on one that is already
in the database?  How to make that distinction in my save method?

Thanks,
Ryan

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



Re: Django open source cashflow management app

2011-07-25 Thread zodman
http://misgastos.zodman.com.mx its on spanish sorry.

https://github.com/zodman/misgastos/

On Sun, Jul 24, 2011 at 8:44 AM, mf  wrote:
> Does anyone knows about an open source cashflow management app like
> this one[0], built with django?.
>
> [0] http://pulseapp.com/
>
> Thanks for your help.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Andres Vargas
www.zodman.com.mx

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



Re: Apache errors when trying to move Django project to python-wsgi production environment

2011-07-25 Thread Dmitry Pisklov
Can't see any errors - only notices...

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



Re: Django + PyPy = ?

2011-07-25 Thread Dmitry Pisklov
It doesn't make any difference. This error appears if you start pypy from 
directory other than /pypy-dist/bin. If I start it right from there:

./pypy
Python 2.7.1 (b590cf6de419, Apr 30 2011, 02:00:34)   

   
[PyPy 1.5.0-alpha0 with GCC 4.4.3] on linux2 

   
Type "help", "copyright", "credits" or "license" for more information.   

   
And now for something completely different: ``PyPy is an exciting technology 

   
that lets you to write fast, portable, multi-platform interpreters with less 

   
effort'' 

   
 from django.core.management import execute_manager 


Traceback (most recent call last):   

   
  File "", line 1, in  


ImportError: No module named django.core 

   



No error you mentioned, but still it doesn't work.

Cheers,
D

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



Re: Is there a way to insert data from a csv file into my database?

2011-07-25 Thread km
pls try "copy" in postgres.
KM

On Mon, Jul 25, 2011 at 7:46 PM, Josh  wrote:

> pgloader is for Postgres I think. If it has to be to a single table it
> shouldn't be that difficult in Python:
>
>
> 1) get sqlalchemy and declare the django-table. You can use
> SQLAutocode for this.
> 2) import and parse the csv-file ( import csv )
> 3) use the parsed csv as input for  sqlalchemy and add the data to the
> table. I think it also handles the sequences for the id-field well.
>
> On Jul 21, 6:17 am, Eiram  wrote:
> > Greetings,
> >
> > I'm a newbie in databases, and I was wondering if there is possible to
> > insert data from a csv file into one of the tables of my database. I
> > heard that you can use a tool called pgloader, but I don't know how to
> > use this tool or if it is possible to do this with django. Does anyone
> > knows a way to do this on django or pgloader? I really will appreciate
> > your help.
> >
> > Best Regards,
> >
> > Jary
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Apache errors when trying to move Django project to python-wsgi production environment

2011-07-25 Thread wilbur
Hello,

Trying to move my Django 1.3 application from development to
production in Apache python-wsgi environment.

Receving the following errors in the Apache logs:

[Mon Jul 25 10:35:29 2011] [notice] caught SIGTERM, shutting down
[Mon Jul 25 10:35:30 2011] [notice] mod_python: Creating 8 session
mutexes based on 6 max processes and 25 max threads.
[Mon Jul 25 10:35:30 2011] [notice] mod_python: using mutex_directory /
tmp
[Mon Jul 25 10:35:30 2011] [notice] Apache/2.2.14 (Ubuntu) mod_python/
3.3.1 Python/2.6.5 mod_wsgi/2.8 configured -- resuming normal
operations
*

My apache httpd.conf:



Alias /media/ /home/wilbur/IOM/site_media/
Alias /images/ /home/wilbur/IOM/site_media/images/
ServerName meteorite.unm.edu
ServerAlias meteorite.unm.edu
ServerAdmin meteo...@unm.edu
ErrorLog logs/metcat_errors.log

#DocumentRoot /home/wilbur/IOM

#
#Order allow,deny
#Allow from all
#


  WSGIScriptAlias / /home/wilbur/IOM/apache/django.wsgi

 #   
 #   Order allow,deny
 #   Allow from all
 #   




And my django.wsgi file:

import os
import sys

path = '/home/wilbur/IOM'
path1 = '/home/wilbur'
if path not in sys.path:
sys.path.append(path)
sys.path.append(path1)

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Any guidance would be much appreciated.

Thanks, Bill



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



Re: Is there a way to insert data from a csv file into my database?

2011-07-25 Thread nixlists
Wow, these are great.

I was thinking about having to write something much more basic, now I
have something to learn from. Thanks for sharing!

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



Re: Setting LOGIN_URL dynamically, for different users, based on app?

2011-07-25 Thread Alexey Luchko

On 23.07.2011 18:13, dpapathanasiou wrote:

That's interesting, I hadn't thought about using a hidden input for
next in the two login templates.

In the end, though, I went with just one login template.

And rather than use UserProfiles (since there were no additional
attributes I needed to attach to the default User model, and my two
user types were not related otherwise), I with Groups (https://
docs.djangoproject.com/en/dev/topics/auth/#groups) instead.

I.e., I created two groups, one for each type of user, and at signup,
assigned them to group A/B accordingly.

LOGIN_REDIRECT_URL was set to a view function that checked the Group
belonging to request.user, and dispatched to the right start page.

I also wrote a decorator for each view function in /dashboard and /
console, to check that the given request.user was eligible to invoke
the underlying function.

So far, in test, it does exactly what I need it to do, based on the
original design.

So, I'd like to say thank you to everyone who replied to this thread;
your suggestions were helpful, and I wouldn't have discovered the
Groups capability without them.



I've got a question on the solution.  Does it allow access to the other app 
by direct url after successful login and redirect?



--
Regards,
Alexey.

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



Re: Error with converting month_format in django.views.generic.date_based.object_detail

2011-07-25 Thread Josh
Found it or at least found a workaround. Added month_format to the
input dict. A bit strange though?

my_info_dict = {
'queryset': Entry.objects.all(),
'date_field': 'pub_date', 'month_format': '%m',
}

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



Re: Django hosting

2011-07-25 Thread nicolas HERSOG
I ve never deploy my "crazy and test django web apps" yet but you should
look this way :   https://docs.djangoproject.com/en/1.3/howto/deployment/

On Mon, Jul 25, 2011 at 4:12 PM, Jacob Scherffenberg
wrote:

> Hello me and a friend have created a small django web application for
> a company, and are now as good as done, but none of us really knows
> how to host a django project properly
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Is there a way to insert data from a csv file into my database?

2011-07-25 Thread Josh
pgloader is for Postgres I think. If it has to be to a single table it
shouldn't be that difficult in Python:


1) get sqlalchemy and declare the django-table. You can use
SQLAutocode for this.
2) import and parse the csv-file ( import csv )
3) use the parsed csv as input for  sqlalchemy and add the data to the
table. I think it also handles the sequences for the id-field well.

On Jul 21, 6:17 am, Eiram  wrote:
> Greetings,
>
> I'm a newbie in databases, and I was wondering if there is possible to
> insert data from a csv file into one of the tables of my database. I
> heard that you can use a tool called pgloader, but I don't know how to
> use this tool or if it is possible to do this with django. Does anyone
> knows a way to do this on django or pgloader? I really will appreciate
> your help.
>
> Best Regards,
>
> Jary

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



Django hosting

2011-07-25 Thread Jacob Scherffenberg
Hello me and a friend have created a small django web application for
a company, and are now as good as done, but none of us really knows
how to host a django project properly

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



Re: Error with converting month_format in django.views.generic.date_based.object_detail

2011-07-25 Thread Josh
The error obviously is: Page not found (404)
I'm using Django 1.3

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



Error with converting month_format in django.views.generic.date_based.object_detail

2011-07-25 Thread Josh
I'm new at using Django and am learning it now from several books and
internet. I run into problems with changing the month_format to 2
digits ( %m  = 06 ) instead of 3 chars (%b = jun)

I checked the models.py

   def get_absolute_url(self):
return ('my_entry_detail', (), { 'year':
self.my_date.strftime("%Y"),
'month': self.my_date.strftime("%m"), 'day':
self.my_date.strftime("%d"), 'slug': self.slug })
#substitute can als be @models.permalink above def
get_absolute_url = models.permalink(get_absolute_url)

In urls.py it says:

  (r'^(?P\d{4})/(?P\d{2})/(?P\d{2})/(?P[-\w]+)/
$', 'object_detail', my_info_dict, 'my_entry_detail'),

When I change it back to characters everything works. Obviously I'm
overlooking something. I went through most other files and searched
the internet, but I cannot find the reason wgy it doesn't work. Any
advice is welcome.

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



Re: Is there a way to insert data from a csv file into my database?

2011-07-25 Thread Andre Terra
This hasn't been tested, but so far I really like what I wrote:

http://dpaste.com/hold/577295/
http://dpaste.com/hold/577299/


The code might be missing a few imports, as I copy-pasted and removed a few
tidbits for the sake of simplicity. I'm thinking of packaging into an app
one of these days, or maybe write a wiki post.


Have fun.


Cheers,
AT

On Sun, Jul 24, 2011 at 11:48 PM, Jian Chang  wrote:

> Using copy_from is easy to solve it. And if you want to a get a speical
> format file from that csv, use a scirpt to handle it.
> http://www.initd.org/psycopg/docs/cursor.html#cursor.copy_from
>
> 2011/7/25 nixlists 
>
>> On Sun, Jul 24, 2011 at 2:46 PM, Jarilyn Hernandez
>>  wrote:
>> > Hi, Thanks for the response. My problem is that I have my tables created
>> on
>> > django. All I want is to import some data from a csv file to these
>> tables
>>
>> I am using HeidiSQL with MySQL for this, but a script could do much
>> more than simple single table loads.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Django + PyPy = ?

2011-07-25 Thread Bill Freeman
Get PyPy running properly first?  You second example still has the
error message, even before python's banner is printed.  That's not
related to Django at all, I'll bet.

Best to find a PyPy FAQ, mailing list, or IRC channel on which to ask.

Bill

On Fri, Jul 22, 2011 at 6:40 PM, Dmitry Pisklov  wrote:
> Hi all,
> Tried to use PyPy to run django and tried following this instructions:
> https://code.djangoproject.com/wiki/DjangoAndPyPy
>
> But with no luck - I'm getting this error when trying to run pypy manage.py:
>
> $ pypy manage.py runserver
> 'import site' failed
> Traceback (most recent call last):
>   File "app_main.py", line 53, in run_toplevel
>   File "manage.py", line 2, in 
>     from django.core.management import execute_manager
> ImportError: No module named django.core
>
>  However, it can find django module:
>
> $ pypy
> 'import site' failed
> Python 2.7.1 (b590cf6de419, Apr 30 2011, 02:00:34)
> [PyPy 1.5.0-alpha0 with GCC 4.4.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> And now for something completely different: ``"3 + 3 = 8"  Anto in the JIT
> talk''
> import django
> django
> 
>
>
> Googling didn't helped me - any ideas?
> PS it works well with my default python2.6 installation. My OS is debian, if
> it can help anyhow...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/fQx3WRQIiHIJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-07-25 Thread nicolas HERSOG
I won t be able to follow the live session but I can't wait to watch your
record on YT.

Thx!

On Mon, Jul 25, 2011 at 2:42 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Second call for register your attendance on this webcast, if you haven't
> already done so.
>
> Thanks
>
> Cal
>
>
> On Tue, Jul 12, 2011 at 2:48 PM, Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
>> Hi all,
>>
>> Great response to this, 45 registered votes in total.
>>
>> The webcast will take place on Monday 29th August 2011 - (Minimum
>> resolution 1920x1080)
>>
>> However, because the time zone results are almost split 50/50, I'm going
>> to allow users to select from two time slots, if the results are still split
>> 50/50, then I'll do both an afternoon and evening session.
>>
>> Please use this form to register your place.
>>
>> https://spreadsheets.google.com/a/foxwhisper.co.uk/spreadsheet/viewform?formkey=dENPX3BMUUFMbi1CbElwV3BvOEdkNmc6MQ
>>
>> Cal
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



AW: __init__() got an unexpected keyword argument 'city'

2011-07-25 Thread Szabo, Patrick (LNG-VIE)
Glad it works now :-)


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Showket Bhat
Gesendet: Montag, 25. Juli 2011 14:45
An: Django users
Betreff: Re: __init__() got an unexpected keyword argument 'city'

Thankyou Sir, At last I did it.. U know I was having de problem with
form name and class name..I thought these both shuld be same.. I
changed The Form name to student_form and my problem was solved...
After few days... O Thank God... may Almighty Give u long
life..Thanks a lot once again

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



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



Re: Problim with Forms..

2011-07-25 Thread KP
First question : Why are you using 'GET' here, as AFAIK the best
practice is use 'POST' whenever you want to change(Add/delete/edit)
data in the back end

The problem here is that u r instantiating the form in the wrong way.
go through the examples here about how request.POST can be used :

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

Hope it helps.

KP.




The problem is in the view code when you are instatiating the form :

use something like this :

On Jul 25, 3:51 pm, Showket Bhat  wrote:
> Hi All..
>
> I am New to Django, I am trying to develop a page with few fields and
> want to store them in database..I am acchiving this without using
> forms by writing a long code in my .html file.. I want to do it with
> forms.py which would minimize my code and i ll also acheive loose
> coupling.. When I am using forms.py in my Application it shows a good
> form design in browser but when press the submit button it gives the
> below error
>
> __init__() got an unexpected keyword argument 'city'
>
> How ever If i do it without using forms then it works and store data
> into my database..
>
> Please Help Me..I am Fed up from last 3 days solving it..
>
> Thanks In Advance
>
> My Code For views.py
> =
>
> from django.http import HttpResponse
> from django.shortcuts import render_to_response
> from school.student.models import *
> from django import forms
> from school.student.forms import *
>
> def new_form(request):
>     form = Student(request.GET)
> ##    form = Student()
> #    form = Student(
> #            initial={'address': 'Pune, Maharashtra \n411048!',
> 'city' : 'Pune'}
> #        )
>
>     return render_to_response('student_form.html', {'form' :form})
>
> def inserted(request):
> #    if 'name' in request.GET:
>         print "",request.GET
> #        form = ContactForm(request.GET)
>         roll_no = request.GET['roll_no']
>         name = request.GET['name']
>         city = request.GET['city']
>         country = request.GET['country']
>         classes_id = request.GET['classes_id']
>         print "+++",request.GET
>         sex = request.GET["sex"]
>
>         save_record = Student(roll_no = roll_no, name = name, city =
> city , sex = sex, country=country, classes_id = classes_id)
>         print
> "000---",save_record
>         save_record.save()
>         print save_record.id
>         return render_to_response('student_form.html',
> {'student' :save_record.id})
>
> =
>
> Forms.py
> 
>
> from django import forms
>
> class Student(forms.Form):
>     roll_no = forms.IntegerField(required = False)
>     name = forms.CharField(max_length=20)
>     address =
> forms.EmailField(required=False ,widget=forms.Textarea,label='Residential
> address')
>     city = forms.CharField(required=False)
>     country = forms.CharField(max_length=50)
>     sex = forms.CharField(max_length=50)
>     classes_id = forms.IntegerField(required = False)
>     subject = forms.EmailField(required = False)
>
> =
>
> Student_form.html
> -=-
>
> 
> 
>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>
> 
> 
> 
>
> 
> 
> 
> 
> 
> 
> 
> 
>
> 
>
>             
>                 You Have Successfully Inserted One Record..
>                 Press Button To Insert A New Record 
>                 
>             
>
> 
>
>         
>         
>             {{ form.as_table }}
>         
>         
>     
>
> 

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



Re: __init__() got an unexpected keyword argument 'city'

2011-07-25 Thread Showket Bhat
Thankyou Sir, At last I did it.. U know I was having de problem with
form name and class name..I thought these both shuld be same.. I
changed The Form name to student_form and my problem was solved...
After few days... O Thank God... may Almighty Give u long
life..Thanks a lot once again

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



Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-07-25 Thread Cal Leeming [Simplicity Media Ltd]
Second call for register your attendance on this webcast, if you haven't
already done so.

Thanks

Cal

On Tue, Jul 12, 2011 at 2:48 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Hi all,
>
> Great response to this, 45 registered votes in total.
>
> The webcast will take place on Monday 29th August 2011 - (Minimum
> resolution 1920x1080)
>
> However, because the time zone results are almost split 50/50, I'm going to
> allow users to select from two time slots, if the results are still split
> 50/50, then I'll do both an afternoon and evening session.
>
> Please use this form to register your place.
>
> https://spreadsheets.google.com/a/foxwhisper.co.uk/spreadsheet/viewform?formkey=dENPX3BMUUFMbi1CbElwV3BvOEdkNmc6MQ
>
> Cal
>

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



AW: __init__() got an unexpected keyword argument 'city'

2011-07-25 Thread Szabo, Patrick (LNG-VIE)
I guess you question is how you tell the view to use your template right ?!
Im not a pro myself but here is how i understand it:

You need to return a rendered response in your view.
Now you can directly refer to your template like this:

return direct_to_template(request,'xxx.html')

or if you need to pass parameters to your template u can do this:

return render_to_response('xxx.html', {'para1': value,} 
,context_instance=RequestContext(request))

I'm not sure if you need the context_instance part though.



. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Showket Bhat
Gesendet: Montag, 25. Juli 2011 14:21
An: Django users
Betreff: Re: __init__() got an unexpected keyword argument 'city'

Yes U are right.. Now sir how would i link the template with view.py..
Inface i am doing what i am reading from my python book )definitive
Guide).. but I think I am trying to do hurry... is it ?

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



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



Re: 3-legged-OAuth Logout

2011-07-25 Thread DrBloodmoney
On Mon, Jul 25, 2011 at 5:47 AM, Vignesh Sunder
 wrote:
> Hi. I was just curious to know about the logout functionality of
> OAuth..When a User logs out from the Consumer (After 3-legged OAuth
> login) site, the User's session happens to get flushed. But I believe
> this happens only on the Consumer side. However, if the User
> immediately tries to connect to the Server side, the User is
> automatically logged in. I am not sure if I have missed anything on
> this, but would appreciate if I am enlightened on the same: Would it
> be possible to inform the Server (by the Consumer) that the User has
> logged out and the User's session be flushed from the Consumer and the
> Server sides?
>
> Thanks
>

If you are logging out of Django (assuming your django app is the
consumer), the users session will get flushed from the database (or
whatever session is backed with). You'll probably still be logged into
the OAuth provider (Twitter, etc). If the person wishes to log out of
Twitter, that's where they are going to have to go in order to do
that. If they remain logged into Twitter and then start the OAuth
login flow from your app, when they get redirected to Twitter for
authentication/authorization, Twitter will read their cookie/session,
realize that the user is still logged in and has already approved
access for your application and will redirect without requiring
re-authorization.

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



Re: __init__() got an unexpected keyword argument 'city'

2011-07-25 Thread Showket Bhat
Yes U are right.. Now sir how would i link the template with view.py..
Inface i am doing what i am reading from my python book )definitive
Guide).. but I think I am trying to do hurry... is it ?

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



Re: __init__() got an unexpected keyword argument 'city'

2011-07-25 Thread bruno desthuilliers
On Jul 25, 10:23 am, Showket Bhat  wrote:
> Hi I am facing this problim from few days..tried a lot to correct it
> but everytime i failed..Please Help...
>
> I have created a simple form to store few field values in my
> database.. It was working until i used the forms.py.. when i developed
> this with forms.py i got this error
>
> __init__() got an unexpected keyword argument 'city'
>
> Now i removed the forms.py but it still shows the same error.. But i
> want to learn forms so how could i correct it ..Thanks in advance
>
> ===
> forms.py
> ===
>
> from django import forms
>
> class Student(forms.Form):

Would probably benefit from a better naming... Something like
StudentForm. Also you could use a ModelForm...

(snip)

>
> ==
> views.py
> ==

(snip)
> from school.student.models import *
> from school.student.forms import *
(snip)

You a have "Student" model class in student.models, don't you ? Now
guess what the name "Student" is bound to at this point - your model
or your form ?

As a general rule, "from  import *" is a bad practice, as it
leads to this kind of problems - one name shadowing another.

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



AW: __init__() got an unexpected keyword argument 'city'

2011-07-25 Thread Szabo, Patrick (LNG-VIE)
Plz post the code of your model, form and view so we can take a look at it. 


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Showket Bhat
Gesendet: Montag, 25. Juli 2011 12:54
An: Django users
Betreff: Re: __init__() got an unexpected keyword argument 'city'

thanks again for ur assistance... I appreciate.. Thankyou

Sir, I did some changes and now i am able to store data in database
with out using forms however i wrote whole form designing code
in .html file, but when i am trying to use forms it gives __init()
error..the same one..Please Say something


Thank you

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



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



Re: __init__() got an unexpected keyword argument 'city'

2011-07-25 Thread Showket Bhat
thanks again for ur assistance... I appreciate.. Thankyou

Sir, I did some changes and now i am able to store data in database
with out using forms however i wrote whole form designing code
in .html file, but when i am trying to use forms it gives __init()
error..the same one..Please Say something


Thank you

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



Problim with Forms..

2011-07-25 Thread Showket Bhat
Hi All..

I am New to Django, I am trying to develop a page with few fields and
want to store them in database..I am acchiving this without using
forms by writing a long code in my .html file.. I want to do it with
forms.py which would minimize my code and i ll also acheive loose
coupling.. When I am using forms.py in my Application it shows a good
form design in browser but when press the submit button it gives the
below error

__init__() got an unexpected keyword argument 'city'

How ever If i do it without using forms then it works and store data
into my database..

Please Help Me..I am Fed up from last 3 days solving it..

Thanks In Advance

My Code For views.py
=

from django.http import HttpResponse
from django.shortcuts import render_to_response
from school.student.models import *
from django import forms
from school.student.forms import *



def new_form(request):
form = Student(request.GET)
##form = Student()
#form = Student(
#initial={'address': 'Pune, Maharashtra \n411048!',
'city' : 'Pune'}
#)

return render_to_response('student_form.html', {'form' :form})


def inserted(request):
#if 'name' in request.GET:
print "",request.GET
#form = ContactForm(request.GET)
roll_no = request.GET['roll_no']
name = request.GET['name']
city = request.GET['city']
country = request.GET['country']
classes_id = request.GET['classes_id']
print "+++",request.GET
sex = request.GET["sex"]

save_record = Student(roll_no = roll_no, name = name, city =
city , sex = sex, country=country, classes_id = classes_id)
print
"000---",save_record
save_record.save()
print save_record.id
return render_to_response('student_form.html',
{'student' :save_record.id})


=

Forms.py


from django import forms

class Student(forms.Form):
roll_no = forms.IntegerField(required = False)
name = forms.CharField(max_length=20)
address =
forms.EmailField(required=False ,widget=forms.Textarea,label='Residential
address')
city = forms.CharField(required=False)
country = forms.CharField(max_length=50)
sex = forms.CharField(max_length=50)
classes_id = forms.IntegerField(required = False)
subject = forms.EmailField(required = False)


=

Student_form.html
-=-




















































You Have Successfully Inserted One Record..
Press Button To Insert A New Record 







{{ form.as_table }}








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



AW: __init__() got an unexpected keyword argument 'city'

2011-07-25 Thread Szabo, Patrick (LNG-VIE)
I think you should complete the tutorial here: 
https://docs.djangoproject.com/en/1.3/intro/tutorial01/ 
It gives you a good overview of what django does and how. 
A big part of what youre trying to accomplish is already covered in this 
tutorial so it might be all you need :-)


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Showket Bhat
Gesendet: Montag, 25. Juli 2011 12:21
An: Django users
Betreff: Re: __init__() got an unexpected keyword argument 'city'

Thanks a lot for ur kind reply..

Well i am new to python and Django, It all went over my head..Meta
Keyword, ModelForm and Espatially the flow, Please if u can send me
some code or any manual where from i can create a simple web page with
a form and then some functionality to add data in my postgres database

Thankyou

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



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



Re: __init__() got an unexpected keyword argument 'city'

2011-07-25 Thread Showket Bhat
Thanks a lot for ur kind reply..

Well i am new to python and Django, It all went over my head..Meta
Keyword, ModelForm and Espatially the flow, Please if u can send me
some code or any manual where from i can create a simple web page with
a form and then some functionality to add data in my postgres database

Thankyou

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



3-legged-OAuth Logout

2011-07-25 Thread Vignesh Sunder
Hi. I was just curious to know about the logout functionality of
OAuth..When a User logs out from the Consumer (After 3-legged OAuth
login) site, the User's session happens to get flushed. But I believe
this happens only on the Consumer side. However, if the User
immediately tries to connect to the Server side, the User is
automatically logged in. I am not sure if I have missed anything on
this, but would appreciate if I am enlightened on the same: Would it
be possible to inform the Server (by the Consumer) that the User has
logged out and the User's session be flushed from the Consumer and the
Server sides?

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Extending the ManyToMany relation, maybe a bad idea

2011-07-25 Thread Shawn Milochik
Have you looked into creating your own connector table for your 
ManyToMany using the 'through' keyword?


https://docs.djangoproject.com/en/1.3/topics/db/models/#many-to-many-relationships


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



Re: lists and not lists?

2011-07-25 Thread Tom Evans
On Mon, Jul 25, 2011 at 10:48 AM, MikeKJ  wrote:
>
> #from a json stream I have
>
> url = "http://..org/api//%s; % id
> site = urllib2.urlopen(url)
> stuff = simplejson.load(site)
>
> #within stuff is a list? of images (large, medium and small), just examine
> large
>
> large = map(lambda i: i['paths']['large'], stuff['']['images'])
>
> #this returns
> [u'/system/imgs/113/zoom/T44.jpg?1294157316',
> u'/system/imgs/114/zoom/2285731_9[1].jpg?1294157421',
> u'/system/imgs/115/zoom/2285731_17[1].jpg?1294157421',
> u'/system/imgs/116/zoom/2285731_5[1].jpg?1294157422']
>
> #I want to strip the u from each iteration but maintain the list as is
> ['/system/imgs/113/zoom/T44.jpg?1294157316',
> '/system/imgs/114/zoom/2285731_9[1].jpg?1294157421',
> '/system/imgs/115/zoom/2285731_17[1].jpg?1294157421',
> '/system/imgs/116/zoom/2285731_5[1].jpg?1294157422']
>
> cant just strip the u as it just may turn up in the string any ideas?
>
>

'The u' is not part of the string, it is how one denotes a unicode
string in python.

'a string'
u'a unicode string'

You do not want to strip 'the u'. If you want more info, read the
python documentation on unicode strings[1].

Cheers

Tom

[1] http://docs.python.org/howto/unicode.html

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



lists and not lists?

2011-07-25 Thread MikeKJ

#from a json stream I have

url = "http://..org/api//%s; % id
site = urllib2.urlopen(url)
stuff = simplejson.load(site)

#within stuff is a list? of images (large, medium and small), just examine
large

large = map(lambda i: i['paths']['large'], stuff['']['images'])

#this returns 
[u'/system/imgs/113/zoom/T44.jpg?1294157316',
u'/system/imgs/114/zoom/2285731_9[1].jpg?1294157421',
u'/system/imgs/115/zoom/2285731_17[1].jpg?1294157421',
u'/system/imgs/116/zoom/2285731_5[1].jpg?1294157422'] 

#I want to strip the u from each iteration but maintain the list as is 
['/system/imgs/113/zoom/T44.jpg?1294157316',
'/system/imgs/114/zoom/2285731_9[1].jpg?1294157421',
'/system/imgs/115/zoom/2285731_17[1].jpg?1294157421',
'/system/imgs/116/zoom/2285731_5[1].jpg?1294157422'] 

cant just strip the u as it just may turn up in the string any ideas?


-- 
View this message in context: 
http://old.nabble.com/lists-and-not-lists--tp32130268p32130268.html
Sent from the django-users mailing list archive at Nabble.com.

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



Re: AW: AW: admin_media_prefix in page source is wrong

2011-07-25 Thread Bram Deprettere




Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von Bram Deprettere
Gesendet: Montag, 18. Juli 2011 09:36
An: django-users@googlegroups.com
Betreff: Re: AW: admin_media_prefix in page source is wrong

I mean I used ln -ls to make a link to
../../lib/python2.7/site-packages/django/contrib/admin/static/admin
inside my static-folder.






I use a symbolic link to the static admin files of django instead of
copying the files to the static folder of my project.
That link works - when I go to http://inventory/static/admin is can see
the css/img/js folders for admin.


I just tried to set admin_media_url but it doesn't work either.





Found the solution to my problem:

admin_media_prefix is depricated in django 1.4, it is no longer 
necessary to set this in settings.py.


I solved my problem by setting a "/" at the end of my static_url in 
settings.py. So I changed

STATIC_URL = 'http://%s/static'
into
STATIC_URL = 'http://%s/static/'

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



AW: __init__() got an unexpected keyword argument 'city'

2011-07-25 Thread Szabo, Patrick (LNG-VIE)
Hi, 

So you want a form to store a news student in your DB right ?!
If that's correct you also have a Model for the Student so you could simply use 
a ModelForm instead of a Form.

Example:

class Buchung(models.Model):
Mitarbeiter = models.IntegerField(max_length=3)
Produkt = models.ForeignKey(Produkte)
Datum = models.DateField()
Aktivitaet = models.ForeignKey(Aktivitaeten, blank=True)
Minuten = models.PositiveIntegerField(max_length=2)

class BuchungChangeForm(ModelForm):
class Meta:
model = Buchung

BuchungChangeForm should now be a form that has all the fields for Buchung.


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Showket Bhat
Gesendet: Montag, 25. Juli 2011 10:23
An: Django users
Betreff: __init__() got an unexpected keyword argument 'city'

Hi I am facing this problim from few days..tried a lot to correct it
but everytime i failed..Please Help...

I have created a simple form to store few field values in my
database.. It was working until i used the forms.py.. when i developed
this with forms.py i got this error

__init__() got an unexpected keyword argument 'city'

Now i removed the forms.py but it still shows the same error.. But i
want to learn forms so how could i correct it ..Thanks in advance

===
forms.py
===

from django import forms

class Student(forms.Form):
roll_no = forms.IntegerField(required = False)
name = forms.CharField(max_length=20)
address =
forms.EmailField(required=False ,widget=forms.Textarea,label='Residential
address')
city = forms.CharField(required=False)
country = forms.CharField(max_length=50)
sex = forms.CharField(max_length=50)
classes_id = forms.IntegerField(required = False)
subject = forms.EmailField(required = False)
print ""


==
views.py
==

django.http import HttpResponse
from django.shortcuts import render_to_response
from school.student.models import *
from django import forms
from school.student.forms import *



def new_form(request):
#form = Student(request.GET)
##form = Student()
#form = Student(
#initial={'address': 'Pune, Maharashtra \n411048!',
'city' : 'Pune'}
#)

return render_to_response('student_form.html')


def inserted(request):
if 'name' in request.GET:
print "",request.GET
#form = ContactForm(request.GET)
roll_no = request.GET['roll_no']
name = request.GET['name']
city = request.GET['city']
country = request.GET['country']
classes_id = request.GET['classes_id']
print "+++",request.GET
sex = request.GET["sex"]

save_record = Student(roll_no = roll_no, name = name, city =
city , sex = sex, country=country, classes_id = classes_id)
print "00---"
save_record
save_record.save()
print save_record.id
return render_to_response('student_form.html',
{'student' :save_record.id})

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



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



__init__() got an unexpected keyword argument 'city'

2011-07-25 Thread Showket Bhat
Hi I am facing this problim from few days..tried a lot to correct it
but everytime i failed..Please Help...

I have created a simple form to store few field values in my
database.. It was working until i used the forms.py.. when i developed
this with forms.py i got this error

__init__() got an unexpected keyword argument 'city'

Now i removed the forms.py but it still shows the same error.. But i
want to learn forms so how could i correct it ..Thanks in advance

===
forms.py
===

from django import forms

class Student(forms.Form):
roll_no = forms.IntegerField(required = False)
name = forms.CharField(max_length=20)
address =
forms.EmailField(required=False ,widget=forms.Textarea,label='Residential
address')
city = forms.CharField(required=False)
country = forms.CharField(max_length=50)
sex = forms.CharField(max_length=50)
classes_id = forms.IntegerField(required = False)
subject = forms.EmailField(required = False)
print ""


==
views.py
==

django.http import HttpResponse
from django.shortcuts import render_to_response
from school.student.models import *
from django import forms
from school.student.forms import *



def new_form(request):
#form = Student(request.GET)
##form = Student()
#form = Student(
#initial={'address': 'Pune, Maharashtra \n411048!',
'city' : 'Pune'}
#)

return render_to_response('student_form.html')


def inserted(request):
if 'name' in request.GET:
print "",request.GET
#form = ContactForm(request.GET)
roll_no = request.GET['roll_no']
name = request.GET['name']
city = request.GET['city']
country = request.GET['country']
classes_id = request.GET['classes_id']
print "+++",request.GET
sex = request.GET["sex"]

save_record = Student(roll_no = roll_no, name = name, city =
city , sex = sex, country=country, classes_id = classes_id)
print "00---"
save_record
save_record.save()
print save_record.id
return render_to_response('student_form.html',
{'student' :save_record.id})

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



A problem about rpc4django

2011-07-25 Thread Kejun He
Hi,

A strange problem! The same project about RPC could work normally in Linux,
but it reported a error "global name 'dispatcher' is not defined" on
development server(http://127.0.0.1:8000) in Windows OS.

Did anyone meet this problem before?
Could you tell me how to fix it?

Thank you!


==traceback===
Traceback Switch to copy-and-paste view

   - C:\Python25\Lib\site-packages\django\core\handlers\base.py in
   get_response
   1. response = callback(request, *callback_args, **callback_kwargs) ...
   ▶ Local vars 
   - C:\Python25\Lib\site-packages\django\views\decorators\csrf.py in
   wrapped_view
   1. resp = view_func(*args, **kwargs) ...
   ▶ Local vars 
   - C:\Python25\Lib\site-packages\django\views\decorators\csrf.py in
   wrapped_view
   1. return view_func(*args, **kwargs) ...
   ▶ Local vars 
   - E:\gmadmin\rpc4django\views.py in serve_rpc_request
   1. methods = dispatcher.list_methods() ...
   ▶ Local vars 





regards,
he

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



Re: Web development newbie

2011-07-25 Thread bruno desthuilliers
On Jul 24, 12:40 am, Javier Guerra Giraldez 
wrote:
> On Sat, Jul 23, 2011 at 3:03 PM, bruno desthuilliers
>
>  wrote:
> > I don't understand what you mean by "serverside apps" here - I mean,
> > Django IS for serverside applications, not client side (which would
> > require javascript).
>
> There are other kinds of servers and clients besides web, you know.

I do. What I meant is that Django (and most of web development) is
about serverside stuff too.

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



Re: Web development newbie

2011-07-25 Thread kenneth gonsalves
On Sun, 2011-07-24 at 04:25 -0700, Dmitry Pisklov wrote:
> PS I am a Java developer, and more then year ago started looking into
> python, wrote few small components for work and now trying to leverage
> django for my web-project. I doubt I could do something so fast if I
> haven't known python at all.

could you add a few lines here:

https://code.djangoproject.com/wiki/UsingTheMailingList#Java

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