Re: how to query max count

2014-10-15 Thread dk
looks like it works like this the_max = Choice.objects.filter(date=date) print max(the_max) On Monday, October 13, 2014 6:14:28 PM UTC-5, dk wrote: > I need to learn how to use aggregation in django, I was thinking on > filter by date, > and then loop the query and make a dictionary with

Re: Porting to Django Linux with SQL Server Backend

2014-10-15 Thread Kelvin Wong
I have a working system running Django 1.6/Python 2.7 on RHEL 7 connecting to MSSQL2012 SP 2 on Win Server. On the Linux box we are installing this with Pip requirements: git+https://code.google.com/p/pyodbc@3.0.7#egg=pyodbc django-pyodbc-azure==1.1.5 The local_settings.py contains:

Re: Run some code after Model Save completes (and after database is updated)

2014-10-15 Thread Jani Tiainen
On Tue, 14 Oct 2014 10:00:17 -0700 (PDT) Spiros Mouzakitis wrote: > Hi, > > -I am looking for an elegant, and universal way to add some code AFTER the > saving of a model and after of course the database is updated with changes. > -I have tried post_save signals, but

Re: How do I create a simple user view web page to create/add mysql db entries?

2014-10-15 Thread Bovine Devine
On Tuesday, October 7, 2014 6:42:39 PM UTC-7, Collin Anderson wrote: > > My bad. Put your add_view in views.py (cause it's a view :) > > Then, you'll need to import your form into your view: > from oneidentry.forms import HardwareidForm > > Thanks Collin I made the switch but now cannot access

Re: Django hosting

2014-10-15 Thread Mark Phillips
Sabine, Hit send before I was done please see below On Wed, Oct 15, 2014 at 5:21 PM, Mark Phillips wrote: > Sabine, > > Another free hosting option - Ohava.com. 512 MB RAM, 1 VCPU, 20 GB storage > for free. You also get ssh and root access. It won't last forever

Re: Django hosting

2014-10-15 Thread Mark Phillips
Sabine, Another free hosting option - Ohava.com. 512 MB RAM, 1 VCPU, 20 GB storage for free. You also get ssh and root access. It won't last forever, but is free. It comes with Ubuntu 14.04 as the host system. The "apps" they offer I signed up for one to test, and it took a few weeks for them to

Re: Upgrading Django (to 1.7)

2014-10-15 Thread Andrew Pinkham
Hi, Thanks to feedback from Fred and a few others, I've started editing Part III to make it more accessible. Part IV was originally set to be published today. Unfortunately, it is not ready to be published. As soon as the new Part III and Part IV are available, I will let you know. Thanks,

Re: How to "automatically " populate "last_updated_by" DB columns with the current user's id

2014-10-15 Thread Ken Winter
Thanks, Collin, Carl, & Tom ~ Is this a reasonable summary of what you have said so far?: 1. You've suggested two solutions, which I'll call "middleware" (from Collin) and "save() argument" (from Carl and Tom). 2. A limitation of both is that they aren't what I'll call "universal".

Re: Incremental inspectdb, anyone?

2014-10-15 Thread Mike Dewhirst
On 16/10/2014 7:11 AM, Ken Winter wrote: 4. Inspect a DB schema and modify the Django model set so that they match completely. Much harder, because it involves (a) comparing every detail of each existing model with the DB schema, (b) altering and deleting models as well as just creating them,

Incremental inspectdb, anyone?

2014-10-15 Thread Ken Winter
Is there a Django utility or add-on that can read database schemas and turn them into Django data models *incrementally*? By "incrementally", I mean that the utility would be able to update a set of already existing Django models so they match the current DB schema. In other words, the

Re: Problem with a token in my custom template tag

2014-10-15 Thread Daniel Grace
I got it working thanks. My template tag file is as follows: from django import template from django.utils import timezone register = template.Library() @register.simple_tag def rowcolour(dt): diff = timezone.now() - dt if diff.days > 14: return "pinkrow" else: return "greyrow" -- You

Re: Problem with a token in my custom template tag

2014-10-15 Thread Daniel Roseman
On Wednesday, 15 October 2014 19:30:01 UTC+1, Daniel Grace wrote: > > Hi, > I'm encountering the following problem with a token in my custom template > tag: > Request Method: GET > Request URL: http://127.0.0.1:8000/flows/ > Django Version: 1.7 > Exception Type: ValueError > Exception Value: >

Django sqlaclhemy and Sabridge Module

2014-10-15 Thread robert brook
Has anyone had any experience using the the sabridge module to connect to a production database in general and specifically to sql server (version 2014 with python 3.3 and django 1.7)? I would like to be able to integrate sqlalchemy into my production environment. Any other suggestions that

Problem with a token in my custom template tag

2014-10-15 Thread Daniel Grace
Hi, I'm encountering the following problem with a token in my custom template tag: Request Method: GET Request URL: http://127.0.0.1:8000/flows/ Django Version: 1.7 Exception Type: ValueError Exception Value: need more than 2 values to unpack Exception Location:

Re: 'HttpResponse' object has no attribute 'url' when using Client() for tests

2014-10-15 Thread Tom Evans
On Wed, Oct 15, 2014 at 2:20 PM, Marcus wrote: > Hi, > > I just updated Django from an older version to 1.6.7 and some of my tests > are now failing while trying to follow redirects. > > In [1]: from django.test import Client > > In [2]: import django > > In [3]: django.VERSION

'HttpResponse' object has no attribute 'url' when using Client() for tests

2014-10-15 Thread Marcus
Hi, I just updated Django from an older version to 1.6.7 and some of my tests are now failing while trying to follow redirects. In [1]: from django.test import Client In [2]: import django In [3]: django.VERSION Out[3]: (1, 6, 7, 'final', 0) In [4]: c = Client() In [5]: r =

Re: Porting to Django Linux with SQL Server Backend

2014-10-15 Thread robert brook
Sorry I guess I should have focused the question better. I have a working connector on my windows machine using django-pyodbc-azure I can and will use this connector on the new Linux installation. Since I have never tested this on a Linux machine yet, I wanted to see if anyone had any

Re: Upload file IN DJANGO

2014-10-15 Thread Vignesh Sunder
I recently implemented this using a third party library which in turn proved to be more beneficial than expected, and made things very flexible & effortless. The implementation did not take more than 2 hours (installation + integration into project + interaction with my existing model-structure).

Re: Porting to Django Linux with SQL Server Backend

2014-10-15 Thread Michael Manfre
It's hard to give constructive feedback without knowing any of the specific errors you encountered, but django-mssql only works on Windows. Depending on the error you encountered with pymssql, you could try django-pymssql (https://github.com/aaugustin/django-pymssql). Regards, Michael Manfre

Porting to Django Linux with SQL Server Backend

2014-10-15 Thread robert brook
The group has been developing locally with sqllite on Windows. We are porting the installation to a Linux environment /windows sql server. Looking for suggestions for database connectors from Linux to sql server 2014 using: python3.3 django 1.7 I have installed a local copy of sql server to

Re: Upload file IN DJANGO

2014-10-15 Thread Collin Anderson
Hi Devin, It's usually recommended to save the file on the filesystem, but reference it using the database using models.FileField(). https://docs.djangoproject.com/en/dev/ref/models/fields/#filefield You'll need to set MEDIA_ROOT and MEDIA_URL. Collin -- You received this message because

Re: Upload file IN DJANGO

2014-10-15 Thread Mario Gudelj
https://docs.djangoproject.com/en/dev/topics/http/file-uploads/#handling-uploaded-files-with-a-model cheers! On 15/10/2014 9:38 pm, "Devin Cky" wrote: > > please help me i want to upload a file in my django application > > how to save in a database(postgresql) an upload file

Re: How to "automatically " populate "last_updated_by" DB columns with the current user's id

2014-10-15 Thread Tom Evans
On Tue, Oct 14, 2014 at 4:46 PM, Collin Anderson wrote: > Hi Ken, > > If you _really_ want it to be automatic, I think your best bet is to use a > middleware to store the user or request object in a "thread local" variable, > and then have a pre_save signal set the

Re: An elegant and simple way to fire a signal after a Save is complete (completely complete :) )

2014-10-15 Thread Spiros Mouzakitis
Thanks for the suggestion, i will also try django-transaction-hooks. On Tuesday, October 14, 2014 11:40:21 PM UTC+3, Carl Meyer wrote: > > On 10/14/2014 01:58 PM, Spiros Mouzakitis wrote: > > What i finally did was to create a post_save signal as usual, and then > > in my receiver function i

Upload file IN DJANGO

2014-10-15 Thread Devin Cky
please help me i want to upload a file in my django application how to save in a database(postgresql) an upload file in django ... thank for your answers . -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and

Re: Django 1.7 User login via Email or Username

2014-10-15 Thread monoBOT
You can implement an alternative authentication backend like so: *on your settings:* AUTHENTICATION_BACKENDS = ( 'your_app.backend.EmailBackend', 'django.contrib.auth.backends.ModelBackend' ) *and on "your_app.backends":* #!/usr/bin/env python # -*- coding: utf-8 -*- from

Django 1.7 User login via Email or Username

2014-10-15 Thread Frankline
Hi all, Just started looking at Django 1.7. I've followed the tutorials on https://docs.djangoproject.com/en/1.7/. However, I find myself in a position where I need to login users based on either email or username, AND NOT just the username. I want my users to register using email addresses.