Please help me with django form 2.

2012-01-10 Thread coded kid
Hi guys, whenever I signup for my django form, my database is only saving the id no and not names, username, email etc. | #sorry for posting it like this. I'm on mobile. Okay. In my views.py, this ( | ) means next line.@csrf_exempt | def welcome(request): | if request.method=='POST': |

Re: Please help me with django form

2012-01-10 Thread kenneth gonsalves
On Tue, 2012-01-10 at 23:20 -0800, coded kid wrote: > Hi guys, whenever I signup using the django form I created, my > database is only saving the id no instead of username, email, first > name etc. Please what should I do? please show us the relevant code -- regards Kenneth Gonsalves -- You

Please help me with django form

2012-01-10 Thread coded kid
Hi guys, whenever I signup using the django form I created, my database is only saving the id no instead of username, email, first name etc. Please what should I do? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Directory layout for a large Django application (not project)

2012-01-10 Thread IgorS
Thank you, Tom, for your thorough explanations (and moral support :-) The situation is much clearer now. I hope this topic will be useful for those who will later on join the wonderful Django world. Thank you, Brian, for sharing your layout and experience. Actually, I had been thinking about

Re: scheduling in future

2012-01-10 Thread Mike Dewhirst
On 11/01/2012 4:09pm, Donald Casson wrote: I would take a peek at celery and the eta function. It allows you to specify the task as specified in tasks.py with an eta to the run_asynchronous method. Hope this helps. Looking it up as we speak Thanks Mike Cheers Don On Jan 11, 2012 2:31

Re: scheduling in future

2012-01-10 Thread Donald Casson
I would take a peek at celery and the eta function. It allows you to specify the task as specified in tasks.py with an eta to the run_asynchronous method. Hope this helps. Cheers Don On Jan 11, 2012 2:31 PM, "Mike Dewhirst" wrote: > What is the best way to schedule

Re: scheduling in future

2012-01-10 Thread Wen 温业逵Yekui
about sending email,you can utilize the libary function of django to do so 2012/1/11 Wen 温业逵Yekui > when you get the request of that user,you can get the "date" about the > user from database ,then check if that date is today > > > 2012/1/11 Mike Dewhirst

Re: scheduling in future

2012-01-10 Thread Wen 温业逵Yekui
when you get the request of that user,you can get the "date" about the user from database ,then check if that date is today 2012/1/11 Mike Dewhirst > What is the best way to schedule future events in Django? > > I have a table with future dates and user info. When

scheduling in future

2012-01-10 Thread Mike Dewhirst
What is the best way to schedule future events in Django? I have a table with future dates and user info. When date==today I want Django to send an email to that user. Ideas? Thanks Mike -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Changing the index page

2012-01-10 Thread kalyan boga
Hi, I was working on tutorial 2 and i tried to change the layout of index page. Copied the index.html template to my template folder under admin and changed the contents to suit the site. The second line errors out : {% load i18n admin_static %} The error on the page reads : TemplateSyntaxError

Re: /?next= not redirect user

2012-01-10 Thread Guddu
The way i did it was to have the following in my login template (inside the login ) Replace /SiteRoot/url with whatever you would like the user to be redirected to after a successful login. Regards, Guddu On Jan 11, 7:39 am, Weldan wrote: > hi. can anyone show me how to do

Re: what is django.db.models.Q for?

2012-01-10 Thread Wen 温业逵Yekui
thanks! 2012/1/11 Eugene Wee > Hi, > > On Wed, Jan 11, 2012 at 10:27 AM, Yekui Wen wrote: > > can you guys tell me what is the Q method for ? > > Yes, though they are Q objects, not methods. Refer to: > >

/?next= not redirect user

2012-01-10 Thread Weldan
hi. can anyone show me how to do this . after successfully login user not redirected to request.path. thanks for advance -- 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

Re: what is django.db.models.Q for?

2012-01-10 Thread Eugene Wee
Hi, On Wed, Jan 11, 2012 at 10:27 AM, Yekui Wen wrote: > can you guys tell me what is the Q method for ? Yes, though they are Q objects, not methods. Refer to: https://docs.djangoproject.com/en/1.3/topics/db/queries/#complex-lookups-with-q-objects Regards, Eugene -- You

what is django.db.models.Q for?

2012-01-10 Thread Yekui Wen
hey guys, I need your help can you guys tell me what is the Q method for ? -- 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

