DateTimeField always returns None

2014-07-04 Thread William Granli
I am trying to create a queryset for getting the values of a DateTimeField which is DATETIME in the DB. The class in models.py: class ChangeMetrics(models.Model): id = models.IntegerField(primary_key=True) file_id = models.ForeignKey(File, db_column = 'file_id') version_id = models

How to create a custom admin panel for many models

2014-07-04 Thread 9devmail
I want to create a custom ModelAdmin, but for a mix of models, not just one. I have two example models: class Article(models.Model): author = models.GenericIPAddressField() # ... class Comment(models.Model): author = models.GenericIPAddressField() # ... Now I want to be able t

NoReverseMatch error: Reverse for 'lebay_view_user_profile' with arguments '('',)' and keyword arguments '{}' not found.

2014-07-04 Thread Niccolò Lancellotti
Hi guys, i'm new in this group. I'm trying to upgrade a django project i found on internet, called 'little ebay', from django 1.2 to 1.5. It is a very simple project, there are only few files. i'm going to append them... please help me, i'm going ma with that. i'm appending only two of the vario

Re: DateTimeField always returns None

2014-07-04 Thread trustedbox
Are you sure you're using the same DB ? Test it by adding new record and instantly retrieve it. пятница, 4 июля 2014 г., 12:01:15 UTC+3 пользователь William Granli написал: > > I am trying to create a queryset for getting the values of a DateTimeField > which is DATETIME in the DB. > > The class

Re: DateTimeField always returns None

2014-07-04 Thread Tom Evans
On Fri, Jul 4, 2014 at 10:01 AM, William Granli wrote: > I am trying to create a queryset for getting the values of a DateTimeField > which is DATETIME in the DB. > > The class in models.py: > > class ChangeMetrics(models.Model): > id = models.IntegerField(primary_key=True) > file_id = mod

Re: "ResourceWarning: unclosed" error using mysql-connector-python

2014-07-04 Thread Zemian Deng
No problem. Thanks for the reply. On Fri, Jul 4, 2014 at 12:51 AM, cercatrova2 wrote: > On 04/07/14 05:09, Zemian Deng wrote: > > Hum... I am surprised that no one has experienced this warning msg yet, or > maybe I can't catch anyone to reply. > > For those are curious, I do now see mysql-con

Re: Mysql connections after started django app

2014-07-04 Thread Zemian Deng
@cercatrova2, Yes, my original problem also was (and still is) with "MySQL Connection not available" after the 8 hours timeout inactivity on webfaction hosting. I have to restart it whenever this happens and then problem will go away. My current workaround is to schedule a dummy crontab to hit my

Re: Mysql connections after started django app

2014-07-04 Thread cercatrova2
On 04/07/14 16:11, Zemian Deng wrote: @cercatrova2, Yes, my original problem also was (and still is) with "MySQL Connection not available" after the 8 hours timeout inactivity on webfaction hostin

Simple History - Field Change

