ajax philosophy

2015-02-12 Thread Aaron Reabow
I would like to separate out my ajax requests into their own views (one per page, is what I am thinking) This allows me to keep a very generic base view that applies to multiple pages. This have a number of advantages for me, such as building a bullet proof view that never gives any trouble :)

Re: ajax philosophy

2015-02-12 Thread Avraham Serour
in my opinion no, it actually makes sense to have an API with its own routes and views. I suggest you take a look at tastypie or DRF On Thu, Feb 12, 2015 at 10:17 AM, Aaron Reabow wrote: > I would like to separate out my ajax requests into their own views (one > per page, is what I am thinking)

Re: ajax philosophy

2015-02-12 Thread Aaron Reabow
Okay great, thanks. I wrote a basic view, and it seems to do the job. So far so good :) I know (of) DRF, but not tastypie - will have a look. thanks again for the help On Thursday, 12 February 2015 11:37:36 UTC+2, Avraham Serour wrote: > > in my opinion no, it actually makes sense to have an A

Django inlineformset autocomplete and autopopulate by ajax

2015-02-12 Thread Ajay Kumar
I'm trying to do this following link feature in django, http://demo.smarttutorials.net/jquery-autocomplete/ Here by choosing country the rest of the fields will be auto populated, like this i'm trying to achieve in django, If any idea pls tell me it will be very great for me This is Product

Re: my mysite/templates/admin/base_site.html is ignored (tutorial unclear?)

2015-02-12 Thread Marc Moncrief
I've been going through the tutorial and had the same problem. The docs say "Create a templates directory in your project directory. " I don't know if this will apply to you, but I thought that meant to put it in the poll directory. They mean to put it in the mysite directory. I made that change

Django 1.7 Raw Connections in TransactionManagement

2015-02-12 Thread Chew Kok Hoor (gMail)
Hi all, I am using: with transaction.atomic() And in the with block, sometimes I use django query like: models.Customer.objects.count() and sometimes I use cursor, example: with transaction.atomic(): count_customers = models.Customer.objects.cou

MySQL backends

2015-02-12 Thread Ulisses Cruz
I have one question: To use Django with MySQL, do I have to use python version 2.7? I'm using python version 3.4 and I'm getting error when I try to install MySQL-python: *error: Unable to find vcvarsall.bat* -- You received this message because you are subscribed to the Google Groups "Django

connecting Django to MySQL

2015-02-12 Thread Ulisses Cruz
Hello I'm trying to connect my Django project with the MySQL database. So I tryied to download the MySQL-python package with the command: *pip install MySQL-python* but I'm having the error: *error: Unable to find vcvarsall.bat* Someone could help me find out what is happening. And how can I ge

backend para MySQL

2015-02-12 Thread Ulisses Cruz
Olá Eu estou a tentar ligar o meu projeto Django à base de dados MySQL. por isso estou tentando descarregar o MySQL-python por meio do comando: *pip install MySQL-python* Mas esta dando um erro: *error: Unable to find vcvarsall.bat* alguém pode me ajudar a entender o que se passa? -- You rece

Re: connecting Django to MySQL

2015-02-12 Thread Gustavo Andres Angulo
On Thu, Feb 12, 2015 at 8:18 AM, Ulisses Cruz wrote: > Hello > I'm trying to connect my Django project with the MySQL database. > So I tryied to download the MySQL-python package with the command: > > *pip install MySQL-python* > > but I'm having the error: > > *error: Unable to find vcvarsall.ba

Re: backend para MySQL

2015-02-12 Thread Felipe Faraggi
No windows eu acredito que eu tive que instalar o visual studio antes de usar esse comando. http://stackoverflow.com/questions/2817869/error-unable-to-find-vcvarsall-bat On Thursday, February 12, 2015 at 2:13:01 PM UTC+1, Ulisses Cruz wrote: > > Olá > Eu estou a tentar ligar o meu projeto Djan

Re: MySQL backends

2015-02-12 Thread Ezequiel Bertti
Try to install using a well package of this site: http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python mysqlclient‑1.3.5‑cp34‑none‑win32.whl mysqlclient‑1.3.5‑cp34‑none‑win_amd64.whl On Thu, Feb 12, 2015 at 11:37 AM, Ulisses Cruz wrote: > I have one question: > To use Django with MySQL, do

passing a list of list to a template

2015-02-12 Thread dk
i do have a list of list like this [ [apple, banana, red] , [orange, grape, blue] , [watermelon, tangerine, purple] ] then i am passing it to the template like return render(request, "show_table.html", {"lista": lista}) inside my template html i have {% for i in lista %}

Issue in Django count string in a template