Two Column Aggregate

2012-01-10 Thread Eugene Wee
Hi, I wrote some code to generate sales statistics. Unfortunately, for the part where I compute total costs of all goods, I currently have a loop which causes a query to be executed for each order item. This makes the statistics generation very slow. I have found that I can run a single query to

Re: Using DISTINCT on related model fields

2012-01-10 Thread John
I found a solution from the annotate docs: A.objects.values('b__name').distinct() tada! hope this helps someone else later :) On Jan 10, 3:43 pm, John wrote: > I'm trying to express this query using the Django ORM: > > SELECT DISTINCT test_b.name FROM test_a LEFT JOIN

Re: Need to examine and act on old vs. new at .save() time

2012-01-10 Thread Matt Schinckel
The way I generally do this type of thing is: https://gist.github.com/1591723 Lately, I've been using model validation: the clean() method instead of the save() method, but I can't remember if this is always called. https://docs.djangoproject.com/en/dev/ref/models/instances/#validating-objects

Re: Django orm and no primary key

2012-01-10 Thread Thorsten Sanders
Am 10.01.2012 20:46, schrieb Ian Clelland: This is possible -- there was some discussion on this list about it just a few days ago. If you tell Django that another field is the actual primary key, then it will not assume that there is an 'id' column (which is good, because otherwise it will

Re: A demo of django-inlinetrans and django-inplaceedit

2012-01-10 Thread rikuthero...@gmail.com
Hi, Thanks for publishing the project! It looks great :-) El 10 de enero de 2012 09:56, J. Pablo Martín Cobos escribió: > Hi, > > I hope that you like the demo: > > http://www.youtube.com/watch?v=_EjisXtMy_Y > > Set full sscreen mode to view it correctly > > Further

Re: how to only allow google apps auth from one domain

2012-01-10 Thread Tony Schmidt
Got it: Hacked the django-social-auth Google back-end to filter by domain. I'll see if the project wants to accept my changes as a setting. On Jan 9, 5:38 pm, Tony Schmidt wrote: > I tried django-social-authand googleappsauth but both allow me to > authenticate from

Re: How to mix in class based views from pluggable apps?

2012-01-10 Thread jrief
OK, now I got it. Coming from C++ I was stuck too much in static inheritance thinking. The diagram in http://fuhm.net/super-harmful/ helped me to understand this issue. Thank you very much for your help! -- You received this message because you are subscribed to the Google Groups "Django

Using DISTINCT on related model fields

2012-01-10 Thread John
I'm trying to express this query using the Django ORM: SELECT DISTINCT test_b.name FROM test_a LEFT JOIN test_b ON test_a.b_id = test_b.id using Django (with models 'A' and 'B') all I seem to be able to get is SELECT DISTINCT test_a.name, test_a.id FROM a INNER JOIN test_b ON test_a.b_id =

Re: Need to examine and act on old vs. new at .save() time

2012-01-10 Thread Jeff
Sigh. I hate Google Groups via web. Here is a readable version of the .save() method below. https://gist.github.com/1591028 On Jan 10, 3:15 pm, Jeff wrote: > For example, altering 'pana.our.org''s netgroups field, the following > save() method results in this debug line

Re: Directory layout for a large Django application (not project)

2012-01-10 Thread Cal Leeming [Simplicity Media Ltd]
That's a good point - although I can't think how to explain it in words.. Makes me wonder if I should do a blog post about this infact... *adds into todo list, amongst the other 9000 tasks he has* lol. On Tue, Jan 10, 2012 at 6:54 PM, Derek wrote: > Cal > > I agree that its

Re: Need to examine and act on old vs. new at .save() time

2012-01-10 Thread Jeff
For example, altering 'pana.our.org''s netgroups field, the following save() method results in this debug line which makes no sense to me: CHANGED: Device pana.our.org had old netgroups [{'name': u'testnetgroup', 'desc': u''}] and now has new netgroups [{'name': u'testnetgroup', 'desc': u''}]

Re: Django orm and no primary key

2012-01-10 Thread Ian Clelland
On Tue, Jan 10, 2012 at 9:04 AM, webonomic wrote: > The Django Book alludes to this, and maybe the comments there will > help you. > > Go to http://www.djangobook.com/en/1.0/chapter05/ > and search for this paragraph: > > "Finally, note we haven’t explicitly defined a

