Re: Class Views

2011-10-06 Thread Vijay Khemlani
It should be "render_to_response", not "render_to_reponse", a spelling problem maybe? On Thu, Oct 6, 2011 at 12:53 PM, CrabbyPete wrote: > I have the following class defined > > class TeamView(TemplateResponseMixin, View): >template_name = 'team.html' > >def get(self, request): >

Facebook Authentication: Client side vs. Server side

2011-10-18 Thread Vijay Khemlani
Hello, I'm just starting with a project that requires users to be able to authenticate directly using their Facebook accounts. I know this is an old problem, but I noticed there are two quite distinct ways to solve it, and I wanted to ask for the group's opinion 1. Using FB JavaScript SDK ==

Re: Seeking reviewers for a "Guide to Idiomatic Django Deployment"

2013-11-05 Thread Vijay Khemlani
Wouldn't it be better to publish the book the same way as the Django Book ( http://www.djangobook.com/, https://github.com/jacobian/djangobook.com) instead of looking for private reviewers? On Tue, Nov 5, 2013 at 9:34 PM, George London wrote: > Hi All! > > As a fairly recently self-taught Django

Re: New data field in models.py "does not exist".

2015-01-12 Thread Vijay Khemlani
u should also try running syncdb again. It should be an idempotent >> operation, assuming that you haven't made any other changes to your model >> code, so you can run it as many times as you want. >> >> -James >> On Jan 12, 2015 11:40 AM, "Vijay Khemlani"

Re: filter

2015-01-15 Thread Vijay Khemlani
in your view new_leave and a are QuerySet objects, and then you are comparing them to a string ("True") not a bolean (True without quotes), so it's always False. Even if you change "True" to True it won't work, try it like this if new_leave.exists() and a.exists(): return ... On Thu, Jan 15,

Re: filter

2015-01-15 Thread Vijay Khemlani
} > {{a.authorization_date}} > > > {%endfor%} > > > > > view.py > > > def FMKD1_leave_to_authorize(request): > new_leave > =newleave.objects.filter(department_head_authorization="Approved" ) > new_leave = newleave.objects.filter(department=

Re: How to check appname via Django commands?

2015-01-17 Thread Vijay Khemlani
What problem are you having exactly? Also I'm not sure what do you mean by "hierarchy" of the project folders, do you mean the order the apps appear in the INSTALLED_APPS setting? On Sat, Jan 17, 2015 at 6:38 AM, Sugita Shinsuke wrote: > Hi there. > > I use Django 1.6 version. > > The database

Re: Using jquery ajax POST method with django

2015-01-17 Thread Vijay Khemlani
Maybe it's triggering the CSRF validation? What error message are you getting exactly from the server? On Sat, Jan 17, 2015 at 10:37 AM, Erwin Sprengers wrote: > Hello, > > POST works fine for me, I use the following django code : > > at the end of the view : > > return HttpResponse(simplejson.

Re: Best way to test handle optional FKs in model __str__?

2015-01-17 Thread Vijay Khemlani
I don't think there is a way in Python to do that directly you could have a utility method that catches the exception, for example def get_fk_field(obj, fk_field): try: return getattr(obj, fk_field) except AttributeError: return None so that your call would be return _(u

Re: How to subclass django-contact-form to create custom contact form?

2015-01-19 Thread Vijay Khemlani
Right now the "reportForm" variable is pointing to the RequestForm class, not to an object, so you need to do it like this reportForm = ReportForm()# Take note of the parenthesis In your template, your form tag need an action attribute (well, it's not mandatory but it is highly advised). In t

Re: How to subclass django-contact-form to create custom contact form?

2015-01-19 Thread Vijay Khemlani
OK, I read a little of the library documentation, and this is what you have to do I think 1. subclass the ContactForm (you already have that) 2. subclass the ContactFormView from the library, at least with this: class ReportFormView(ContactFormView): form_class = ReportForm 3. Map this view

Re: Desperately need Django help!

2015-01-19 Thread Vijay Khemlani
For single page applications I highly recommend this tutorial, it answers the typical questions regarding single page apps. https://thinkster.io/brewer/angular-django-tutorial/ (assuming you are using angularJS) On Mon, Jan 19, 2015 at 5:08 AM, wrote: > Hi, I am trying to build a single page,

Re: can't install the pillow library on my first attempt to add an ImageField to my model

2015-01-21 Thread Vijay Khemlani
You need to install the development python package for your distro For example, in Ubuntu sudo apt-get install python-dev in Fedora sudo yum install python-devel On Wed, Jan 21, 2015 at 10:44 AM, aseds wrote: > hi, > this is the first time i tried and added an ImageField to my model. then >

Re: can't install the pillow library on my first attempt to add an ImageField to my model

2015-01-21 Thread Vijay Khemlani
GAWn-record/install-record.txt --single > > -version-externally-managed --compile failed with error code 1 in > /tmp/pip_build_aseds/pillow > Storing debug log for failure in /home/aseds/.pip/pip.log > > so, should i change the Permission for "dist-packages"?? is it safe to

Re: login_required in urlpatterns TypeError 'tuple' object is not callable

2015-01-23 Thread Vijay Khemlani
I may be mistaken, but I don't think you can decorate an entire "include" call On Fri, Jan 23, 2015 at 8:51 PM, Neto wrote: > Hi, I'm using login_required in url patterns but it does an error: > > urls.py > > from django.conf.urls import patterns, include, url > from django.contrib.auth.decorato

Re: How to properly set the initial value for a Form ChoiceField

2015-01-23 Thread Vijay Khemlani
It could be a number of things, but the main thing that caught my attention was this part self.fields['images'].initial = str(selected_image) self.fields['images'].initial = str(selected_flavor) shouldn't it be self.fields['images'].initial = str(selected_image) s

Re: Help in Django-contact-form

2015-01-27 Thread Vijay Khemlani
And I'm not following, contact_form does not provide a ContactForm model, but you are providing one it seems, but it's on the same contact_form package as the library itself? Also, the fact that the model class has the same name as the form class does not help much. On Tue, Jan 27, 2015 at 10:45

Re: Best way to get ForeignKey Related Objects?

2015-01-29 Thread Vijay Khemlani
"answers" seems to be a method on the AudioQuestionPair class, so your call should be: for answer in pair.answers(): print answer and "pair.answers.get.all()" does not make sense sinse "answers" is a method. If you don't want to use a specific method, you can do this: answers = pair.answer_

Re: Best way to get ForeignKey Related Objects?

2015-01-29 Thread Vijay Khemlani
AM, Tobias Dacoir wrote: > Damn, you are right. pair.answers() works. I'm wondering why I didn't get > a syntax error when calling it without the parenthesis (), because print > still worked. > > On Thursday, January 29, 2015 at 2:59:56 PM UTC+1, Vijay Khemlani wrote: >>

Re: When do I have to call save() on a Model Instance?

2015-01-29 Thread Vijay Khemlani
You could pass the user as an optional parameter to function2. Whether you should save the user or not in each of the methods depends on the logic of your application, or you can add a parameter to the method (True to save the object, False otherwise) On Thu, Jan 29, 2015 at 1:43 PM, Tobias Dacoi

Re: When do I have to call save() on a Model Instance?

2015-01-29 Thread Vijay Khemlani
yep, it's safe to do so On Thu, Jan 29, 2015 at 3:40 PM, Tobias Dacoir wrote: > Thanks for answering all my questions. > > So it's perfectly save to call the save method at a later time? As long as > I keep the object and a pointer to it in memory I can freely modify it in > several Functions be

Re: Do Signals block Django process?

2015-01-30 Thread Vijay Khemlani
The number of threads is determined by the number of workers in your process that is serving the application, not Django itself. For example, if you are using uWSGI to serve the application, then you have a parameter "workers" in its initialization file that sets the number of process to spawn and

Re: How to get hold of a session after getting signaled?

2015-01-30 Thread Vijay Khemlani
As far as I can tell on the project source, the only place the "badge_awarded" signal is triggered is in the "award_to" method in the Badge class, which does not handle a request object. If you are calling something like "badge.award_to(user)" in one of your views, then you can modify the request

Re: incorrect syntax of django core management __init.py file (reported on windows powershell)

2015-01-31 Thread Vijay Khemlani
Django 1.3 only works with python 2, not python 3 On Sat, Jan 31, 2015 at 2:31 PM, Akshit Arora wrote: > hey, I am working on this project that requires django with apache > > https://github.com/nbproject/nbproject > > it's installation guide is here : > > https://github.com/nbproject/nbproject/

Re: Initial stages of django

2015-01-31 Thread Vijay Khemlani
Did you take a look at the official tutorial? https://docs.djangoproject.com/en/1.7/intro/tutorial01/ On Sat, Jan 31, 2015 at 5:02 PM, Sreenivasarao Pallapu < sreenivas.eng...@gmail.com> wrote: > Hi, >I'm new to django. I know basic python. I heard that django is nothing > but python. I've i

Re: PermissionError with open()

2015-02-02 Thread Vijay Khemlani
Your call to ".format(file_name)" does nothing as the original string does not have the positional arguments ("{0}" for example) You could just append the filename with "+". On Mon, Feb 2, 2015 at 3:32 AM, John wrote: > Hello everyone, > > I am trying to run this code inside view.py, to make

Re: ListView and Deleteview

2015-02-02 Thread Vijay Khemlani
Hmmm... Try and post your urls.py and views.py (the correct one) On Mon, Feb 2, 2015 at 5:20 PM, Dan Gentry wrote: > This is a bit of a stumper! > > I don't see any big glaring issues. A couple of housekeeping things: Is > there data in the table? Are you certain that you are using the correct

Re: Writing your first Django app, part 1 - Django 1.7 - # Make sure our __str__() addition worked.

2015-02-04 Thread Vijay Khemlani
The method is called "__str__" (note the double underscore at both ends) On Wed, Feb 4, 2015 at 2:29 PM, Gavin Patrick McCoy < gavin.mcc...@mail.dcu.ie> wrote: > Hi, > > Just started learning Django today. I got down to the last grey box of > code on > https://docs.djangoproject.com/en/1.7/intro/

Re: Writing your first Django app, part 1 - Django 1.7 - # Make sure our __str__() addition worked.

2015-02-04 Thread Vijay Khemlani
Don't worry :) On Wed, Feb 4, 2015 at 7:00 PM, Gavin Patrick McCoy < gavin.mcc...@mail.dcu.ie> wrote: > Sorry about that. Thanks a million for your reply. > > On Wednesday, 4 February 2015 17:38:16 UTC, Vijay Khemlani wrote: >> >> The method is called "__

Re: subdomains and HOST in settings.py?

2015-02-05 Thread Vijay Khemlani
I'm not following, in the Django settings there is no "HOST" entry (other than the one used to connect to the database) https://docs.djangoproject.com/en/1.7/ref/settings/ If you're talking about "ALLOWED_HOSTS", then that one is only a whitelist of allowed domains. Try and describe your problem

Re: models, peeking to next record - maybe

2015-02-07 Thread Vijay Khemlani
The direct solution would be something like this in your view events = Event.objects.order_by('event_date') event_tuples = [] last_date_seen = None for event in events: if last_date_seen: date_difference = event.date - last_date_seen else: date_difference = None even

Re: Contact form and sending confirmation an page.

2015-02-08 Thread Vijay Khemlani
One way would be to render the page after the submit and scroll down to the form. Other would be submitting the form by ajax. On Sun, Feb 8, 2015 at 6:30 PM, inoyon artlover KLANGRAUSCH < inoyonartlo...@googlemail.com> wrote: > Hi there! > > I got one page. On the page is a contact form. > After

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-13 Thread Vijay Khemlani
if i.2 == to somestuff? do something? or > all that need to be set in the view function? > > thanks > > > On Thursday, February 12, 2015 at 12:15:50 PM UTC-6, Vijay Khemlani wrote: > >> If you have a fixed number of items in each of the sublists you can do >> >>

Re: how to get a link to an absolute hyperlink

2015-02-13 Thread Vijay Khemlani
Try adding "http://"; at the start Also, consider that the format is 111.111.111.111: (the port is after a colon, not a dot) On Fri, Feb 13, 2015 at 8:03 PM, dk wrote: > its just a string with an ip address and that's it. > > {{ j }} > so at the end should be something like > 11.111.1

Re: html response to be loaded in a div

2015-02-18 Thread Vijay Khemlani
What is the actual content of the response you are getting from the AJAX request? On Wed, Feb 18, 2015 at 10:27 AM, João Marques wrote: > Hey guys, so basicly I want to send a GET request with ajax to one of my > views and the specific view returns an html response that will be loaded on > a div

Re: html response to be loaded in a div

2015-02-18 Thread Vijay Khemlani
. On Wed, Feb 18, 2015 at 1:47 PM, João Marques wrote: > Im getting nothing really... I just do alert(response); and nothing shows > up. > > quarta-feira, 18 de Fevereiro de 2015 às 14:48:48 UTC, Vijay Khemlani > escreveu: >> >> What is the actual content of the respon

Re: html response to be loaded in a div

2015-02-18 Thread Vijay Khemlani
What is being sent to the view from the browser is fine, it's just being url encoded, the actual value is something like this then: [[['5E', '10A', '8D'], ['8B', '11B', '12G'], ['8C', '7B'], ['12C', '11F', '6A'],['5E', '10G', '10H'],['8A','11E'], ['7A', '12E', '12F'], ['5A', '11C', '12B','11G'], [

Re: How to install django in redhat where i have python 2.6 and 2.7 and i need to install django in python 2.7

2015-02-19 Thread Vijay Khemlani
you can compile python locally On Thu, Feb 19, 2015 at 10:27 AM, SHINTO PETER wrote: > How to install django in redhat where i have python 2.6 and 2.7 and i need > to install django in python 2.7 > > -- > You received this message because you are subscribed to the Google Groups > "Django users"

Re: JSON Response

2015-02-19 Thread Vijay Khemlani
What do you mean with "in a good way"? Does your code work? On Thu, Feb 19, 2015 at 4:14 PM, elcaiaimar wrote: > Hello, > > I was wondering how I can send a response JSON in a good way, because I > have the next code: > > if "product_id" in request.POST: > try: > id_p

Re: JSON Response

2015-02-19 Thread Vijay Khemlani
atus":"True","product_id":p.id} But this should be > read for the JS code, and if it's True show an alert saying Remove it! > > Is there anything wrong in my code? > > El jueves, 19 de febrero de 2015, 21:49:59 (UTC+1), Vijay Khemlani > escribió: >&g

Re: html response to be loaded in a div

2015-02-19 Thread Vijay Khemlani
There's no "range" in django templates, you just use {% for elem in sols %} Regarding making the request using POST, are you sure you're not having a proble with CSRF? https://docs.djangoproject.com/en/1.7/ref/contrib/csrf/ It has a section for AJAX requests On Thu, Feb 19, 2015 at 7:44 PM,

Re: Transcode video using celery and ffmpeg in django

2015-02-20 Thread Vijay Khemlani
I would do something like this video = Video() video.original = form.cleaned_data['video'] # Assuming the form field is "video" video.user = user video.title = form.cleaned_data['title'] # Assuming the form field is "title" video.save() # You might need to make the mp4_480 and mp4_7

Re: Transcode video using celery and ffmpeg in django

2015-02-20 Thread Vijay Khemlani
Then in your task function you can get the file from the video model instance, trascode it, and store it in the corresponding fields of the object (mp4_480, mp4_720) On Fri, Feb 20, 2015 at 10:18 AM, Vijay Khemlani wrote: > I would do something like this > > video = Video() > vi

Re: html response to be loaded in a div

2015-02-20 Thread Vijay Khemlani
nage to get the rest of the essential things to work. > > sexta-feira, 20 de Fevereiro de 2015 às 00:08:32 UTC, Vijay Khemlani > escreveu: >> >> There's no "range" in django templates, you just use >> >> {% for elem in sols %} >> >> Regard

Re: Design question: Is it really a good idea for models having “side effects”?

2015-02-20 Thread Vijay Khemlani
I'm not sure if there's an official stance on that, but I believe that since Django is a "MVT" framework, that kind of logic does not seem to be appropiate neither for templates nor views, so models seem like the logical choice. That way you can also make sure that the side-effect that you want to

Re: Transcode video using celery and ffmpeg in django

2015-02-20 Thread Vijay Khemlani
hat I > can use ffmpeg code (subprocess.call('ffmpeg -i path/.../original > path/.../mp4_720') to transcode. > > Thank you. > > On Fri, Feb 20, 2015 at 6:49 PM, Vijay Khemlani > wrote: > >> Then in your task function you can get the file from the video model >&g

Re: html response to be loaded in a div

2015-02-20 Thread Vijay Khemlani
If you're using jQuery 1.5.1 or above you can do this instead // using jQuery function getCookie(name) { var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) {

Re: How to filter results using forms in Django/Python (best approach) ?

2015-02-20 Thread Vijay Khemlani
It's not clear what's the purpose of the view you are showing. ¿Is it supposed to display a form with "haircolor" and "status" fields and filter the results it displays based on that? In that case you can declare a form: from django import forms class ScreeningForm(forms.Form): haircolor = f

Re: Create a new object for the newly registered user

2015-02-20 Thread Vijay Khemlani
You can use a post_save signal for the User Model https://docs.djangoproject.com/en/1.7/ref/signals/#post-save from django.db.models.signals import post_save from django.contrib.auth.models import User def create_about(sender, **kwargs): user = kwargs['instance'] if kwargs['created']:

Re: How to filter results using forms in Django/Python (best approach) ?

2015-02-21 Thread Vijay Khemlani
lors) > > And I don't know how to make this in my detailview. > > See the link: > http://stackoverflow.com/questions/28637326/how-to-filter-results-using-forms-in-django-best-approach > > Thanks > > Em sábado, 21 de fevereiro de 2015 00:33:34 UTC-2, Vijay Khemlani es

Re: How to filter results using forms in Django/Python (best approach) ?

2015-02-22 Thread Vijay Khemlani
ke it? > > Please, email me so we can discuss about it or add me in skype: > bahiamartins > > Thanks very much > > Em sábado, 21 de fevereiro de 2015 20:49:21 UTC-2, Vijay Khemlani escreveu: >> >> If both forms are used in the same view, I see little reason to make t

Re: How to filter results using forms in Django/Python (best approach) ?

2015-02-23 Thread Vijay Khemlani
//stackoverflow.com/questions/28637326/how-to-filter-results-using-forms-in-django-best-approach > > *Ronaldo Bahia * > Diretor | JobConvo.com > Tel: 11 3280 6971 > > 2015-02-22 23:16 GMT-03:00 Vijay Khemlani : > >> Well, I think you can continue posting the updated code her

Re: How to filter results using forms in Django/Python (best approach) ?

2015-02-23 Thread Vijay Khemlani
to write is: > > def filter_job_candidates(job): > assert self.is_valid() > job_candidates = Job.objects.applied_to.all() > > Or am I wrong? > > Sorry for bothering... > > > > Em segunda-feira, 23 de fevereiro de 2015 10:50:49 UTC-3, Vijay Khemlani > escreve

Re: How to filter results using forms in Django/Python (best approach) ?

2015-02-23 Thread Vijay Khemlani
gument (2 given) >>> >>> in views.py >>> >>> job_candidates = form_cand.filter_job_candidates(self.object) >>> >>> I've tried to remove the arguments but django says "global name 'self' >>> not defined" >>

Re: Python / Django slow ? Deciding my next technological stack

2015-02-24 Thread Vijay Khemlani
It's true that the Global Interpreter Lock will prevent threads from a single process from running concurrently, but your server (uWSGI, gunicorn, etc) will spawn multiple process that don't conflict with the GIL. Also, if you need some form of multiprocessing celery is a good choice, and one that

Re: Read a csv file and save data in postgresql

2015-02-24 Thread Vijay Khemlani
Parsing a CSV file is not a particularly hard thing to do https://docs.python.org/2/library/csv.html You can change the example to read from the file in your model an instead of printing to the console, to store it in the database. On Tue, Feb 24, 2015 at 8:53 PM, elcaiaimar wrote: > Hello, >

Re: Django GUI Frameworks?

2015-02-24 Thread Vijay Khemlani
Old platforms such as ASP.NET "Classic" (not MVC) have some sort of widgets (Web Forms in the case of of ASP) that rendered very customized (and very ugly) HTML that "worked" with their backend. The trend nowadays is to separate the backend and frontend as much as posible, allowing any frontend fr

Re: Using Signals - request_finished

2015-02-25 Thread Vijay Khemlani
is the signals.py module being loaded at some point? If it isn't, then the connect function is never being called. On Wed, Feb 25, 2015 at 2:01 PM, Rootz wrote: > I have tried using the request_finished signal but nothing happens when I > tried testing it. > What suggestions or recommendations

Re: Python / Django slow ? Deciding my next technological stack

2015-03-01 Thread Vijay Khemlani
The rest of the uWSGI / gunicorn / whatever workers are available to handle the other requests. If there are so many uploads that all of the workers are busy then there are ways to upload files directly to Amazon S3 (for example) from the browser without going through your server. On Sun, Mar 1,

Re: Different between Object-save and form-save

2015-03-01 Thread Vijay Khemlani
Both save the user to the database, but "user_form.save()" leaves the user password in plain text (which won't work when the user tries to login later) so the password must be set correctly (user.set_password(user.password)) and then the user has to be saved again for the correct (hashed) password

Re: django doesnt wait for my time.sleep

2015-03-04 Thread Vijay Khemlani
Also, why would matplotlib return without having finished its job? On Wed, Mar 4, 2015 at 2:58 PM, Bill Freeman wrote: > Sleeping in a web server, which potentially has many users, is considered > bad form, even if it works. A better place for such time outs is in > JavaScript in the browser.

Re: File Upload, Download and Search Files

2015-03-04 Thread Vijay Khemlani
You can save files as part of models, for example using FileFields https://docs.djangoproject.com/en/1.7/ref/models/fields/#filefield Or you can handle them manually, for example using default_storage https://docs.djangoproject.com/en/1.7/topics/files/ Regarding File Search, I don't know, never

Re: TemplateSyntaxError with {% cycle "Hello, how are you?" "Fine!" %}

2015-03-05 Thread Vijay Khemlani
Changing the double quotes for single quotes seems to do the trick, but I don't know why it works On Thu, Mar 5, 2015 at 1:24 PM, Carsten Fuchs wrote: > Dear Django fellows, > > using Django 1.7.5, I have a problem with commas in string literals in the > cycle tag, e.g. with > > {% cycle "He

Re: Fatal Error in initializing sys standard streams

2015-03-06 Thread Vijay Khemlani
Your first command (wget ...) failed because wget does not exist on Windows I think weakrefset is available in pip, why not try to install it that way? On Fri, Mar 6, 2015 at 9:36 PM, Collin Anderson wrote: > Hi, > > That doesn't look good :) > > Maybe try reinstalling python. > > Collin > > On

Re: Detecting modifications in ManyToMany field

2015-03-07 Thread Vijay Khemlani
You might find the m2m_changed signal useful https://docs.djangoproject.com/en/1.7/ref/signals/#m2m-changed On Sat, Mar 7, 2015 at 7:57 AM, Fabien Schwob wrote: > Hello, > > I would like to detect changes in a ManyToMany field, to update data > in the linked Model. I've two objects : > > class

Re: Detecting modifications in ManyToMany field

2015-03-07 Thread Vijay Khemlani
You might find the m2m_changed signal useful https://docs.djangoproject.com/en/1.7/ref/signals/#m2m-changed On Sat, Mar 7, 2015 at 7:57 AM, Fabien Schwob wrote: > Hello, > > I would like to detect changes in a ManyToMany field, to update data > in the linked Model. I've two objects : > > class

Re: FORM: How to specify current user as value for a form ForeignKey referencing logged on user

2015-03-08 Thread Vijay Khemlani
If you are using a modelform then you don't need to re-define the original model fields, in this case Class AccountForm(forms.ModelForm): class Meta: model = Accounts fields = ['authid', 'authtoken', 'provider'] You leave the "user" field out as it is not part of the form itse

Re: Detecting modifications in ManyToMany field

2015-03-08 Thread Vijay Khemlani
ange. > On sam. 7 mars 2015 at 16:53 Vijay Khemlani wrote: > >> You might find the m2m_changed signal useful >> >> https://docs.djangoproject.com/en/1.7/ref/signals/#m2m-changed >> On Sat, Mar 7, 2015 at 7:57 AM, Fabien Schwob wrote: >> >>> Hello, >&g

Re: Binding hand written HTML(form) or forms that are not created through djnago forms to django forms validation errors

2015-03-10 Thread Vijay Khemlani
Unbound forms have no validation errors as they haven't been filled yet by the user. I think you are trying to solve the wrong problem. Why are you creating your form manually in the first place? Your HTML markup is easy to do with Django forms and packages suck as crispy forms On Tue, Mar 10, 20

Re: How to make responsinator.com working with Django?

2015-03-10 Thread Vijay Khemlani
Your question is how to make a responsive website or something else? On Tue, Mar 10, 2015 at 12:05 PM, inoyon artlover KLANGRAUSCH < inoyonartlo...@googlemail.com> wrote: > Hi there, > > how can I get Django working with responsinator.com ? > > Best regards! :) > > -- > You received this message

Re: How to track number of visitors on django site

2015-03-10 Thread Vijay Khemlani
Hmmm... what about the classic Google Analytics? On Tue, Mar 10, 2015 at 5:04 PM, Andreas Kuhne wrote: > Hi all, > > I would like to be able to track the number of visitors on our website. We > previously had django-tracking installed and a munin node that tracked the > information. Unfortunatel

Re: Can't perform Querying using Q objects

2015-03-11 Thread Vijay Khemlani
using the state__state_name and > city__city_name relations Django INNER JOIN removes the shop without > existing relation from the result. > >On Wednesday, March 11, 2015 at 8:22:55 PM UTC+5:30, Vijay Khemlani > wrote: >> >> At least when using Postgres that query makes a LEFT

Re: Can't perform Querying using Q objects

2015-03-12 Thread Vijay Khemlani
At least when using Postgres that query makes a LEFT OUTER JOIN so it shouldn't discard Shops just because they don't have a state or city. So your query seems to be OK are you sure your search text is fine? the orm will not automatically strip the search_text into a list of keywords or things li

Re: {{STATIC_URL }} or {% static "...." %} What`s the correct to use?

2015-03-19 Thread Vijay Khemlani
What URL is being generated in the final HTML?, and does that path match the one you have in the static folder in your app? Also, if your are on debug mode, you don't need to run collectstatic On Thu, Mar 19, 2015 at 10:19 PM, Fellipe Henrique wrote: > Thanks, but I already try the docs, but my

Re: {{STATIC_URL }} or {% static "...." %} What`s the correct to use?

2015-03-20 Thread Vijay Khemlani
You don't need special rules in the URL config to serve static files in development as far as I know so you have a route to "/static/public/css/bootstrap.min.css" and I assume that when you try to access http://localhost:8000/static/public/css/bootstrap.min.css you get a 404 error Where is boot

Re: {{STATIC_URL }} or {% static "...." %} What`s the correct to use?

2015-03-20 Thread Vijay Khemlani
Soo when you open your webpage, look at its source code, click on the "/static/public/css/bootstrap.min.css" path it shows the file in Firefox? On Fri, Mar 20, 2015 at 11:37 AM, Néstor wrote: > Is it OK to have this syntax? > href="{% static "public/css/bootstrap.min.css" %}"> > > Should y

Re: {{STATIC_URL }} or {% static "...." %} What`s the correct to use?

2015-03-20 Thread Vijay Khemlani
0, 2015 at 11:43 AM, Vijay Khemlani > wrote: > >> Soo when you open your webpage, look at its source code, click on the >> "/static/public/css/bootstrap.min.css" path it shows the file in Firefox? >> > > Yes.. when I open source code in firefox, c

Re: templates tags works in scripts sections of the html?

2015-03-20 Thread Vijay Khemlani
It works, but the javascript you are generating has syntax errors. For example, you are missing the commas after every element. Either way, dumping variables directly from django templates to JavaScript is not very elegant, you could make a JSON object in the view beforehand json_tags = json.dum

Re: Why is appearance of admin page so different between development and deployment servers?

2015-03-21 Thread Vijay Khemlani
They should look exactly the same are all the static files (CSS / JS) being loaded correctly in production? On Sat, Mar 21, 2015 at 8:27 PM, talex wrote: > While using the Django development server, I like the appearance of the > admin site from django.contrib. After deploying the application

Re: migrations don't work

2015-03-22 Thread Vijay Khemlani
Judging from the makemigrations output, you deleted a model (User) but also added it as a foreignkey field to another model (Persona), is that what you wanted? On Sun, Mar 22, 2015 at 3:16 PM, wrote: > Hi, > > makemigrations works but migrate does not: > > [xan@mercuri gargamella]$ python manage

Re: templates tags works in scripts sections of the html?

2015-03-23 Thread Vijay Khemlani
JSON is literally the notation for objects and arrays in JavaScript, when you "print" it it outputs valid JavaScript code. On Mon, Mar 23, 2015 at 11:59 AM, dk wrote: > AHHH!!!... > that make scenes that the java script did work when I did it manually. > I haven't use json files before, so

Re: Image in Form Field

2015-03-23 Thread Vijay Khemlani
You can't include images in the options of a typycal html dropdown To do so you need to use JavaScript, for example this plugin http://designwithpc.com/plugins/ddslick#demo And pass the options in the format specified by the plugin On Mon, Mar 23, 2015 at 1:51 PM, Sandeep kaur wrote: > Anybod

Re: How to create a multi valued field in the model?

2015-03-23 Thread Vijay Khemlani
You can use an IntegerField with choices https://docs.djangoproject.com/en/1.7/ref/models/fields/#choices On Mon, Mar 23, 2015 at 4:28 PM, Daniel Grace wrote: > How to create a field with multiple values? For example an integer field > that takes on particular values: > > state = models.Intege

Re: multiple parameters search

2015-03-23 Thread Vijay Khemlani
from django.db.models import Q User.object.get(Q(username=myusername) | Q(email=myEmail)) On Mon, Mar 23, 2015 at 9:30 PM, nobody wrote: > Hi, > > How can I search the database using multiple parameters similar like > "where username ="myUserName" or email = "MyEmail"? > > I tried to run User.o

Re: Django Http post and csrf error

2015-03-30 Thread Vijay Khemlani
To prevent the CSRF validation you can use the csrf_exempt decorator https://docs.djangoproject.com/en/1.7/ref/contrib/csrf/#utilities The normal way to handle a POST request is to issue a redirect (HTTP 302) after handling the request, but if it is an automated request I guess you can return an

Re: encode url

2015-03-31 Thread Vijay Khemlani
you want to encode them before they are submitted to the server? why? On Tue, Mar 31, 2015 at 1:23 PM, Pnelson wrote: > Im trying to learn django and i have a form in html that have 3 arguments > (app_id,user_id and username) and i want to encode those 3 arguments in > base64. > > views.py > > d

Re: Help with: Django 'ModelForm' object has no attribute 'cleaned_data' for M2M through

2015-04-02 Thread Vijay Khemlani
Call form.is_valid() (and check that it returns True) before accessing form.cleaned_data On Thu, Apr 2, 2015 at 9:36 AM, Ronaldo Bahia wrote: > > Hi every one. > > Can you help me in this? > > > http://stackoverflow.com/questions/29413107/django-modelform-object-has-no-attribute-cleaned-data-for

Re: Help with: Django 'ModelForm' object has no attribute 'cleaned_data' for M2M through

2015-04-02 Thread Vijay Khemlani
ahia wrote: > Thanks. Solved cleaned_data issue. > > Now I getting: > > Cannot assign "u'2'": "CandidateToJob.job" must be a "Job" instance. > > Or > > Cannot assign "u'Title'": "CandidateToJob.job" must b

Re: Help with: Django 'ModelForm' object has no attribute 'cleaned_data' for M2M through

2015-04-02 Thread Vijay Khemlani
post your updated code On Thu, Apr 2, 2015 at 1:06 PM, Ronaldo Bahia wrote: > Dont know why but I still get the same error > > Ronaldo Bahia > > Em 02/04/2015, às 10:50, Vijay Khemlani escreveu: > > In your Form class "job" is a ChoiceField, and it returns

Re: Help with: Django 'ModelForm' object has no attribute 'cleaned_data' for M2M through

2015-04-02 Thread Vijay Khemlani
gt; *Ronaldo Bahia * > Diretor | JobConvo.com > Tel: 11 3280 6971 > > 2015-04-02 13:15 GMT-03:00 Vijay Khemlani : > >> post your updated code >> >> On Thu, Apr 2, 2015 at 1:06 PM, Ronaldo Bahia >> wrote: >> >>> Dont know why but I still get the

Re: How can I work with pyserial and django form?

2015-04-05 Thread Vijay Khemlani
What are you trying to do exactly? On Sun, Apr 5, 2015 at 10:27 AM, José Jesús Palacios wrote: > How can I work with pyserial and django form to read from serial to > field? > Is it possible? > > Thanks to everyone. > > -- > You received this message because you are subscribed to the Google Gro

Re: How can I work with pyserial and django form?

2015-04-06 Thread Vijay Khemlani
n be a weight of weighbridge, number of car plate or reading a > barcode. > Outside the browser, It's not problem, but I want to use it as user > interface. > > El domingo, 5 de abril de 2015, 19:55:02 (UTC+2), Vijay Khemlani escribió: >> >> What are you trying to do exac

Re: Alternatives to Django REST Framework

2015-04-09 Thread Vijay Khemlani
If you don't need the advanced features of Django or REST framework it's easy to ignore them, it's not like they require tons of resources or configuration files to work. On Thu, Apr 9, 2015 at 10:24 AM, graeme wrote: > If you do not need Django at all, Flask or Bottle. > > If you are going to u

Re: Trying to avoid using the "eval" command/statement

2015-04-15 Thread Vijay Khemlani
You can use get_model from django.db.models.loading import get_model YourModel = get_model('your_app', tableName) On Wed, Apr 15, 2015 at 2:01 PM, Tim Chase wrote: > On 2015-04-15 09:45, Henry Versemann wrote: > > My problem is since the logic won't know which tables will be in > > the incomin

Re: Trying to avoid using the "eval" command/statement

2015-04-15 Thread Vijay Khemlani
n I print the size or contents (table objects format (the objects are > listed like this: > > > > ) no internal value to see) of the tblEntryLst everything looks right. > Is there anything you can suggest for determining where the problem might > be? > > Than

Re: Django Userena 'OrderedDict' object has no attribute 'keyOrder'

2015-04-16 Thread Vijay Khemlani
In the title: "'OrderedDict' object has no attribute 'keyOrder'" On Thu, Apr 16, 2015 at 6:13 AM, Pavel Kuchin wrote: > Hi Willy, > > Can you send an error, because I see only the SignupFormExtra class. > > Yours sincerely, > Pavel > > четверг, 16 апреля 2015 г., 1:41:47 UTC+3 пользователь willy

Re: Django Userena 'OrderedDict' object has no attribute 'keyOrder'

2015-04-16 Thread Vijay Khemlani
s/forms.py > ) > The self.fields.keyOrder does not work anymore, django-userena has an > obsolete documentation. > Try to remove def __init__(self, *args, **kw): from your class, > ordering should be based on fields definition order. > > Best regards, > Pavel > > 2015-04-16

Re: Serialize QuerySet Q (not the result)

2015-04-20 Thread Vijay Khemlani
Are the queries associated with a certain form? Or they are arbitrary queries? On Mon, Apr 20, 2015 at 10:01 AM, guettli wrote: > We want to store the QuerySet query (not the result) some how. > > Background: users should be able to save a complex query as "my favorite > query". > > Pickling que

Re: Choices as a callable.. but no parameters?

2015-04-20 Thread Vijay Khemlani
Overwrite the constructor of the form (__init__), pass the user or whatever parameters you may need and overwrite the choices of the field in the body of the method. On Mon, Apr 20, 2015 at 10:56 PM, Steve Hiemstra wrote: > I am trying to build a form with dynamic choices. e.g., the choices shou

  1   2   3   4   >