Re: upload zip or rar files

2015-10-01 Thread James Schneider
> FYI,
> it works if the zip or the rar files were generated in windows,
>
> not if they come from Linux =(...
>
>

Do you mean that the client is running Windows and can't see zip files that
were generated on a Linux machine, or that the client is Linux and you
can't see files generated by that client? The latter is more likely, file
extensions are almost useless in Linux. Haven't toyed with this, but I
could see a Linux client having issues filtering by a file 'type' since
that would require reading at least a small portion of each file to
determine whether or not or is a zip file.

Do the files you are looking for have the .zip extension? I highly doubt
the browser is able to distinguish between files based on where they were
generated without some sort of custom plugin magic (since it shouldn't
matter).

>
>
> On Tuesday, September 29, 2015 at 1:41:27 PM UTC-5, dk wrote:
>>
>> I set up a form to upload files,  and every thing works fine,   the only
problem is when I am in the webpage and I click the button to choose the
file I want to upload doesn't show or zips, or rars.  I try playing with
the input tag accept, from all the type of zips,  to leave it open to
upload what ever file.
>>

Is this a standard HTML input file field? I would recommend removing the
accept parameter to see if that clears it up. What values are you providing
to accept?

Can you see the files if you tell the file chooser window to show all files?

>> I try it in Firefox, chrome and IE,   I am missing something?
>

There must be something in your HTML code that is triggering this behavior.

Do you have any JS that might be interfering?

-James

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciU0WN_EsUAcd-pkvKEBcymKrJUymACsKpfbCqVmmszPTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Corrupted Migration?

2015-10-01 Thread James Schneider
> I have tried that (by the way, the offending migration didn't show up in
the django_migrations table because the migration failed).
>
> I think we might be talking past each other. Sorry if I'm being unclear.
Here's an example of what's going on:
> Before migration, my database is at state X, and my migrations files
reflect that.
> I change my model file, updating the state (let's call it state Y). Then,
I run make migrations, generating a new migration file that corresponds to
state Y.
> I run the migrate command to get my database to state Y. It fails, so now
my database is back at state X. There is nothing in the database to delete
(not even from the django_migrations table) because the transaction was
rolled back.
> I delete the migration file that corresponds to state Y. My database is
back in state X, and my migration files again reflect that.
> I run the migrate command again, and it fails (same problem). The error
is django.db.models.fields.FieldDoesNotExist: [Model] has no field named
[field].

After you delete Y migration, have you searched your migration files to
verify that there are no references to that field?

> [field] corresponds to a new field in state Y, not in an existing field
in state X. I'm confused - why is it looking for a field that doesn't exist
in the pre-migrated state (state X)?

Do you have any RunPython or other custom modifications in your migrations
that would cause an object based on your modified model to be created (and
saved), possibly relying on a default value for the new 'field' specified
in your Y-version model, maybe as part of a data migration?

> So, I assume that the model state somehow is de-synced from the
database/migration state. I hop into the Django shell and check the model
metadata. The fields exactly match state Y. My database is still in state X.
> Does that make sense?

Makes perfect sense when you think about it. Being out of sync in this
manner happens constantly, and is exactly why migrations exist.

Django makes the assumption that the current values in your models.py files
exactly match the layout of the DB, since you should be syncing everything
using migrations and validating via tests.

Any time you modify a model, the DB and you model definitions become out of
sync, with your models being 'ahead' of your DB since you haven't informed
the DB of your model changes via migrations yet.

Think of it like someone writing you a check. Your relative personal wealth
increases as soon as you receive the check, but your bank statement won't
agree with you until you submit the check to them so that they can credit
your account accordingly.

Feel free to write me a check (for a large amount, bigger the better) so I
can demonstrate the effect it has on my bank account. ;-)

-James

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXbv9YVy_AZG0uaVhG%3D6w8HYosuU4tGRnSwYDxeyARwkA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


django on Windows

2015-10-01 Thread Антон Заровский
How use concole commands at windows?

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d9d6d648-f9cd-4f37-8214-9d0d0927c75d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


virtualenv best practice / source control

2015-10-01 Thread junk

Greetings wise django users,

Can someone provide a link or description of how to use 
virtualenv/django/source-control all at the same time?


I thought I would put my virtualenv code, and django, and a starter 
project in source control.  That was a fail - when the directories 
moved, nothing worked.


I changed some paths & symbolic links, and got some things working, but 
not everything.


Thanks everyone.

Regards,
Jody

--
This account is used for situtations where I believe SPAM may be sent to me.

--
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/560D22F7.1020203%40cypressriverservices.com.
For more options, visit https://groups.google.com/d/optout.


Re: django on Windows

2015-10-01 Thread Robin Lery
Did you install python? And is it in your environmental variable? If both
the answers yes then you could try all the commands using cmd prompt in
windows.
On 1 Oct 2015 17:51, "Антон Заровский"  wrote:

> How use concole commands at windows?
>
> --
> 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 group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d9d6d648-f9cd-4f37-8214-9d0d0927c75d%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B4-nGqTnJ9iTeDwoZBjU%2BcJ3H2Vcs-8VUtsKbbR1NXP8tm7wQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: virtualenv best practice / source control

2015-10-01 Thread Rafael E. Ferrero
this is for Django 1.6 but you can use it anyway

http://www.jeffknupp.com/blog/2013/12/18/starting-a-django-16-project-the-right-way/


--
Rafael E. Ferrero

2015-10-01 9:11 GMT-03:00 junk :

> Greetings wise django users,
>
> Can someone provide a link or description of how to use
> virtualenv/django/source-control all at the same time?
>
> I thought I would put my virtualenv code, and django, and a starter
> project in source control.  That was a fail - when the directories moved,
> nothing worked.
>
> I changed some paths & symbolic links, and got some things working, but
> not everything.
>
> Thanks everyone.
>
> Regards,
> Jody
>
> --
> This account is used for situtations where I believe SPAM may be sent to me.
>
> --
> 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 group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/560D22F7.1020203%40cypressriverservices.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJJc_8XvcLX%2BuRtSAkyuW1OVk3qcN66_XtRbDgL_8TTmPxBWLA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


ANN: eGenix PyRun - One file Python Runtime 2.1.1

2015-10-01 Thread eGenix Team: M.-A. Lemburg


ANNOUNCING

 eGenix PyRun - One file Python Runtime

Version 2.1.1


 An easy-to-use single file relocatable Python run-time -
   available for Linux, Mac OS X and Unix platforms,
 with support for Python 2.6, 2.7 and
 **now also for Python 3.4**.


This announcement is also available on our web-site for online reading:
http://www.egenix.com/company/news/eGenix-PyRun-2.1.1-GA.html



INTRODUCTION

eGenix PyRun is our open source, one file, no installation version of
Python, making the distribution of a Python interpreter to run based
scripts and applications to Unix based systems as simple as copying a
single file.

eGenix PyRun's executable only needs 11MB for Python 2 and 13MB for
Python 3, but still supports most Python application and scripts - and
it can be compressed to just 3-4MB using upx, if needed.

Compared to a regular Python installation of typically 100MB on disk,
eGenix PyRun is ideal for applications and scripts that need to be
distributed to several target machines, client installations or
customers.

It makes "installing" Python on a Unix based system as simple as
copying a single file.

eGenix has been using eGenix PyRun internally in the mxODBC Connect
Server product since 2008 with great success and decided to make it
available as a stand-alone open-source product.

We provide both the source archive to build your own eGenix PyRun, as
well as pre-compiled binaries for Linux, FreeBSD and Mac OS X, as 32-
and 64-bit versions. The binaries can be downloaded manually, or you
can let our automatic install script install-pyrun take care of the
installation: ./install-pyrun dir and you're done.

Please see the product page for more details:

http://www.egenix.com/products/python/PyRun/



NEWS

This patch level release of eGenix PyRun 2.1 comes with the following
enhancements:

Enhancements / Changes
--

 * Upgraded eGenix PyRun to work with and use Python 2.7.10 per
   default.

 * eGenix PyRun will now adjust sys.base_prefix and
   sys.base_exec_prefix in the same way it does for sys.prefix and
   sys.exec_prefix. This is needed for Python 3.4 in order to have
   distutils find the Python.h include file when compiling C
   extensions.

 * PyRun for Python 3.4 will now show the correct file name of scripts
   in tracebacks when running them directly, instead of just
   ''.

 * The new internal _sysconfigdata module used by the sysconfig module
   is now patched with the eGenix PyRun config data as well, to make
   sure that PyRun doesn't ship with two sets of build config
   variables.

install-pyrun Quick Install Enhancements
-

eGenix PyRun includes a shell script called install-pyrun, which
greatly simplifies installation of PyRun. It works much like the
virtualenv shell script used for creating new virtual environments
(except that there's nothing virtual about PyRun environments).

https://downloads.egenix.com/python/install-pyrun

With the script, an eGenix PyRun installation is as simple as running:

./install-pyrun targetdir

This will automatically detect the platform, download and install the
right pyrun version into targetdir.

We have updated this script since the last release:

 * Updated install-pyrun to default to eGenix PyRun 2.1.1 and its
   feature set.

For a complete list of changes, please see the eGenix PyRun Changelog:

http://www.egenix.com/products/python/PyRun/changelog.html



LICENSE

eGenix PyRun is distributed under the eGenix.com Public License 1.1.0
which is an Open Source license similar to the Python license. You can
use eGenix PyRun in both commercial and non-commercial settings
without fee or charge.

Please see our license page for more details:

http://www.egenix.com/products/python/PyRun/license.html

The package comes with full source code.



DOWNLOADS

The download archives and instructions for installing eGenix PyRun can
be found at:

http://www.egenix.com/products/python/PyRun/

As always, we are providing pre-built binaries for all common
platforms: Windows 32/64-bit, Linux 32/64-bit, FreeBSD 32/64-bit, Mac
OS X 32/64-bit. Source code archives are available for installation on
other platforms, such as Solaris, AIX, HP-UX, etc.

___

SUPPORT

Commercial support for this product is available from eGenix.com.
Please see

http://www.egenix.com/services/support/

for details about our support offerings.

__

Re: virtualenv best practice / source control

2015-10-01 Thread graeme


On Thursday, October 1, 2015 at 5:51:57 PM UTC+5:30, junk wrote:
>
> Greetings wise django users,
>
> Can someone provide a link or description of how to use 
> virtualenv/django/source-control all at the same time?
>
> I thought I would put my virtualenv code, and django, and a starter 
> project in source control.  That was a fail - when the directories moved, 
> nothing worked.
>

I think it a lot better not to put the virtualenv in source control. All 
you really need is the requirements.txt in source control and it is fairly 
easy to set up a  virtualenv.

You can make a virtualenv relocatable, but even then it is likely to cause 
problems - it is certain to cause problems if it contains any C extensions 
and someone wants to clone the code on a different OS.  It also bloats your 
repository with a lot of code that is not specific to your project, and I 
see little benefit to doing it.
 

>
> I changed some paths & symbolic links, and got some things working, but 
> not everything.
>
> Thanks everyone.
>
> Regards,
> Jody
>
> -- 
> This account is used for situtations where I believe SPAM may be sent to me.
>
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2c5cedfc-cb4e-4b26-9013-21b46f75bc28%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django rest framework - access token user

2015-10-01 Thread Shekar Tippur
Hello,

I am trying to get the user name from a token request.

Here is what I have so far:

from rest_framework.authtoken.models import Token


class getTokenl(generics.RetrieveDestroyAPIView):
permission_classes = [permissions.IsAuthenticated, TokenHasReadWriteScope]
queryset = Parcel.objects.all()
serializer_class = ParcelGetSerializer
model=Parcel
def dispatch(self, request, *args, **kwargs):
tok=request.META['HTTP_AUTHORIZATION'].replace('Bearer ','')

print (Token.objects.get(authtoken=tok))


With this, I get a error:


type object 'Token' has no attribute 'objects'


How do I get the token object? More so, is this the best way to access token 
object. at the end, I would like to get to the user who owns that token. 
Appreciate any help.


- Shekar

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/34d7fa3d-7b65-4ced-a564-8a21c6ba04cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: django on Windows

2015-10-01 Thread Ricardo Daniel Quiroga
The Best way is install activepython use 32bits for more compatibility with any 
modules and open cmd.exe 

 pip install -upgrade pip
 pip install django 

sorry for bad english . I speak spanish :(


-Mensaje original-
De: Robin Lery
Enviado: 01/10/2015 09:23
Para: django-users@googlegroups.com
Asunto: Re: django on Windows

Did you install python? And is it in your environmental variable? If both the 
answers yes then you could try all the commands using cmd prompt in windows. 

On 1 Oct 2015 17:51, "Антон Заровский"  wrote:


How use concole commands at windows?

-- 
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 group, send email to django-users@googlegroups.com.
 Visit this group at http://groups.google.com/group/django-users.
 To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d9d6d648-f9cd-4f37-8214-9d0d0927c75d%40googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.
 
-- 
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 group, send email to django-users@googlegroups.com.
 Visit this group at http://groups.google.com/group/django-users.
 To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B4-nGqTnJ9iTeDwoZBjU%2BcJ3H2Vcs-8VUtsKbbR1NXP8tm7wQ%40mail.gmail.com.
 For more options, visit https://groups.google.com/d/optout.
 

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/560d8a49.d0ed8c0a.b1ab9.0e25%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.


Re: django on Windows

2015-10-01 Thread Avraham Serour
don't, just use the regular python from python.org, and please use the 64
bit version

On Thu, Oct 1, 2015 at 10:32 PM, Ricardo Daniel Quiroga <
l2radamant...@gmail.com> wrote:

> The Best way is install activepython use 32bits for more compatibility
> with any modules and open cmd.exe
>
> pip install -upgrade pip
> pip install django
>
> sorry for bad english . I speak spanish :(
>
> --
> De: Robin Lery
> Enviado: 01/10/2015 09:23
> Para: django-users@googlegroups.com
> Asunto: Re: django on Windows
>
>
> Did you install python? And is it in your environmental variable? If both
> the answers yes then you could try all the commands using cmd prompt in
> windows.
> On 1 Oct 2015 17:51, "Антон Заровский"  wrote:
>
>> How use concole commands at windows?
>>
>> --
>> 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 group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/d9d6d648-f9cd-4f37-8214-9d0d0927c75d%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2B4-nGqTnJ9iTeDwoZBjU%2BcJ3H2Vcs-8VUtsKbbR1NXP8tm7wQ%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/560d8a49.d0ed8c0a.b1ab9.0e25%40mx.google.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFWa6tLp-4XRiR-q4MhdeKX0pM_2iJYo0KYj1gZY80Wq-gZqaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django on Windows

2015-10-01 Thread Tim Graham
Here's a new pull request to improve the installation instructions for 
Windows. Feedback and testing would be appreciated!

https://github.com/django/django/pull/5376

On Thursday, October 1, 2015 at 4:49:58 PM UTC-4, Avraham Serour wrote:
>
> don't, just use the regular python from python.org, and please use the 64 
> bit version
>
> On Thu, Oct 1, 2015 at 10:32 PM, Ricardo Daniel Quiroga <
> l2rada...@gmail.com > wrote:
>
>> The Best way is install activepython use 32bits for more compatibility 
>> with any modules and open cmd.exe 
>>
>> pip install -upgrade pip
>> pip install django 
>>
>> sorry for bad english . I speak spanish :(
>>
>> --
>> De: Robin Lery
>> Enviado: 01/10/2015 09:23
>> Para: django...@googlegroups.com 
>> Asunto: Re: django on Windows
>>
>>
>> Did you install python? And is it in your environmental variable? If both 
>> the answers yes then you could try all the commands using cmd prompt in 
>> windows. 
>> On 1 Oct 2015 17:51, "Антон Заровский" > 
>> wrote:
>>
>>> How use concole commands at windows?
>>>
>>> -- 
>>> 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...@googlegroups.com .
>>> To post to this group, send email to django...@googlegroups.com 
>>> .
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/d9d6d648-f9cd-4f37-8214-9d0d0927c75d%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CA%2B4-nGqTnJ9iTeDwoZBjU%2BcJ3H2Vcs-8VUtsKbbR1NXP8tm7wQ%40mail.gmail.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/560d8a49.d0ed8c0a.b1ab9.0e25%40mx.google.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4cca11db-6a5e-4b26-9ef5-beed24ca0018%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Change to Query.get_count() causes big performance hit

2015-10-01 Thread Alexander Dementsov
Recent pull merge 
​https://github.com/django/django/commit/c7fd9b242d2d63406f1de6cc3204e35aaa025233?diff=unified
 
generates SQL which causes severe performance hit when using distinct 
parameter. Here is the 
discussion: https://code.djangoproject.com/ticket/25230

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b5c2f744-faa3-43e9-b60e-d01d7ac6194d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Finding average

2015-10-01 Thread Bhanu Kathuria
I have attached my model files and template files. Please tell how can i 
find avg of rating for a particular college. In current format it is 
displaying rating of all colleges correctly.
Along with this I also want to add avg ratings for college.
I have used foriegn key in this.

-- 
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 group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5f44b185-b1f1-4e94-8382-f9f81f62de02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
import datetime
from django.db import models
from django.utils import timezone
# Create your models here.
class College(models.Model):
	college_text=models.CharField(max_length=200)
	pub_date = models.DateTimeField('date published')
	def __unicode__(self):
		return self.college_text

class Rating(models.Model):
	college=models.ForeignKey(College)
	rating=models.BigIntegerField()
	views=models.CharField(max_length=200)
	def __unicode__(self):
		return self.views

{{college.college_text}}


{% for rating in college.rating_set.all %}
	{{rating.rating}}
		
{% endfor %}
{% if latest_college_list %}

{% for college in latest_college_list %}
{{ college.college_text }}
{% endfor %}

{% else %}
No polls are available.
{% endif %}