Re: Directory layout for a large Django application (not project)

2012-01-10 Thread Tom Evans
On Tue, Jan 10, 2012 at 6:13 PM, IgorS wrote: > First of all, thanks a lot to everyone who replied :-) > > Tom: > > As i mentioned, i am new to Django and could be missing big parts. > Please do not hate me too much for my naivete :-) Never apologise for trying to learn :)

Re: Directory layout for a large Django application (not project)

2012-01-10 Thread Donald Stufft
On Tuesday, January 10, 2012 at 1:13 PM, IgorS wrote: > First of all, thanks a lot to everyone who replied :-) > > Tom: > > As i mentioned, i am new to Django and could be missing big parts. > Please do not hate me too much for my naivete :-) > > The approach you suggested regarding the

Re: Directory layout for a large Django application (not project)

2012-01-10 Thread Derek
Cal I agree that its true that having more experience allows you to build better web apps and get smarter about how you do that. But I disagree that someone with that experience cannot share some or part of the "why and how" that is done. And I hope someone will be able to :) Derek On 10

Re: Directory layout for a large Django application (not project)

2012-01-10 Thread IgorS
First of all, thanks a lot to everyone who replied :-) Tom: As i mentioned, i am new to Django and could be missing big parts. Please do not hate me too much for my naivete :-) The approach you suggested regarding the static files seems to be reasonable. Especially considering that the static

Re: Django orm and no primary key

2012-01-10 Thread webonomic
The Django Book alludes to this, and maybe the comments there will help you. Go to http://www.djangobook.com/en/1.0/chapter05/ and search for this paragraph: "Finally, note we haven’t explicitly defined a primary key in any of these models. Unless you instruct it otherwise, Django automatically

Re: Need to examine and act on old vs. new at .save() time

2012-01-10 Thread Jeff
On Jan 10, 10:42 am, Kelly Nicholes wrote: > Isn't there a form.changed_data ? See 1st post below indicating we manipulate Django data from various Django codebases, not just a web form. > > I need to.. ... How > >

Re: Need to examine and act on old vs. new at .save() time

2012-01-10 Thread Jeff
On Jan 10, 10:09 am, Nahuel Defossé wrote: > I think you should see at the forms's cleaned_data attribute and > compare it against the model current state, before saving. As I indicated in the 1st post: > >> > I need to ...

Re: Directory layout for a large Django application (not project)

2012-01-10 Thread Brian Schott
Interesting! So, that means you can serve blog.example.com and shop.example.com from the same server? I haven't tried any of the multi-site support in django, so not sure how this compares. Makes my head hurt to think what this does to SSL. I've never been able to figure out SSL and

Re: Directory layout for a large Django application (not project)

2012-01-10 Thread Brian Schott
I see I broke off mid thought, my individual py files got small and I didn't have to do any of my own sub-file discovery logic to do something like "models/foo_models.py", "models/bar_models.py"... There is nothing preventing tight foreign-key relationships across apps. In reality, all of the

Re: Need to examine and act on old vs. new at .save() time

2012-01-10 Thread Kelly Nicholes
Isn't there a form.changed_data ? On Jan 9, 6:39 pm, Jeff wrote: > Hi all, > > I need to be able to determine, at .save() time (before I call the > parent class' .save()), if a certain field on my model object was > changed, and act on that via some custom code.  How can I do

Re: Need to examine and act on old vs. new at .save() time

2012-01-10 Thread Nahuel Defossé
Hi, I think you should see at the forms's cleaned_data attribute and compare it against the model current state, before saving. Regards Nahuel 2012/1/10 Jeff : > On Jan 10, 8:14 am, Andre Terra wrote: >> You can override the model's save method?[1][2] >

Re: Need to examine and act on old vs. new at .save() time

