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
candidate.messages_sent = sent_messages.get( candidate.candidate.user.id) candidates.append(candidate) context['candidate_list'] = candidates context['form'] = form return context On Sat, Feb 21, 2015 at 9:57 AM, Ronaldo Bahia wrote: > Hi Vija

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

2015-02-22 Thread Vijay Khemlani
, Feb 22, 2015 at 10:53 PM, Ronaldo Bahia wrote: > Vijay, > > For some reason, I'm getting SyntaxError with self.cleaned_data in > forms.py > > I'd like you to teach me how to make this. I have no problem to share my > project code. > > Do you think we can ma

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
You're welcome, glad I could help :D On Mon, Feb 23, 2015 at 5:25 PM, Ronaldo Bahia wrote: > Awesome! Now it works perfectly. > > I'm updating my stackoverflow code for anyone facing the same doubt. > > Thanks a lot man > > > Em segunda-feira, 23 de fever

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
At least when I tested a similar query it makes an OUTER JOIN, not an INNER JOIN What's the actual SQL command being executed? print Shops.objects.filter(...).query On Wed, Mar 11, 2015 at 1:19 PM, Ajay M wrote: > Hi Vijay, > The search text is okay.. I think when

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
tblEntryObj seems to be an instance of your model, it is not a dictionary, so normally it wouldn't have a "keys" method. On Wed, Apr 15, 2015 at 5:32 PM, Henry Versemann wrote: > Vijay, > > I tried your method, and while it got me the table class that I wanted, > fo

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
Why are you talking to me? I'm not OP xD On Thu, Apr 16, 2015 at 9:57 AM, Pavel Kuchin wrote: > Hi Vijay, > > Looks like Django does not use SortedDict anymore > ( > https://github.com/django/django/commit/07876cf02b6db453ca0397c29c225668872fa96d#django/form

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

Re: Serialize QuerySet Q (not the result)

2015-04-21 Thread Vijay Khemlani
Do you only need to serialize Q objects? No aggregation / annotations? On Tue, Apr 21, 2015 at 8:00 AM, guettli wrote: > > > Am Montag, 20. April 2015 17:12:21 UTC+2 schrieb Vijay Khemlani: >> >> Are the queries associated with a certain form? Or they are arbitrary >

Re: Difficulty in passing positional arguments in url !!!

2015-04-21 Thread Vijay Khemlani
I think it's better to pass the email as a query parameter instead of in the path /acceptfriend/?email=hpenvy%40hp.com Or even better, use a POST request, since it seems the request will touch the DB and have side effects. On Tue, Apr 21, 2015 at 6:02 PM, Bill Freeman wrote: > The @ in the ema

Re: Form to create several objects with one-to-one relation

2015-04-21 Thread Vijay Khemlani
What about and old-school DetailView? def get_context_data -> Creates the two forms and puts them in the context def post -> Validates and process the forms On Tue, Apr 21, 2015 at 7:41 PM, Ilya Kazakevich wrote: > Hello, > > I have several models with one-to-one relation. For example > > cl

Re: Strange error in django

2015-04-22 Thread Vijay Khemlani
What specific version of Python are you using (2.7...x?) On Wed, Apr 22, 2015 at 8:26 PM, John DeRosa wrote: > Oh, sorry. > > Well, you’re using joblib. The joblib.load() call loads something and > return a Python object into the symbol clf. > > It would seem you need to look at the object that

Re: 'type' object is not iterable when I use any decorators

2015-05-03 Thread Vijay Khemlani
user_passes_test is for decorating functions, not classes Django Rest Framework has its own system for permissions (and you seem to be already using it) http://www.django-rest-framework.org/api-guide/permissions/ Use that instead I think On Sun, May 3, 2015 at 2:35 PM, Shekar Tippur wrote: >

Re: Creating User object with is_active = False

2015-05-03 Thread Vijay Khemlani
The line that's failing is not for the User model, but for the BeeradUser model. Assuming this is your same model http://stackoverflow.com/questions/29913814/creating-new-account-with-or-without-modelforms-and-designing-with-html-css Then I guess you have a "is_active" field in the BeeradUser mo

Re: Firing an html file from within a view/template

2015-05-06 Thread Vijay Khemlani
The paths inside statcosti.html are absolute to the filesystem of your machine, so they don't make sense for the web server For example resolves to (asuming localhost at port 8000) http://localhost:8000/var/www/magazantea/templates/R2HTML/grafico2.png So your browser makes a request to Django

Re: How to get a application-formpost in django view? Get QueryDict variables.

