Re: Is there a way to supress blank lines in the HTML?

2014-10-23 Thread termopro
May i ask you why do you need that ? If you need this for some performance reasons like html compression, you are doing it wrong. Instead you could use server-side GZIP compression when serving html which will do the job much more efficiently. If you are concerned about the structure of the do

Re: Django REST Framework

2014-10-23 Thread Max Nathaniel Ho
Hi Russell, Thanks for your reply. As I am fairly new to django and programming in general, do you mind sharing what REST APIs actually do? Thank you! On Thu, Oct 23, 2014 at 11:51 AM, Russell Keith-Magee < russ...@keith-magee.com> wrote: > Hi Max, > > Django ReST Framework, as the name suggests

Re: Django REST Framework

2014-10-23 Thread Andreas Kuhne
Hi Max, I think you should really just google it a bit and read about it. http://en.wikipedia.org/wiki/Representational_state_transfer is a good start. A simplified version is that a REST API allows you to get information about your database models in a structured and predictive way. HOW the API

Re: Django REST Framework

2014-10-23 Thread Max Nathaniel Ho
Hi Andreas, Thank you. Will read up! On Thu, Oct 23, 2014 at 4:18 PM, Andreas Kuhne wrote: > Hi Max, > > I think you should really just google it a bit and read about it. > http://en.wikipedia.org/wiki/Representational_state_transfer is a good > start. > > A simplified version is that a REST AP

Re: Is there a way to supress blank lines in the HTML?

2014-10-23 Thread Avraham Serour
I suggest taking a look at google pagespeed, you can add it to nginx or even apache But many people like to do this at the django level, you should look for apps like django compressor On Thu, Oct 23, 2014 at 9:59 AM, termopro wrote: > > May i ask you why do you need that ? > > If you need this

Re: Django REST Framework

2014-10-23 Thread Lachlan Musicman
The way I always describe APIs (in a broad, general sense) is: Image internet service "Twotter" had posts, and each post had a date. If they had a date API you might be able to get all of the posts for a month like: for month in months: return "https://twotter.org/%s"; %month and then you cou

Re: Django REST Framework

2014-10-23 Thread Max Nathaniel Ho
Hi Lachlan, Simple and clear explanation. Thanks! On Thu, Oct 23, 2014 at 5:43 PM, Lachlan Musicman wrote: > The way I always describe APIs (in a broad, general sense) is: > > Image internet service "Twotter" had posts, and each post had a date. > > If they had a date API you might be able to g

Starting a procedure when opening a model in the admin interface

2014-10-23 Thread Victor
I use Django 1.7, admin interface, and PostgreSQL. I have, among other things, the following model: ### models.py class Patients(models.Model): surname = models.CharField(max_length=60, db_index=True) name = models.CharField(max_length=60, db_index=True) address = models.CharField(max_l

DateTimeField: Hide clock

2014-10-23 Thread Oskar Lyrstrand
models.py: class Post(models.Model): pub_date = models.DateTimeField template.html: {{ post.pub_date }} output: 23 october 2014 19:25 Problem is I dont want "19:25" to show. What can I do? -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: django-admin creates the views.py files in the wrong place!

2014-10-23 Thread Daniel Roseman
On Wednesday, 22 October 2014 22:05:07 UTC+1, Aliane Abdelouahab wrote: > > Hi, > Django 1.7 when a beginner runs the first tutorial, he has to change the > views.py file outside the app to the whole project itself. > i found this, > http://stackoverflow.com/questions/22011791/importerror-no-modu

Re: [AGAIN] Inserting further fields of a foreignkey object into change list view

2014-10-23 Thread Victor
Dear Experts, following the indications of Collin I was able to see the extra fields I wanted to show in the change list view. But there's a little problem. The character size of the labels of the readonly_fields are bigger than those of the printed fields so that the visual effect is that the la

Re: DateTimeField: Hide clock

2014-10-23 Thread jirka . vejrazka
Look at the "date" filter in template documentation, allows you to customize the output. HTH Jirka -Original Message- From: Oskar Lyrstrand Sender: django-users@googlegroups.com Date: Thu, 23 Oct 2014 03:28:10 To: Reply-To: django-users@googlegroups.com Subject: DateTimeField:

Re: DateTimeField: Hide clock

2014-10-23 Thread Daniel Roseman
On Thursday, 23 October 2014 11:28:10 UTC+1, Oskar Lyrstrand wrote: > > models.py: > class Post(models.Model): > pub_date = models.DateTimeField > > template.html: > {{ post.pub_date }} > > output: > 23 october 2014 19:25 > > Problem is I dont want "19:25" to show. What can I do? > Why are y

Re: Reverse lookup in search_fields on Admin

2014-10-23 Thread Collin Anderson
Hello, Your code looks right. Do you have other things in search_fields? Thanks, Collin -- 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..

Re: DateTimeField: Hide clock

2014-10-23 Thread Oskar Lyrstrand
Thank you very much for that point! :D I am fairly new to Django and Python, just followed the official doc for making an app and these kinds of things aren't obvious for me. To make it more clear: I changed from DateTimeField to DateField and updated my browser.. (nothing).., I actually had to

Re: how to save in inline form total sum

2014-10-23 Thread Collin Anderson
Hello, I'm not sure what you're trying to do, but to fix the None error set default=0 on the total columns. Or do something like this: self.total_men = (self.total_men or 0) + (self.men or 0) Thanks, Collin -- You received this message because you are subscribed to the Google Groups "Django

Re: getting 500 131 error on page not found

2014-10-23 Thread Collin Anderson
> > Where are you located? How long have you been doing Django? > South Bend, IN, USA. I've been using Django since 2006, but just started posting to the mailing list recently. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe fr

Re: Working with Google Analytics API

