Re: docstrings for inherited models not showing in Admin Docs

2012-11-11 Thread David Simmons
Mike

thanks for the quick response. I'll take a look at the source.

cheers

Dave

-- 
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/-/isD2JdKwX5YJ.
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: AttributeError for unique field during ModelForm validation

2012-11-11 Thread Andrejus

Unfortunately I haven't got experience with abstarct models, one thing I 
clearly carried out form docs -  abstract model has only one clear purpose 
- to avoid duplicating the same fields and methods when writing code for 
models. Abstract model is never transformed to database table, so may not 
support all model's features in strightforward way. Try to make more simple 
design wich may seem more clear for django. You can set unique key on one 
or more more fields not only using unique property, but in Meta class as 
well (it is used on real models when you want to set unique composite key). 
I can advise to use multy-table model inheritance if you want to store 
common set of fields in a distinct database table - this way I have 
successfully used myself in my own project. It's simple, clear and 
well-working method. Django authomatcally creates all necessary pk's and 
fk's in the database, all models appear in admin site. And you can use 
ModelForms on any model you want.

воскресенье, 11 ноября 2012 г., 3:05:54 UTC+4 пользователь Rohit Banga 
написал:
>
> I want to ensure that a username is unique hence the unique constraint. Is 
> having a ModelForm with an abstract model is supported? If not I will 
> consider dynamically creating an instance of derived model form. But it 
> looks a lot cleaner with the abstract class. 
>
> On Saturday, November 10, 2012 5:12:18 PM UTC-5, Andrejus wrote:
>>
>> Hi!
>> I would try to set unique property within "real" model, not within 
>> abstract base class. Besides django creates unique pk on each model by 
>> default, so to my mind creating additional unique field is redundant. Not 
>> quite sure, but there seems to be some restrictions on use of unique 
>> property. 
>>
>> воскресенье, 11 ноября 2012 г., 0:40:54 UTC+4 пользователь Rohit Banga 
>> написал:
>>>
>>> I noticed a strange behavior with Django and filed a bug
>>> https://code.djangoproject.com/ticket/19271#ticket
>>>
>>> It is suggested that I first check on the support group if the bug is 
>>> valid or not. Fair Enough.
>>>
>>> I have created a standalone project to demonstrate the problem. In order 
>>> to run it you may have to create a database and configure it in settings.py 
>>> though.
>>> Code that does not work:
>>>
>>> https://github.com/iamrohitbanga/django_ticket_19271/tree/code_not_working
>>>
>>> Code that works:
>>> https://github.com/iamrohitbanga/django_ticket_19271/tree/code_working
>>>
>>> Just creating my_id field in BaseModel class with unique=True set causes 
>>> the code to fail with the stack trace below.
>>> My usecase is a bit weird hence you would find model form inheriting 
>>> from abstract models. IMHO that should not matter. The code works without 
>>> unique fields but does not work with non-unique fields. I will be happy to 
>>> provide more clarifications.
>>>
>>> Below is the stacktrace for the 
>>> "AttributeError at /create_new type object 'BaseModel' has no attribute 
>>> '_default_manager' Traceback: File 
>>> "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in 
>>> get_response 111. response = callback(request, *callback_args, 
>>> **callback_kwargs) File "django_bug_19271/testproj/testproj/views.py" in 
>>> create_new 33. if form.is_valid(): File 
>>> "/usr/local/lib/python2.7/dist-packages/django/forms/forms.py" in is_valid 
>>> 124. return self.is_bound and not bool(self.errors) File 
>>> "/usr/local/lib/python2.7/dist-packages/django/forms/forms.py" in 
>>> _get_errors 115. self.full_clean() File 
>>> "/usr/local/lib/python2.7/dist-packages/django/forms/forms.py" in 
>>> full_clean 272. self._post_clean() File 
>>> "/usr/local/lib/python2.7/dist-packages/django/forms/models.py" in 
>>> _post_clean 338. self.validate_unique() File 
>>> "/usr/local/lib/python2.7/dist-packages/django/forms/models.py" in 
>>> validate_unique 347. self.instance.validate_unique(exclude=exclude) File 
>>> "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py" in 
>>> validate_unique 633. errors = self._perform_unique_checks(unique_checks) 
>>> File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py" in 
>>> _perform_unique_checks 717. qs = 
>>> model_class._default_manager.filter(**lookup_kwargs) Exception Type: 
>>> AttributeError at /create_new Exception Value: type object 'BaseModel' has 
>>> no attribute '_default_manager' Request information: GET: No GET data POST: 
>>> csrfmiddlewaretoken = u'**' my_id = u'1' name = u'Rohit' FILES: No 
>>> FILES data COOKIES: csrftoken = '' 
>>>
>>

-- 
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/-/vH-qJUSke8gJ.
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?h

Re: AttributeError for unique field during ModelForm validation

2012-11-11 Thread Rohit Banga
Thanks Andrejus. Looks like you understand my usecase. I have to use
multiple tables with the same schema which is why I am using inheritance. I
am using abstract base models as each model should get its own table. If I
use multi-table inheritance data from all these tables ends up in one table
while creating a one-to-one relationship between the two tables. I must use
abstract models. But I can consider creating model forms for the child
tables and then loading the model form dynamically.

I can now understand that the unique check on the abstract model would fail
if the model form pointed to an abstract model. It does not know which
table implementation to look at to verify if the unique constraint is
satisfied.


Thanks
Rohit Banga
http://iamrohitbanga.com/


On Sun, Nov 11, 2012 at 9:21 AM, Andrejus wrote:

>
> Unfortunately I haven't got experience with abstarct models, one thing I
> clearly carried out form docs -  abstract model has only one clear purpose
> - to avoid duplicating the same fields and methods when writing code for
> models. Abstract model is never transformed to database table, so may not
> support all model's features in strightforward way. Try to make more simple
> design wich may seem more clear for django. You can set unique key on one
> or more more fields not only using unique property, but in Meta class as
> well (it is used on real models when you want to set unique composite key).
> I can advise to use multy-table model inheritance if you want to store
> common set of fields in a distinct database table - this way I have
> successfully used myself in my own project. It's simple, clear and
> well-working method. Django authomatcally creates all necessary pk's and
> fk's in the database, all models appear in admin site. And you can use
> ModelForms on any model you want.
>
> воскресенье, 11 ноября 2012 г., 3:05:54 UTC+4 пользователь Rohit Banga
> написал:
>
>> I want to ensure that a username is unique hence the unique constraint.
>> Is having a ModelForm with an abstract model is supported? If not I will
>> consider dynamically creating an instance of derived model form. But it
>> looks a lot cleaner with the abstract class.
>>
>> On Saturday, November 10, 2012 5:12:18 PM UTC-5, Andrejus wrote:
>>>
>>> Hi!
>>> I would try to set unique property within "real" model, not within
>>> abstract base class. Besides django creates unique pk on each model by
>>> default, so to my mind creating additional unique field is redundant. Not
>>> quite sure, but there seems to be some restrictions on use of unique
>>> property.
>>>
>>> воскресенье, 11 ноября 2012 г., 0:40:54 UTC+4 пользователь Rohit Banga
>>> написал:

 I noticed a strange behavior with Django and filed a bug
 https://code.djangoproject.**com/ticket/19271#ticket

 It is suggested that I first check on the support group if the bug is
 valid or not. Fair Enough.

 I have created a standalone project to demonstrate the problem. In
 order to run it you may have to create a database and configure it in
 settings.py though.
 Code that does not work:
 https://github.com/**iamrohitbanga/django_ticket_**
 19271/tree/code_not_working

 Code that works:
 https://github.com/**iamrohitbanga/django_ticket_**
 19271/tree/code_working

 Just creating my_id field in BaseModel class with unique=True set
 causes the code to fail with the stack trace below.
 My usecase is a bit weird hence you would find model form inheriting
 from abstract models. IMHO that should not matter. The code works without
 unique fields but does not work with non-unique fields. I will be happy to
 provide more clarifications.

 Below is the stacktrace for the
 "AttributeError at /create_new type object 'BaseModel' has no attribute
 '_default_manager' Traceback: File "/usr/local/lib/python2.7/**
 dist-packages/django/core/**handlers/base.py" in get_response 111.
 response = callback(request, *callback_args, **callback_kwargs) File
 "django_bug_19271/testproj/**testproj/views.py" in create_new 33. if
 form.is_valid(): File "/usr/local/lib/python2.7/**
 dist-packages/django/forms/**forms.py" in is_valid 124. return
 self.is_bound and not bool(self.errors) File "/usr/local/lib/python2.7/
 **dist-packages/django/forms/**forms.py" in _get_errors 115.
 self.full_clean() File "/usr/local/lib/python2.7/**
 dist-packages/django/forms/**forms.py" in full_clean 272.
 self._post_clean() File "/usr/local/lib/python2.7/**
 dist-packages/django/forms/**models.py" in _post_clean 338.
 self.validate_unique() File "/usr/local/lib/python2.7/**
 dist-packages/django/forms/**models.py" in validate_unique 347.
 self.instance.valid

Re: Admin, m2m relationship and custom save method: is save_related of any help?

2012-11-11 Thread Fabio Natali

On 02/11/12 08:00, Fabio Natali wrote:

Hi!

Snippet: http://dpaste.com/822354/



In the admin I make use of a tabular inline to possibly create Product
and Component objects at the same time.

[...]

I ended up using signals, which looks like an obvious solution now. 
Whenever I save or delete a component a post_save or post_delete signal 
is sent and my product total price is calculated again.


Cheers! Fabio.


--
Fabio Natali

--
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: CBV for Nested Formesets

2012-11-11 Thread Kevin
This example code and example is based on the tutorial provided in your 
URL.  Formsets do not have a save_all() function by default.  The provided 
save_all() does not return back any object, so you should provide a 
success_url or override the function get_success_url() in your class.
You'll need to override the "form_valid()" method to call save_all(), 
rather than a simple save().  Here's a simple example:

class FormsetView(UpdateView):
model = Block
form_class = BuildingFormset
def form_valid(self, form):
self.object = form.save_all()
return super(ModelFormMixin, self).form_valid(form)

Use the other code from the blog. self.object is used if you don't specify 
a success_url, it uses it like self.object.get_absolute_url() to determine 
the URL you go to once the form is successfully saved.  This example code 
here should work, as the API for a Formset is very similar to a Form.

For more information on how to use class-based views, be sure to check out 
my latest blog post on the subject, it may provide some useful information 
on what functions to override:

http://www.pythondiary.com/blog/Nov.11,2012/mapping-out-djangos-class-based-views.html

Best Regards,
  Kevin Veroneau

On Friday, 9 November 2012 12:55:13 UTC-6, Lee Hinde wrote:
>
> I'm looking at these two blog posts to help me figure out nested formsets:
>
> http://yergler.net/blog/2009/09/27/nested-formsets-with-django/
>
> http://andreipetre.tumblr.com/post/26203496689/nested-formsets-with-django
>
> The example uses a function view and I was interested using class-based 
> views, but I can't figure out where to start.
>
> Thanks for any pointers.
>
>  - Lee
>

-- 
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/-/fAx0JHkuCOcJ.
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 many developers have moved to class-based views?

2012-11-11 Thread Kevin
Hello!

  I am curious of how many existing Django developers have moved over to 
class-based views or are still using the function-based ones.  I tend to 
use a mix depending on what I am trying to do.  I try to stick with 
class-based views, but fallback to function-based ones for process-based 
views, views which don't return a template but redirect after processing 
some end-user action.

  At first class-based views were a little confusing and the Django docs 
didn't really clarify how they work as well under the hood and the best 
practices on subclassing them.  It took me a little while to properly 
understand how they worked and what functions to override to do specific 
tasks.  This mainly involved reading the source code to see how everything 
worked.

Best Regards,
  Kevin Veroneau
  Python Diary

-- 
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/-/-b1KxU29PYwJ.
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.



custom User model and login()

2012-11-11 Thread Anil Jangity
I am trying to build a User model with a dedicated LDAP backend. I have no SQL 
database.

def login(request):
   ...
   login(request, user)
   request.user.is_authenticated()   ---> return True
   return HttpResponseRedirect("/manage")

def manage(request):
   print request.user.is_authenticated()--> returns False

Shouldn't the manage() show the user being authenticated?
What exactly happens when I do a login() call? Does it store some sessions 
somewhere? If so, what can I do in my custom User model to make it save this 
session?

Thanks,
Anil



-- 
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: How many developers have moved to class-based views?

2012-11-11 Thread Lachlan Musicman
I'm about to start transferring a few function based views, but like
you am using a mix as needed as it stands.

Re documentation, the docs on the dev stream have significantly more
useful and comprehensive info for class based views.

I think that there will always be a use for function based views (for
instance I'm pushing out a lot of stats on one page, and they don't
compute themselves) but from what I can see, most model based views
should move to the cbv

cheers
L.

On Mon, Nov 12, 2012 at 5:57 AM, Kevin  wrote:
> Hello!
>
>   I am curious of how many existing Django developers have moved over to
> class-based views or are still using the function-based ones.  I tend to use
> a mix depending on what I am trying to do.  I try to stick with class-based
> views, but fallback to function-based ones for process-based views, views
> which don't return a template but redirect after processing some end-user
> action.
>
>   At first class-based views were a little confusing and the Django docs
> didn't really clarify how they work as well under the hood and the best
> practices on subclassing them.  It took me a little while to properly
> understand how they worked and what functions to override to do specific
> tasks.  This mainly involved reading the source code to see how everything
> worked.
>
> Best Regards,
>   Kevin Veroneau
>   Python Diary
>
> --
> 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/-/-b1KxU29PYwJ.
> 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.



-- 
...we look at the present day through a rear-view mirror. This is
something Marshall McLuhan said back in the Sixties, when the world
was in the grip of authentic-seeming future narratives. He said, “We
look at the present through a rear-view mirror. We march backwards
into the future.”

http://www.warrenellis.com/?p=14314

-- 
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: How many developers have moved to class-based views?

2012-11-11 Thread Arnold Krille
On Sun, 11 Nov 2012 09:57:16 -0800 (PST) Kevin 
wrote:
> Hello!
> 
>   I am curious of how many existing Django developers have moved over
> to class-based views or are still using the function-based ones.  I
> tend to use a mix depending on what I am trying to do.  I try to
> stick with class-based views, but fallback to function-based ones for
> process-based views, views which don't return a template but redirect
> after processing some end-user action.

Docs on CBV in django1.4 are a bit sparse to say the least.

And we started the project before there where CBV.

But we are using CBV for some stuff already, deriving a
JqtableAjaxView from the documentations AjaxView has saved us quite
some code. And simplified testing.
there are other occasions where CBV would result in more code, so we
don't use it there...

One of our greatest problems is that you can't use permission
decorators as easily as with function-views. But on one hand I just
learned about the Mixins of django-braces. And on the other hand most
of our views need object-based permissions with a much more
sophisticated permission model than just users and groups. So we are
doing a lot ourselves and only provide an auth-backend to get our
permissions into the django-mechanisms where its applicable.
And for example its far better to return an empty dataset via an
ajax-call than a 404 or a login-page. So we actually filter the
datasets on what the user is allowed to view and not disturb him with
ugly error-messages...

Have fun,

Arnold


signature.asc
Description: PGP signature


Re: How many developers have moved to class-based views?

2012-11-11 Thread Lee Hinde
The dev docs are much more informative.


On Sun, Nov 11, 2012 at 10:45 AM, Arnold Krille wrote:

>
> Docs on CBV in django1.4 are a bit sparse to say the least.
>


>
> Have fun,
>
> Arnold
>

-- 
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: How many developers have moved to class-based views?

2012-11-11 Thread Kevin
Wow, the dev docs are much more informative and actually explains the best 
way to alter a form before saving it.  I was using a different method, but 
the method mentioned in the dev docs are much more cleaner than what I was 
doing.  Many thanks for this.

On Sunday, 11 November 2012 12:54:45 UTC-6, Lee Hinde wrote:
>
> The dev docs are much more informative.
>
>
> On Sun, Nov 11, 2012 at 10:45 AM, Arnold Krille 
> 
> > wrote:
>
>>
>> Docs on CBV in django1.4 are a bit sparse to say the least.
>>
>  
>
>>
>> Have fun,
>>
>> Arnold
>>
>
>

-- 
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/-/jZ8_sGjQpkoJ.
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 mogilefs file backend?

2012-11-11 Thread DK
Is there any working django 1.4 file backend for MogileFS?

I've tried django-storages but it doesn't seem to work properly (stores a 
filename instead of content!?) and it does not implement open() method on 
stored file.

-- 
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/-/-EVkqvpQwmQJ.
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: Queries to multiple tables

2012-11-11 Thread Matt Schinckel
Following up: if it affects a single instance of an object, then it belongs 
as a model method.

If it affects any number of them, then it should perhaps go on the manager 
(or even the queryset: I use django-model-utils PassThroughManager for this 
a lot).

Matt.

On Sunday, November 11, 2012 3:53:26 AM UTC+10:30, Javier Guerra wrote:
>
> On Sat, Nov 10, 2012 at 6:15 AM, Tomas Ehrlich 
> > 
> wrote: 
> > I usualy put methods like this one into Model, although Manager is also 
> > possible. Definitely not View or sth else. 
>
> definitely in the model. 
>
> you'd use it like this: 
>
> accnt = get_object_or_404 (Account, pk=account_id) 
> payee = get_object_or_404 (...) 
> accnt.make_payment (payee, amount) 
>
> it would be as easy as adding a method to your Account class, for example: 
>
> class Account (models.Model): 
> .. 
> .. 
>
> def make_payment(self, payee, amount, save=True): 
> if amount > self.balance: 
> throw NotEnoughFunds 
> self.balance -= amount 
> payee.balance += amount 
> if save: 
> self.save() 
> payee.save() 
>
> (of course, a serious accounting app don't modify balances but 
> registers debit/credit entries) 
>
> -- 
> Javier 
>

-- 
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/-/pU7gNc-iJe8J.
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.



Exporting tuple/dictionary within django html template

2012-11-11 Thread Hemanshu Ahuja
Hi Folks,

I want to export data from my named tuple within my django html template.
Can someone please point me to an example or let me know how to accomplish
this?
I know how to get this done within my python script but this time I want to
get this done inside of my html template page. Basically I want to have a
button which says "Export to CSV" on html page and clicking on it exports
data (from a named tuple) to a csv

Thanks,
Hemanshu

-- 
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: custom User model and login()

2012-11-11 Thread Russell Keith-Magee
On Mon, Nov 12, 2012 at 2:08 AM, Anil Jangity  wrote:

> I am trying to build a User model with a dedicated LDAP backend. I have no
> SQL database.
>
> def login(request):
>...
>login(request, user)
>request.user.is_authenticated()   ---> return True
>return HttpResponseRedirect("/manage")
>
> def manage(request):
>print request.user.is_authenticated()--> returns False
>
> Shouldn't the manage() show the user being authenticated?
> What exactly happens when I do a login() call? Does it store some sessions
> somewhere? If so, what can I do in my custom User model to make it save
> this session?
>

Django logins are handled by a session, and sessions are saved by the
Session middleware when the response is passed back to the client. Django's
builtin login call returns a response that sets the new session for the
logged in user; however, you're throwing away that information and
returning your own response, so the session isn't being saved.

If you want to persist the session, you'll need to pull the relevant
session keys over from the response returned by the login call, and attach
them to the redirect response (or find some other sequence of events that
will let you get to the manage view).

Yours,
Russ Magee %-)

-- 
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: How many developers have moved to class-based views?

2012-11-11 Thread Kurtis Mullins
I use them!


On Sun, Nov 11, 2012 at 2:05 PM, Kevin  wrote:

> Wow, the dev docs are much more informative and actually explains the best
> way to alter a form before saving it.  I was using a different method, but
> the method mentioned in the dev docs are much more cleaner than what I was
> doing.  Many thanks for this.
>
>
> On Sunday, 11 November 2012 12:54:45 UTC-6, Lee Hinde wrote:
>
>> The dev docs are much more informative.
>>
>>
>> On Sun, Nov 11, 2012 at 10:45 AM, Arnold Krille wrote:
>>
>>>
>>> Docs on CBV in django1.4 are a bit sparse to say the least.
>>>
>> 
>>
>>>
>>> Have fun,
>>>
>>> Arnold
>>>
>>
>>  --
> 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/-/jZ8_sGjQpkoJ.
>
> 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: Digest for django-users@googlegroups.com - 12 Messages in 7 Topics

2012-11-11 Thread muhammed riyas
thank you guyz...:)


On Sat, Nov 10, 2012 at 7:46 PM,  wrote:

>   Today's Topic Summary
>
> Group: http://groups.google.com/group/django-users/topics
>
>- Queries to multiple tables <#13aeaadf926b84cb_group_thread_0> [2
>Updates]
>- google app engine suggestion <#13aeaadf926b84cb_group_thread_1> [4
>Updates]
>- Hi guyz . iam just a beginner in google app engine..plz help me "abt
>deleting datas from DATASTORE" <#13aeaadf926b84cb_group_thread_2> [1
>Update]
>- CBV for Nested Formesets <#13aeaadf926b84cb_group_thread_3> [1
>Update]
>- How to build this query <#13aeaadf926b84cb_group_thread_4> [1 Update]
>- How to crop image ? <#13aeaadf926b84cb_group_thread_5> [2 Updates]
>- tutorial first step. -ImportError: No module named 
> django.core-<#13aeaadf926b84cb_group_thread_6>[1 Update]
>
>   Queries to multiple 
> tables
>
>Kristofer  Nov 10 01:23AM -0600
>
>Hello,
>
>I'm new to Django and trying to learn it by making a simple
>budget/checkbook application.
>
>I apologize for my ignorance, but I couldn't seem to find an answer to
>this on Google or the Django docs from my searches.
>
>I want to create a function that will take a bank account as an id
>number (assumed to already exist), and the payee/amount. From there, the
>function will do a typical bank transaction: 1) add the entry to the
>"Ledger" table, and subtract the amount from the "balance" field of the
>"Account" table for the account referenced in the id number passed to the
>function.
>
>Where is the appropriate/intended place to put that type of function?
>Model, Manager, View, or somewhere completely different?
>
>My best guess is that it belongs in a Manager, but all of the examples
>I can find seem to indicate that Managers are intended for queries.
>
>Thanks in advance,
>
>Kris
>
>
>
>
>Tomas Ehrlich  Nov 10 12:15PM +0100
>
>Hi Kristofer,
>I usualy put methods like this one into Model, although Manager is also
>possible. Definitely not View or sth else.
>
>Why I like Model more than Manager is this difference (suppose your
>method is called make_payment):
>
>Account.make_payment # via Model
>Account.objects.make_payment # via Manager
>
>and because this method is "creating" object instead of "retrieving"
>objects, it seems to me more apropriate. I know, there are methods like
>create or get_or_create in Manager, so propably someone would have a
>better arguments on this. Or maybe it's just matter of taste. In fact,
>in one application of mine I have method Node.create which do some
>fancy stuff (creating other related objects, consistency checks, etc.)
>and then call Node.objects.create.
>
>
>Cheers,
>Tom
>
>Dne Sat, 10 Nov 2012 01:23:44 -0600 (CST)
>
>> My best guess is that it belongs in a Manager, but all of the
>examples I can find seem to indicate that Managers are intended for
>queries.
>
>> Thanks in advance,
>
>> Kris
>
><
>
>
>
>   google app engine 
> suggestion
>
>Aswani Kumar  Nov 09 08:53AM -0800
>
>hi, i am planning to develop an education related information portal
>in
>django and google app engine.
>
>my question is google app engine supports python 2.7 but django moving
>towards python 3.x now with django 1.5 the minimum required version of
>python is 2.6. and django 1.6 will be on python 2.7. what will be my
>future
>if i choose google app engine and django.
>
>i need a PAAS like google app engine so i can concentrate on
>developing app
>instead of managing servers.
>
>please give me suggestions.
>
>
>
>
>Javier Guerra Giraldez  Nov 09 12:54PM -0500
>
>> towards python 3.x now with django 1.5 the minimum required version
>of
>> python is 2.6. and django 1.6 will be on python 2.7. what will be my
>future
>> if i choose google app engine and django.
>
>migration to 3.x is still experimental, it will be some time before
>it's mandatory.
>
>also, a significant part of Django deprecation policy is which
>versions are available in widely used platforms. Not so long ago, 2.4
>was still supported just because some still-supported RHEL version
>uses it by default.
>
>finally, i'm sure Google will make 3.x available before 2.7 is
>hopelessly obsolete. Remember that they employ some big-name Python
>developers just for that (even someone with GvR initials)
>
>
>> i need a PAAS like google app engine so i can concentrate on
>developing app
>> instead of managing servers.
>
>personally, i find much easier to manage my own server than to be
>constantly distracted by the by-design limitations of the different
>PaaS offerings. But if you find one that you really l

Exception Type: TypeError Exception Value: individual() takes exactly 2 arguments (1 given)

2012-11-11 Thread muhammed riyas
Request Method:GET
Request URL:http://localhost:9744/employee/1/
Exception Type:TypeError
Exception Value:individual() takes exactly 2 arguments (1 given)
Exception 
Location:/home/user/google_appengine/lib/django_0_96/django/core/handlers/base.py
 
in get_response, line 77



url is  (r'^employee/[0-9]+/$','qburstemployeeapp.main.views.individual'),

in this the [0-9]+ denotes id number for the user ...

in my view...



def individual(request,id):
employees = Employeeprofile.all()
for employee in employees:
if(employee.key().id() == id):
return render_to_response('main/individual1.html', { 'employee' : employee 
}) 

What is the mistake?...


Thanks in advance

-- 
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/-/PJcdrn57HooJ.
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: Exception Type: TypeError Exception Value: individual() takes exactly 2 arguments (1 given)

2012-11-11 Thread Jonathan D. Baker
You need to capture the id parameter in your URL by wrapping it in parentheses: 
([0-9])

Sent from my iPhone

On Nov 12, 2012, at 12:49 AM, muhammed riyas  
wrote:

> Request Method:GET
> Request URL:http://localhost:9744/employee/1/
> Exception Type:TypeError
> Exception Value:individual() takes exactly 2 arguments (1 given)
> Exception 
> Location:/home/user/google_appengine/lib/django_0_96/django/core/handlers/base.py
>  in get_response, line 77
> 
> 
> 
> url is  (r'^employee/[0-9]+/$','qburstemployeeapp.main.views.individual'),
> 
> in this the [0-9]+ denotes id number for the user ...
> 
> in my view...
> 
> 
> 
> def individual(request,id):
> employees = Employeeprofile.all()
> for employee in employees:
> if(employee.key().id() == id):
>   return render_to_response('main/individual1.html', { 'employee' 
> : employee }) 
> 
> What is the mistake?...
> 
> 
> Thanks in advance
> 
> -- 
> 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/-/PJcdrn57HooJ.
> 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.