2015-05-21 Thread Vijay Khemlani
Maybe the brackets confuse the querydict, try calling its items method (to convert it into a list of tuples) or its dict method (to turn it into a normal python dict) On Thu, May 21, 2015 at 3:34 PM, Fellipe Henrique wrote: > Any ideas? > > I finish all my possibilities in these problem.. :( and

Re: Checked checkboxes show as check on dev server, but not as checked on production server.

2015-05-23 Thread Vijay Khemlani
Try posting the source code involved (model, view, template, maybe a form if there is one) because just by your description is kinda hard to check what is wrong. On Sat, May 23, 2015 at 3:11 AM, gabn88 wrote: > I have multiple checkboxes which are coming from a model with a single > value. This

Re: Changing a form field's value during cleaning

2015-05-26 Thread Vijay Khemlani
If some of the fields are "already approved" and thus they can't be edited, why are you rendering those as editable form fields in the first place? On Tue, May 26, 2015 at 9:55 PM, Gergely Polonkai wrote: > Hello, > > I'm currently having hard times changing a form field's value from within > th

Re: how to get get-pip.py

2015-06-02 Thread Vijay Khemlani
https://pip.pypa.io/en/latest/installing.html On Tue, Jun 2, 2015 at 7:37 PM, Steve Burrus wrote: > how do I get get-pip.py? > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails f

Re: django subprocess doesnt like sleep

2015-06-05 Thread Vijay Khemlani
I don't think you should be doing that kind of work in the web server process. If you want to run a task that may take a long time to finish then use celery or something like that. On Fri, Jun 5, 2015 at 1:34 PM, dk wrote: > this is what I got from putting > *time.sleep(60)* > *print "s

Re: Keep selected option after form submission

2015-06-09 Thread Vijay Khemlani
It doesn't answer the question, but why don't you want to render the field automatically? On Tue, Jun 9, 2015 at 6:47 PM, wrote: > Hi, > > I have the same problem of this guy ( > http://stackoverflow.com/questions/21884631/keeping-option-selected-after-form-is-submitted-in-django), > but I do no

Re: Presenting percents of Model values in simple templates?

2015-06-10 Thread Vijay Khemlani
You can add methods to your model class class Container(models.Model): name = models.CharField(max_length=128) capacity = models.IntegerField() contains = models.IntegerField() def usage_percentage(): return 100.0 * self.contains / self.capacity And in your template {% i

Re: Where is the best place to get assistance installing Red Hat, Oracle and Django onto a VPN?

2015-06-10 Thread Vijay Khemlani
Wihtout knowing anything about your project, I think going RedHat + Oracle might be a bit overkill, especially Oracle since it is a mess to configure and tune. Have you considered CentOS as an alternative? same binaries and libraries as RedHat but completely free, and also easier to deploy in the

Re: Keep selected option after form submission

2015-06-10 Thread Vijay Khemlani
Subclassing the django.forms.widgets.Select class and setting it as a widget for the form field. On Wed, Jun 10, 2015 at 2:13 PM, wrote: > I decided to use {{ form.activity }} instead of that code above, but it is > a bit strange, it should work in that way. > > Now, I'm using django-widget-twea

Re: Get the first image src from a post

2015-06-15 Thread Vijay Khemlani
If the description is stored as HTML I guess you could use something like BeautifulSoup or pyquery to parse it and find the tag from bs4 import BeautifulSoup soup = BeautifulSoup(blog.description) image_src = soup.find('img')['src'] On Mon, Jun 15, 2015 at 8:59 AM, Robin Lery wrote: > I have

Re: django Object not iterable error

2015-06-15 Thread Vijay Khemlani
No, you need to post the parts of your code that may have triggered the error. In this case, your urls.py and the method in your views.py that handles the request probably. On Mon, Jun 15, 2015 at 9:32 PM, Shekar Tippur wrote: > James, > > Is this what you mean? > > - Shekar > > >> Environment:

Re: Preferred way of adding social authorization to a Django / REST app?

2015-06-18 Thread Vijay Khemlani
the package is called "rest-framework" and it includes the authtoken app http://www.django-rest-framework.org/api-guide/authentication/ INSTALLED_APPS = ( ... 'rest_framework.authtoken' ) On Thu, Jun 18, 2015 at 3:00 PM, Daniel Grace wrote: > What is the preferred way of adding social

Re: Ready to throw the keyboard using Django 1.7 on Windows 7

2015-06-19 Thread Vijay Khemlani
How is your project folder structure? If you open a normal python shell from the same directory as your manage.py and execute "import myapp.settings" what does it say? On Fri, Jun 19, 2015 at 1:16 PM, Todd Kovalsky wrote: > Having a miserable time trying to get a django site running on a wintel

Re: ValueError: No JSON object could be decoded

2015-06-21 Thread Vijay Khemlani
What is the actual content of request.body? (as in, "print request.body") On Sun, Jun 21, 2015 at 9:26 AM, Dhaval M wrote: > Thank you in advance for any help (this is my first post to this community) > > I am using Django as my application server for my project. I am new to web > development so

Re: Model cache problem

2015-06-25 Thread Vijay Khemlani
Are you using a ModelChoiceField? https://docs.djangoproject.com/en/1.8/ref/forms/fields/#modelchoicefield Or a normal ChoiceField setting the choices manually? On Thu, Jun 25, 2015 at 11:28 AM, dragon wrote: > Hi! > > I have a form with a choice field. I fill it from a model let's name it > A

Re: Creating model (table) inheritance in Django 1.8 using PostgreSQL

2015-07-02 Thread Vijay Khemlani
You could dynamically create a ModelForm based on the model class: from django.forms import ModelForm MetaClass = type('Meta', (), {'model': ProductItemText}) MetaModelForm = type('ProductModelForm', (ModelForm, ), {'Meta': MetaClass}) form = MetaModelForm() The only thing you would need is th

Re: Models and relationships

2015-07-06 Thread Vijay Khemlani
Try with Contact.objects.all()[0] On Mon, Jul 6, 2015 at 1:03 PM, Chris Strasser wrote: > I tried and this happens: > > from main.models import Contact > > >>> contact = Contact.all()[0] > > Traceback (most recent call last): > > File "", line 1, in > > AttributeError: type object 'Contact'

Re: loop a ChoiceField SelectMultiple form in the view as post

2015-07-13 Thread Vijay Khemlani
To tell you the truth I'm not quite sure what are you trying to accomplish, but for starters if you have a select multiple widget then your form field should be a forms.MultipleChoiceField On Mon, Jul 13, 2015 at 4:38 PM, dk wrote: > I made a quick project with an app, that might be easier to s

Re: Celery to process task and modify the model fields

2015-07-14 Thread Vijay Khemlani
I remember this question from... february I think, what's changed since then? On Tue, Jul 14, 2015 at 3:29 PM, Robin Lery wrote: > I would like to convert video into mp4 using ffmpeg and celery for the > asynchronous task. When user uploads a video, it will be for the > original_video and save i

Re: Easy to use graphical reporting tools for SQL

2015-07-21 Thread Vijay Khemlani
I guess any kind of report they want to generate will require some knowledge of relational databases. Considering that, I think Jasper Reports is a good tradeoff, It has a graphical interface to create the queries, and the reports can be accessed by anyone after it's query and design is done. On

Re: Question on url routing

2014-10-10 Thread Vijay Khemlani
I think in those cases you would need to add some custom logic to your view to check whether the URL is valid for the "step" the user is in the workflow. On Fri, Oct 10, 2014 at 10:47 AM, robert brook wrote: > I know how to detect an ajax request. > > I am interested int the general issue of the

Re: Unable to access view variable

2014-10-16 Thread Vijay Khemlani
You need to pass a dictionary as a second parameter to the render_to_response method with the variables that you wish to access in the template. for example: return render_to_response('index.html', {"people_info": pers}) that way you can access the variable "people_info" in the template. On Th

Re: Unable to store static

2014-10-16 Thread Vijay Khemlani
It would be useful to see the path rendered in the final HTML in the document, as it could be related to the "STATIC_URL" setting or some other cause. On Thu, Oct 16, 2014 at 11:44 AM, Babatunde Akinyanmi wrote: > > On 16 Oct 2014 15:36, tundeba...@gmail.com wrote: > > > > Hi, > > > %}" /> > >

Re: Generic Views and Django.contrib.auth

2014-10-16 Thread Vijay Khemlani
If you are usign class based generic views you can use the decorators in the URL config of your app, for example urlpatterns = patterns('', (r'^about/', login_required(AboutView.as_view())), ) On Thu, Oct 16, 2014 at 12:49 PM, Rootz wrote: > Can I use both Generic View and the Django.contr

Re: Unable to store static

2014-10-16 Thread Vijay Khemlani
I agree, but we need to determine where the problem lies. is the STATIC_URL param OK? is the STATICFILES_DIRS setting correct? I think the starting point is checking whether the url to the static asset is being determined correctly and then move forward. On Thu, Oct 16, 2014 at 3:00 PM, Daniel R

<    1   2   3   4   5   >