2014-07-04 Thread Aaron Reabow
Hi all, I am getting this error on a modelform smallint out of range But the form is actually submitting just fine and being stored in the DB. I used to have a positive small int, but have changed it (dropped the offending table, resync'ed, restarted the server...) I have history = Histor

Re: Mysql connections after started django app

2014-07-04 Thread François Schiettecatte
Hi I have a little experience with this, and I have posted about this here before. The "MySQL Connection not available" message will occur when MySQL is dropping the connection before Django is done with it, ie Django is trying to send something down a dead connection. I would look at CONN_MAX

Re: Simple History - Field Change

2014-07-04 Thread Cal Leeming [Simplicity Media Ltd]
Can you please paste the full clear text stacktrace? Cal On Fri, Jul 4, 2014 at 3:49 PM, Aaron Reabow wrote: > Hi all, > > I am getting this error on a modelform > > smallint out of range > > > > But the form is actually submitting just fine and being stored in the DB. I > used to have a pos

Re: Simple History - Field Change

2014-07-04 Thread Aaron Reabow
Environment: Request Method: POST Request URL: upon request :) Django Version: 1.6.2 Python Version: 2.7.5 Installed Applications: ('django.contrib.admin', 'django.contrib.admindocs', 'django.contrib.auth', 'django.contrib.sites', 'django.contrib.contenttypes', 'django.contrib.sessions', '

Unit testing - return HttpResponseRedirect('/accounts/loggedin')

2014-07-04 Thread Pepsodent Cola
Hi coverage has highlighted that I have no unit test for the line, regarding *HttpResponseRedirect('/accounts/loggedin')*. How can I write a test that makes Coverage happy regarding this? views.py def auth_view(request): username = request.POST.get('username', '') password = request.P

Re: Simple History - Field Change

2014-07-04 Thread Cal Leeming [Simplicity Media Ltd]
It sounds like you haven't applied the table changes to the cloned table which it creates to track changes. I'd advice using something like South to manage your schema changes, and this should work out of the box with django-simple-history. For now, you can delete the cloned table and re-sync, yo

Re: Mysql connections after started django app

2014-07-04 Thread Zemian Deng
@cercatrova2, yes, these problems are coming using python3 and the mysql-connector-python and I am using their "mysql.connector.django". Currenly I have briefly experimented the default django.db.backends.mysql with Python3 driver https://github.com/clelland/MySQL-for-Python-3, but I still see the

Re: Mysql connections after started django app

2014-07-04 Thread Zemian Deng
Thanks for the tips @Francois! Yeah, I already have this CONN_MAX_AGE set to 0. I even try some positive number, but there is still Sleep connections remain after the app is started and running without any traffic. Which is not what I expect when set to 0 value. I don't even have fancy background

Re: Mysql connections after started django app

2014-07-04 Thread François Schiettecatte
Hi Again I think there is a bug somewhere in how django handles CONN_MAX_AGE when it is not set or set to 0, you should not be seeing those sleeping connections. It is perfectly fine to set CONN_MAX_AGE to some number, though keep it to less than the wait_timeout in my.cnf. You will still see

settings.configure() does not allow me to access custom variables in settings.py

2014-07-04 Thread Chen Xu
Hi Everyone, I want to access some variables in my settings.py without starting my server, I know I will have to run settings.configure(); however, running settings.configure() does not allow me to access my custom variables. What should I do with that. Thanks -- ⚡ Chen Xu ⚡ -- You received

Django Cursor.Execute Issue with Postgresql

2014-07-04 Thread Jason Hawkins
I ran into a problem with cursor.execute, moved onto a completely separate part of my program, and ran into the same issue. I get that the value of a cursor return is: "django.db.backends.util.CursorDebugWrapper object". My code in my view is: model_id.execute("SELECT id FROM \"{0}\".\"{1}\"

Re: settings.configure() does not allow me to access custom variables in settings.py

2014-07-04 Thread Mike Dewhirst
On 5/07/2014 7:12 AM, Chen Xu wrote: Hi Everyone, I want to access some variables in my settings.py without starting my server, I know I will have to run settings.configure(); however, running settings.configure() does not allow me to access my custom variables. What should I do with that. Per

Journalists in the Django community, journalism advice

2014-07-04 Thread Elena Williams
Hey everybody, &tldr; Looking for Journalists/former-Journalists/Journalism grads in the community for any advice they might have. I'm giving a talk at DjangoConAU more-or-less about communicating news in community. Django has a proud journalistic tradition and as such it seems remiss to *not* a

Re: Journalists in the Django community, journalism advice

2014-07-04 Thread Cesar Mojarro
https://pypi.python.org/pypi/django-news On Fri, Jul 4, 2014 at 9:43 PM, Elena Williams wrote: > Hey everybody, > > &tldr; Looking for Journalists/former-Journalists/Journalism grads in the > community for any advice they might have. > > I'm giving a talk at DjangoConAU more-or-less about commu

Re: Journalists in the Django community, journalism advice

2014-07-04 Thread Cesar Mojarro
https://github.com/Fantomas42/django-blog-zinnia On Fri, Jul 4, 2014 at 10:11 PM, Cesar Mojarro wrote: > https://pypi.python.org/pypi/django-news > > > On Fri, Jul 4, 2014 at 9:43 PM, Elena Williams wrote: > >> Hey everybody, >> >> &tldr; Looking for Journalists/former-Journalists/Journalism g

Re: Journalists in the Django community, journalism advice

2014-07-04 Thread Cesar Mojarro
http://devwiki.beloblotskiy.com/index.php5/Django_news_application_(avbnews)_-_part_1 On Fri, Jul 4, 2014 at 10:12 PM, Cesar Mojarro wrote: > https://github.com/Fantomas42/django-blog-zinnia > > > On Fri, Jul 4, 2014 at 10:11 PM, Cesar Mojarro wrote: > >> https://pypi.python.org/pypi/django-ne

Re: Simple History - Field Change

2014-07-04 Thread Aaron Reabow
You are totally right. There is a historical table that required deletion. This is why you shouldn't debug late on friday afternoon. I had actually looked for that table but somehow missed it. I will pick up the broader problems with simple history separately. thanks for taking the time to lo

Re: Unicode Str error [Beginner question]

2014-07-04 Thread Tom Evans
On Thu, Jul 3, 2014 at 8:08 PM, Lian Tombing wrote: > When I tried to implement the example, > > class Poll(models.Model): > # ... > def __unicode__(self): # Python 3: def __str__(self): > return self.question > > I get the error, > > Tab error: inconsistent use of tabs and spaces

Adding custom button to each field od ModelAdmib using Grappelli

2014-07-04 Thread Filip Bajaník
I use Grappelli as a custom admin sites plugin... I use hard-coded button in list_display in the each field which looks like this def approve_button(self): return u"" % (_("Approve"), _("Are you sure you want to approve this request?"), self.id, self.license_ticket.id) approve_button.allo