2014-10-23 Thread Collin Anderson
Hello, Yes, I think that's right. Here's a deeper link: https://developers.google.com/analytics/devguides/reporting/core/v3/gdataLibraries I also found a python specific library here. https://developers.google.com/api-client-library/python/apis/analytics/v3 Collin -- You received this message

Re: no module in error log django-1.3.7

2014-10-23 Thread Collin Anderson
Hello, I think you have 3 options: 1. Migrate to the new (django 1.5+) project layout like this: projectname --manage.py --projectname --__init__.py --settings.py --urls.py --appname --__init__.py --admin.py --forms.py --models.py

Re: Import error in settings.py

2014-10-23 Thread Collin Anderson
You can also do this: import importlib module_name, name = path.rsplit('.', 1) return getattr(importlib.import_module(module_name), name) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails fr

Re: How do I display list of pages with a ListView object?

2014-10-23 Thread Collin Anderson
Hi Daniel, Would this work? {% for p in page_obj.paginator.page_range %} {% endfor %} Collin -- 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+unsu

Re: Starting a procedure when opening a model in the admin interface

2014-10-23 Thread Collin Anderson
Hi Vittorio, I've done something like this before in the get_queryset() method of ModelAdmin. Thanks, Collin -- 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 d

Re: django-admin creates the views.py files in the wrong place!

2014-10-23 Thread Aliane Abdelouahab
i followed exactly by words the tutorial http://www.tangowithdjango.com/book17/chapters/setup.html#creating-a-django-application and it seems the problem is about creating the double directory, and when doing startapp it creates a directory parallel to the other one created? -- You received this

Re: Installing django on red hat linux box

2014-10-23 Thread Thomas G Lockhart
On Oct 22, 2014, at 9:57 AM, robert brook wrote: > I have python 3.3. If you are running RHEL6, python 2.6 is supported through yum etc. You will need to do your own installation if you want a more recent version, but afaik you will not need to. 2.6 is sufficient. If it were me, "good enough"

Importing models in app config module

2014-10-23 Thread Torsten Bronger
Hallöchen! https://docs.djangoproject.com/en/dev/ref/applications/ says: You cannot import models in modules that define application configuration classes, but you can use get_model() to access a model class by name, like this: Does this also apply to models of other apps? In partic

Re: django-admin creates the views.py files in the wrong place!

2014-10-23 Thread Daniel Roseman
On Thursday, 23 October 2014 15:34:15 UTC+1, Aliane Abdelouahab wrote: > > i followed exactly by words the tutorial > > http://www.tangowithdjango.com/book17/chapters/setup.html#creating-a-django-application > and it seems the problem is about creating the double directory, and when > doing starta

Re: unit test: AssertionError: 302 != 200

2014-10-23 Thread kenju254
Hi Kim, I was going through Django 1.7 and noticed that you have to force the redirect on this line response = c.get('/admin/' follow=True) Regards Kenneth Kinyanjui On Saturday, 21 June 2014 05:47:24 UTC+3, Kim wrote: > > Hi everyone, > I'm new to Django and am running a test. > > For my

Re: Reverse lookup in search_fields on Admin

2014-10-23 Thread Emanuel
Hi. Yes, I do have another fields. And thanks a lot. I was focus on that particular field that I forgot to see that I had another relation in search_fields wich I was not using the lookup. It works now. Thanks Quinta-feira, 23 de Outubro de 2014 13:11:37 UTC+1, Collin Anderson escreveu: >

Re: django-admin creates the views.py files in the wrong place!

2014-10-23 Thread Daniel Roseman
On Thursday, 23 October 2014 21:45:18 UTC+1, Aliane Abdelouahab wrote: > > Try the code like that, it will not work, > > now move the views.py from /rango to the initial directory where the is > the manage.py (/abdou) and it will work > Nope; that is the correct structure, as it is, with no need

is it possible to detect the end of the django app?

2014-10-23 Thread Michael
Hi, How to detect that the django app is stopping? I use some librairies that use a queue (queue.Queue) to store the data that will be sent in batch. They provide a flush method to flush at the end of the program to make sure there’s nothing left in the queue. But where could I call the flush

Re: django-admin creates the views.py files in the wrong place!

2014-10-23 Thread Aliane Abdelouahab
oh! sorry :D i was dumb! how can i missed this! thank you again! -- 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 po

Re: is it possible to detect the end of the django app?

2014-10-23 Thread Russell Keith-Magee
HI Michael, There's a problem here - Web apps don't have a lifecycle like this. The only part of the app lifecycle that can be relied upon is the request-response cycle - someone makes a response, which will eventually be returned as a response. Outside of that internal lifecycle, not much can be

Re: is it possible to detect the end of the django app?

2014-10-23 Thread Michael Palumbo
Thank you Russell for your response. That confirms what I was thinking. I am going to use a queue. On Thu, Oct 23, 2014 at 6:10 PM, Russell Keith-Magee < russ...@keith-magee.com> wrote: > HI Michael, > > There's a problem here - Web apps don't have a lifecycle like this. The > only part of the ap

Re: is it possible to detect the end of the django app?

2014-10-23 Thread Aliane Abdelouahab
> > the end of user's task on an internet application can be: > Disconnecting: this is clear, disconnects if there is a login, and goes do other stuff, simply if the cookie is removed, that means his task is over. Being idle: you detect with the cookie if there is not a big delta time from whe

Re: how to save in inline form total sum

2014-10-23 Thread carlos
Hi +Collin the idea is sum all data for example de model is class ModelB(models.Model): choice = models.Integerfield(choices='CHOICE_TYPE') men = models.IntegerField() women = models.IntegerField() total_men = integerField(editable=False) total_women = integerField(editable=Fal