2015-02-12 Thread Ronaldo Bahia
I am facing issues trying to get a count. Hope you can help me. In the template, if I insert {{ message.count }} not happens 'coz message is a string. If I insert {% load inbox %} {% inbox_count as message %} it returns all unread messages, but I need to get the unread messages sent by a give

Re: passing a list of list to a template

2015-02-12 Thread Vijay Khemlani
If you have a fixed number of items in each of the sublists you can do {{ i.0 }} # First element {{ i.1 }} # Second element or you can iterate over it {% for sub_element in i %} {{ sub_element }} {% endfor %} On Thu, Feb 12, 2015 at 2:55 PM, dk wrote: > i do have a list of list like

Re: passing a list of list to a template

2015-02-12 Thread monoBOT
{% for x, y in points %} There is a point at {{ x }},{{ y }}{% endfor %} extracted from: https://docs.djangoproject.com/en/1.7/ref/templates/builtins/ 2015-02-12 18:55 GMT+01:00 dk : > i do have a list of list like this > [ [apple, banana, red] , [orange, grape, blue] , [watermelon,

Re: passing a list of list to a template

2015-02-12 Thread ADEWALE ADISA
What of: {% for i in lista %} {% for j in i %} {{ j }} {% endfor %} {% endfor %} On Feb 12, 2015 6:55 PM, "dk" wrote: > i do have a list of list like this > [ [apple, banana, red] , [orange, grape, blue] , [watermelon, >

Model Saving Error

2015-02-12 Thread Ulisses Cruz
Hello, I'm having dificulty with saving data to a MySQL database. I created a simple model: *class Music(models.Model):* * title = models.CharField(max_length=100)* * slug = models.SlugField(null=True)* * content = models.FileField(upload_to="music", null=True, blank=True)* * def __str__(self):* *

Re: Issue in Django count string in a template

2015-02-12 Thread Bill Freeman
I presume that your messages are model instances. If so, create a queryset for the unread messages in your view, and pass that, or the result of applying .count() to it, as a template context variable, say "unread_message_count". On Thu, Feb 12, 2015 at 1:06 PM, Ronaldo Bahia wrote: > I am faci

Re: Model Saving Error

2015-02-12 Thread Ulisses Cruz
> > Thanks > The problem was solved when I used another backend from: > http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python The backend I was using was not appropriate for python 3 that I am using but when I used: mysqlclient-1.3.5-cp34-none-win32.whl it start working. -- You received t

Re: Issue in Django count string in a template

2015-02-12 Thread Ronaldo Bahia
Thanks for answering. Can you provide some example? Cheers Em quinta-feira, 12 de fevereiro de 2015 17:00:28 UTC-2, ke1g escreveu: > > I presume that your messages are model instances. If so, create a > queryset for the unread messages in your view, and pass that, or the result > of applying

Template Spaces and tabs

2015-02-12 Thread Ulisses Cruz
Hello This may seem trivial but can you help? I'm reading a file line by line and transforming it in a list of lines (example:* list_of_lines = [file_line1, file_line2, ...]*) then I pass the list to a template to be displayed. (example: return render(request, *'template/location.html', {'lines'

help with this show data in template

2015-02-12 Thread carlos
Hi, i don't know show my data in template ok explain my models models.py class Country(..): name = charfield... def __unicode__(..) return self.name class Gender(..): name = charfield... def __unicode__(..) return self.name class Player(..): country = FK(countr

Re: Template Spaces and tabs

2015-02-12 Thread Tom Evans
On Thu, Feb 12, 2015 at 8:25 PM, Ulisses Cruz wrote: > Hello > This may seem trivial but can you help? > > I'm reading a file line by line and transforming it in a list of lines > (example: list_of_lines = [file_line1, file_line2, ...]) > then I pass the list to a template to be displayed. (exampl

Re: Issue in Django count string in a template

2015-02-12 Thread Bill Freeman
Show me your view. On Thu, Feb 12, 2015 at 2:49 PM, Ronaldo Bahia wrote: > Thanks for answering. > > Can you provide some example? > > Cheers > > Em quinta-feira, 12 de fevereiro de 2015 17:00:28 UTC-2, ke1g escreveu: >> >> I presume that your messages are model instances. If so, create a >> qu

Re: setlang using AJAX

2015-02-12 Thread Tiago Barufi
You could simply add csrfmiddlewaretoken: document.getElementsByName('csrfmiddlewaretoken')[0].value, to the parameters on $.post. That would surely prevent the 403. Em segunda-feira, 30 de maio de 2011 12:03:46 UTC-3, doktoreas escreveu: > > Thank you very much, for your help and your code.