2012-01-10 Thread Jeff
On Jan 10, 8:14 am, Andre Terra wrote: > You can override the model's save method?[1][2] Hi Andre, Thanks for replying. Yes, I'm aware that I need to override .save(). See: > > I need to be able to determine, at .save() time (before I call the > > parent class' .save()),

Re: Dual license in a django world

2012-01-10 Thread Derek
I think you can already derive commercial apps if you so desire, without any license restrictions. See this post: http://jacobian.org/writing/paid-django-apps/ - a number of the comments point to existing commercial apps. On Jan 9, 8:46 pm, Thomas Weholt wrote: > It´s

Re: How to mix in class based views from pluggable apps?

2012-01-10 Thread Tom Evans
On Tue, Jan 10, 2012 at 2:05 PM, jrief wrote: > But the mixin plugins are not derived from django.views.generic.DetailView, > otherwise the main app's DetailView would obtain a diamond shaped > inheritance. Well, that is evident isn't it - they are mixins. If they were

Re: How to mix in class based views from pluggable apps?

2012-01-10 Thread Andre Terra
Python will use solve the diamond problem through MRO[1], so it all depends on the order you in which you mix your classes. class MyBaseView(BaseDetailView): def get_context_data(self, *args, **kwargs): context = super(MyBaseView, self).get_context_data(*args, **kwargs)

really good !!

2012-01-10 Thread Dana Woodman
really good !! i found a very good B2C place really a good place for us hope you can try too enjoy yourself here -- 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

Re: How to mix in class based views from pluggable apps?

2012-01-10 Thread jrief
Thank You, Roland, this was a good point to start with. I now found an elegant solution: I added a base DetailView class for this project: from django.views.generic import DetailView class PluggableDetailView(DetailView): def get_context_data(self, **kwargs): context =

Re: How to mix in class based views from pluggable apps?

2012-01-10 Thread jrief
But the mixin plugins are not derived from django.views.generic.DetailView, otherwise the main app's DetailView would obtain a diamond shaped inheritance. And django.views.generic.detail.BaseDetailView.get calls get_context_dataonly once, so I don't see how the plugins shall "deliver" their

Re: Highlighting Active Navigation Link - correct approach?

2012-01-10 Thread Matt Schinckel
I have a reusable application I use for generating site-wide menu items. It does this (as well as dynamically showing/hiding menu items based on if the logged in user can access the view). https://bitbucket.org/schinckel/django-menus Actually, I think that was the one I put on pypi today,

Re: How to mix in class based views from pluggable apps?

2012-01-10 Thread Andre Terra
Each plugin should call super() on their own definition of the get_context_data method -- which will return a dictionary --, then update and return a modified dictionary. There's no need to explicitly call each plugin by the name in subclasses. It works the other way around. Cheers, AT On Tue,

Re: Need to examine and act on old vs. new at .save() time

2012-01-10 Thread Andre Terra
You can override the model's save method?[1][2] Cheers, AT [1] https://docs.djangoproject.com/en/dev/ref/models/instances/#saving-objects [2] https://docs.djangoproject.com/en/dev/topics/db/models/#overriding-model-methods On Mon, Jan 9, 2012 at 11:39 PM, Jeff wrote: > Hi

A demo of django-inlinetrans and django-inplaceedit

2012-01-10 Thread J . Pablo Martín Cobos
Hi, I hope that you like the demo: http://www.youtube.com/watch?v=_EjisXtMy_Y Set full sscreen mode to view it correctly Further information: http://www.yaco.es/blog/en/contribuciones/2012/01/inline-editing-and-translating-in-django/ or Spanish version:

Need to examine and act on old vs. new at .save() time

2012-01-10 Thread Jeff
Hi all, I need to be able to determine, at .save() time (before I call the parent class' .save()), if a certain field on my model object was changed, and act on that via some custom code. How can I do this, bearing in mind that we call .save() from non-web code, etc? We use Django's ORM from

[Solved] collectstatic missing on Linux

2012-01-10 Thread Mike Dewhirst
Thanks guys - I found the problem. It required the following in manage.py ... import os, sys if __name__ == "__main__": SRC_ROOT = os.path.realpath(os.path.dirname(__file__)).replace('\\','/') PROJECT_ROOT = os.path.split(SRC_ROOT)[0].replace('\\','/')

Re: Directory layout for a large Django application (not project)

2012-01-10 Thread Cal Leeming [Simplicity Media Ltd]
I've hit this same problem myself many times. Ultimately there is never any one answer - you can split out functionality into individual modules, but there has to be a good use case for it, otherwise the overhead has a negative impact. You also have to take into consideration the re-usability of

Re: Highlighting Active Navigation Link - correct approach?

2012-01-10 Thread Ivo Brodien
Hi, strange that nobody answered yet since I guess that almost everybody encountered the same question already. I personally did it via a custom template tag which puts out active if the current URL matches the URL pattern for a view. Cheers Ivo On Jan 9, 2012, at 7:27 , Victor Hooi wrote: