Re: Admin for proxy model for custom User

2013-05-28 Thread Tomas Neme
Silly, but aren't you missing class Patient() save(self): self.kind = 'p' super(Patient, self).save() or some such thing and something similar for Doctor? I guess it might be in the forms, but since it's nowhere in the code you showed... -- You received this message beca

Admin for proxy model for custom User

2013-05-28 Thread Andres Osinski
Hi everyone, I've created a custom User model and reated a proxy for it, like this: class User(AbstractUser): USER_KINDS = ( ('d', 'doctor'), ('p', 'patient') ) kind = models.CharField(max_length=2, choices=USER_KINDS) class DoctorManager(BaseUserManager): def get

Re: Object Lookup after Save

2013-05-28 Thread Chris Conover
Interesting. Thanks for the rundown. Looking forward to 1.6. On Tuesday, May 28, 2013 6:40:28 PM UTC-4, akaariai wrote: > > On 29 touko, 01:07, Chris Conover wrote: > > Adding commit_unless_managed() before the get() seems to fix the > problem. > > Looking at it locally, the Gearman worker sta

django database cache for longtime?

2013-05-28 Thread kase
i need cache a page where i'm process a lot information and i dont wish process again and i dont wish keep in memory RAM, (maybe nobody ever review) so i wish put this page in a database cache but what can i do for never expire? -- You received this message because you are subscribed to the

Re: Object Lookup after Save

2013-05-28 Thread akaariai
On 29 touko, 01:07, Chris Conover wrote: > Adding commit_unless_managed() before the get() seems to fix the problem. > Looking at it locally, the Gearman worker starts a transactions and just > calls commit when the processing is done, over and over, never starting a > new transaction. That combin

django 1.5 robots.txt

2013-05-28 Thread Wade Williams
http://stackoverflow.com/questions/16802176/django-1-5-robots-txt -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To p

Re: Object Lookup after Save

2013-05-28 Thread Chris Conover
Also, thank you Tom, Christian, Christophe, and Anssi for helping me track down this problem. Users are now receiving notifications in a timely manner because of you. On Tuesday, May 28, 2013 6:07:22 PM UTC-4, Chris Conover wrote: > > Adding commit_unless_managed() before the get() seems to fix

Re: Object Lookup after Save

2013-05-28 Thread Chris Conover
Adding commit_unless_managed() before the get() seems to fix the problem. Looking at it locally, the Gearman worker starts a transactions and just calls commit when the processing is done, over and over, never starting a new transaction. That combined with REPEATABLE-READ seems to be the culprit

Re: Creating a "Django Course" and would like some feedback

2013-05-28 Thread Kevin
Hello Nik, Yes, I can definitely understand the frustrations a PHP developer may have when moving away from it. PHP is very unique in that's it's one of the rare web technologies which has a deployment like it does. The original Active Server Pages and CGI also share the same deployment sc

Bootstrap and Django together at last!

2013-05-28 Thread Kevin
Hello everyone! I thought I'd provide a recently released Django app I built. I have listed it on several Django communities including my blog, but I feel it would also be great to everyone if I also provide a link here as well. https://bitbucket.org/kveroneau/django-bootstrap-theme Now y

Re: Object Lookup after Save

2013-05-28 Thread Chris Conover
I bribed the DBA to turn on the general query log briefly (which generated 327k logs in 2 minutes and 2 seconds). Looking at the logs, I see the transaction block for the INSERT. The SELECT is definitely coming after the COMMIT in a different thread. I'll try the commit_unless_managed fix quick

Re: Creating a "Django Course" and would like some feedback

2013-05-28 Thread Nikolas Stevenson-Molnar
Deployment in general is something you should be sure to cover. Especially when people are coming from the PHP world, deployment is quite different. It seems like there are often questions on this list around deployment problems, and they are often fairly trivial issues. _Nik On 5/28/2013 2:01 PM

Re: Creating a "Django Course" and would like some feedback

2013-05-28 Thread Kevin
Hello Subodh, Thank you for your input. I actually have a large amount of knowledge in caching with Django, and all my Django powered sites using caching in some form or another. There is an entire section devoted to caching, and if any indicator on how long I made Chapter 1 and how long Ch

Re: Object Lookup after Save

2013-05-28 Thread akaariai
On 28 touko, 22:20, Chris Conover wrote: > Well, you can inspect the object and see it's primary key. Surely that > means the INSERT is completed? So the workflow goes like this: > > foo = Foo() > foo.save() > foo.pk # new primary key is available > submit_gearman_task(foo.pk) > > Then in the Gear

Re: Creating a "Django Course" and would like some feedback

2013-05-28 Thread Subodh Nijsure
This is all IMHO. One of the thing that has been missing from many django books: How do you "marry" the current best practices for --deploying-- large scale web applications when using django. What are the best practices for enabling, monitoring caching? Implementing search using haystack or som

Re: need immediate help setting up Apache

2013-05-28 Thread Rafael E. Ferrero
Ok, Tell me if works... of course are a better way to do this... something like that work to me. www.fsorgosuardi.com.ar its an example of that 2013/5/28 John Fabiani > Thanks I'll try it. > Johnf > > On 05/28/2013 08:21 AM, Rafael E. Ferrero wrote: > > and here is an example of a django.wsgi

Re: Object Lookup after Save

2013-05-28 Thread Christophe Pettus
Well, Django works. :) I'd strongly suggest examining the data at the database layer to see if you are getting the interaction with the database you expect; you might try bringing it up in a test environment and see if you can reproduce it there. On May 28, 2013, at 1:45 PM, Chris Conover wrot

Re: Creating a "Django Course" and would like some feedback

2013-05-28 Thread Brian Williams
Kevin, Sounds like a great idea. Wish you the best of luck. I would be willing to give you a hand if you want the perspective of a complete novice. I am just learning Django and am not far beyond the docs tutorial. Brian -- You received this message because you are subscribed to the Google

Re: Object Lookup after Save

2013-05-28 Thread Chris Conover
No, we are not using the TransactionMiddleware. We are using the following Django middlewares: CommonMiddleware, SessionMiddleware, MessageMiddleware, and XFrameOptionsMiddleware. We have a few custom middlewares which handle stuff for the edge caching. Nothing that produces any writes to MySQL.

Re: Object Lookup after Save

2013-05-28 Thread Christophe Pettus
On May 28, 2013, at 1:26 PM, Chris Conover wrote: > # no middleware that does any writes Are you using the Transaction Middleware? -- -- Christophe Pettus x...@thebuild.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe fr

Re: steps to connect as client to a tcp/ip server

2013-05-28 Thread andrea mucci
Hi Chiara The best solution is make two different projects one is your socket server and the other is the Django project. is not a good idea connect with socket directly to Django, this will be cause some large delays and in case of connection fails? what is the timeout of the socket connection?

Re: Object Lookup after Save

2013-05-28 Thread Chris Conover
I will enable to general query log tonight once the load tapers off and see what's happening. I must say that the opacity of this transaction stuff is pretty frustrating. I don't understand how there can be an enclosing transaction for such a simple view. The view is pretty much: # no middlewar

Re: Selecting site in admin

2013-05-28 Thread Mário Neto
Do you can this in your template 2013/5/28 Victor > As a newbye I'm happily using admin. > > Now I would like to select what a user can see in the admin main page > according to its username just as a (non-working) example I would like to > follow this idea > > in admin.py > > if request.user==

Re: Object Lookup after Save

2013-05-28 Thread Christophe Pettus
On May 28, 2013, at 12:20 PM, Chris Conover wrote: > Well, you can inspect the object and see it's primary key. Surely that means > the INSERT is completed? That shows the INSERT is completed, but it doesn't show that any enclosing transaction has committed; that's what the database logs will

Selecting site in admin

2013-05-28 Thread Victor
As a newbye I'm happily using admin. Now I would like to select what a user can see in the admin main page according to its username just as a (non-working) example I would like to follow this idea in admin.py if request.user=='victor': admin.site.register(Categorie) admin.site.register(Cod

Re: Object Lookup after Save

2013-05-28 Thread Chris Conover
Well, you can inspect the object and see it's primary key. Surely that means the INSERT is completed? So the workflow goes like this: foo = Foo() foo.save() foo.pk # new primary key is available submit_gearman_task(foo.pk) Then in the Gearman worker: foo = Foo.objects.get(pk=foo_pk) # this caus

Re: need immediate help setting up Apache

2013-05-28 Thread John Fabiani
Thanks I'll try it. Johnf On 05/28/2013 08:21 AM, Rafael E. Ferrero wrote: and here is an example of a django.wsgi file import os import sys path = '/path/to/your/project/' if path not in sys.path: sys.path.append(path) os.environ['DJANGO_SETTINGS_MODULE'] = 'yourproject.settings' import

Re: Creating a "Django Course" and would like some feedback

2013-05-28 Thread Kevin
Sean, Thank you for your input. Having those types of examples would actually be a great idea for the course, as these are some of the most popular website being developed in our social web 2.0 these days. As for your thought on inputting financial data, I actually built a personal financ

Re: Creating a "Django Course" and would like some feedback

2013-05-28 Thread SeanJ
Kevin, Looking forward to what you come up with. I'd be willing to be a guinea pig for the course. First, I am a hobbyist developer (Java, Groovy/Grails, JS/Jquery/HTML5, PL/SQL, Python/Django), not a pro, and relatively new at it. My day job is a Software QA Manager for 40,000+ employee E

Re: need immediate help setting up Apache

2013-05-28 Thread Rafael E. Ferrero
and here is an example of a django.wsgi file import os import sys path = '/path/to/your/project/' if path not in sys.path: sys.path.append(path) os.environ['DJANGO_SETTINGS_MODULE'] = 'yourproject.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler

Re: Object Lookup after Save

2013-05-28 Thread Christophe Pettus
I'll admit my MySQL skills are a bit rusty, but can you examine the database logs to confirm that the session is in fact doing the INSERT and a commit before the SELECT? On May 28, 2013, at 10:52, Chris Conover wrote: > It's not really feasible to move this project to PostgreSQL. > > I honest

Re: Object Lookup after Save

2013-05-28 Thread Chris Conover
It's not really feasible to move this project to PostgreSQL. I honestly just don't understand the problem. According to the Django documentation, the ORM functions in autocommit mode by default. In other words, the changes should be committed as soon as the query is complete, right? So after an

Re: Object Lookup after Save

2013-05-28 Thread Christophe Pettus
In the meantime, you can use this: https://github.com/Xof/xact On May 28, 2013, at 10:29, Chris Conover wrote: > That seems to only be available in the dev version of Django (now 1.6 alpha). > > On Wednesday, May 22, 2013 4:43:29 AM UTC-4, Christian Schmitt wrote: >> >> if you want transa

Re: Object Lookup after Save

2013-05-28 Thread Chris Conover
That seems to only be available in the dev version of Django (now 1.6 alpha). On Wednesday, May 22, 2013 4:43:29 AM UTC-4, Christian Schmitt wrote: > > if you want transactions you need to do : > > with transaction.atomic(): > > > like described here: > https://docs.djangoproject.com/en/dev/topi

is there way to have multiple forms per step in django form wizard ?

2013-05-28 Thread Vishwajeet
I have this situation where I want to have multiple formsets and a normal form at single step in formwizard, I spent sometime time searching for the same but could not find any info. Can someone suggest some workaround or solution to the problem ? -- You received this message because you are su

Re: .annotate() in limit_choices_to?

2013-05-28 Thread galgal
I wrote some code, but it returns doubled entries if there's no annotate: price_variants = models.ManyToManyField( ProductPriceVariant, verbose_name=_(u'price variants'), limit_choices_to=Q(translation__language__iexact=get_language()[:2]) & Q( translation__product__

Re: Creating a "Django Course" and would like some feedback

2013-05-28 Thread Sergiy Khohlov
Big job is started ! Big congrat from me ! Many thanks, Serge +380 636150445 skype: skhohlov On Tue, May 28, 2013 at 9:17 AM, Kevin wrote: > A small update, I just completed the first chapter and laid out the rest > of the chapters which will be made available. You can view the current

.annotate() in limit_choices_to?

2013-05-28 Thread galgal
Is it possible to put, somehow, *.annotate()* method into M2M * limit_choices_to*? I need to limit my choices to that query: * cls.objects.annotate(subproducts_num=models.Count('subproducts')).filter(subproducts_num__gt=0) * Any ideas? -- You received this message because you are subscribed to

Re: need immediate help setting up Apache

2013-05-28 Thread Rafael E. Ferrero
First... configure Bind2 (or your DNS to support your domain) Second configure a Virtual Host for your domain (supoust that you use wsgi) Here is an example: DocumentRoot /var/www/yourdomain.com ServerName yourdomain.com.ar ServerAlias www.yourdomain.com. ServerAdmin youru...@yourdomain.com Erro

Re: need immediate help setting up Apache

2013-05-28 Thread John Fabiani
Yes I have complete control. But I don't know how to set it up. Johnf On 05/28/2013 07:39 AM, Rafael E. Ferrero wrote: you have access to config files of apache ?? like site-available/yoursite.com to set your virtuals hosts ?? 2013/5/28 John Fabiani

Re: need immediate help setting up Apache

2013-05-28 Thread Rafael E. Ferrero
you have access to config files of apache ?? like site-available/ yoursite.com to set your virtuals hosts ?? 2013/5/28 John Fabiani > Hi Folks, > I need immediate help setting up Apache on an openSUSE 12.3. I'm willing > to pay a little for the help. > Currently I have my scripts working using

Test limit_choices_to

2013-05-28 Thread galgal
Is there any way to test if my *limit_choices_to* argument is working as I expect? How can I test that in unit test? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email

need immediate help setting up Apache

2013-05-28 Thread John Fabiani
Hi Folks, I need immediate help setting up Apache on an openSUSE 12.3. I'm willing to pay a little for the help. Currently I have my scripts working using manage.py runserver. But I don't understand what I need to do with Apache. I have to get website up today. I will also have to setup the

Re: listing objects in a html file

2013-05-28 Thread Drew Ferguson
Hi I do not think you can include python in django templates so the various uses of "unusedpremises" are ignored You can generate a list of unused premises for the view by over-riding the get_context_data method, perhaps something like this ### view.py class PremisesListView() class = Pre

listing objects in a html file

2013-05-28 Thread tony gair
This file is used to print out the name of the premises with an update link , however I wanted to add a list of premises with the in_use flag set to false. Can anyone tell me what I am doing wrong? {% extends "base.html" %} {% block content %} Premises {% unusedpremises = [] %} {% for prem

example on django mptt

2013-05-28 Thread Randa Hisham
-- Randa Hesham Software Developer Twitter:@ro0oraa FaceBook:Randa Hisham ٍ -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Re: Django - Tastypie filtering by related field

2013-05-28 Thread Hélio Miranda
Yes, using the django tastypie and making the filter -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this g

Re: Django - Tastypie filtering by related field

2013-05-28 Thread Tom Evans
On Tue, May 28, 2013 at 10:38 AM, Hélio Miranda wrote: > I have in my application, players and clubs and want to know how many > players belong to a club, and I'm doing the following filter, but it returns > empty []. > What am I doing wrong? > > class PlayerResource(resources.MongoEngineResource)

Django - Tastypie filtering by related field

2013-05-28 Thread Hélio Miranda
I have in my application, players and clubs and want to know how many players belong to a club, and I'm doing the following filter, but it returns empty []. What am I doing wrong? *class PlayerResource(resources.MongoEngineResource):* ** *PlayerClub = fields.ReferencedListField(of='Rela

Re: Problem counting names by letter

2013-05-28 Thread Tom Evans
On Fri, May 24, 2013 at 9:40 PM, Brian Millham wrote: > With this simple database table: > > class Artist(models.Model): > id = models.IntegerField(primary_key=True) > name = models.CharField(max_length=255L, blank=True) > prefix = models.CharField(max_length=32L, blank=True) > cla

Re: Django with Moodle

2013-05-28 Thread Derek
Sourabh Not sure if this is your first time on the list... if it is, please take some time to read: https://code.djangoproject.com/wiki/UsingTheMailingList Under "don'ts" you will find: *Don't be vague e.g. "please help build a website". No one has time to write a vague answer. * If you have