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

Re: how to update data in FK fields another Model

2014-10-16 Thread Vijay Khemlani
I think the argument to the F object should be just the name of the field on ModelA: product.field_count = F('field_count') + 1 Other than that, there are a few weird things about the code, for example: product = ModelA.objects.get(id=self.fk_name.id) Why not just use product = sel

Re: how to update data in FK fields another Model

2014-10-16 Thread Vijay Khemlani
working no increment the field_count :/ any > other idea > > Cheers > > On Thu, Oct 16, 2014 at 2:44 PM, Vijay Khemlani > wrote: > >> I think the argument to the F object should be just the name of the field >> on ModelA: >> >> product.field_coun

Re: NoReverseMatch error

2014-10-18 Thread Vijay Khemlani
I think you need to pass the "type" and "state" values in the {% url ... %} tag https://docs.djangoproject.com/en/1.7/ref/templates/builtins/#url On Sat, Oct 18, 2014 at 6:06 PM, Daniel Grace wrote: > Hi, > I get the following error on one of my view forms: > Request Method: GET > Request URL:

Re: Django model complex query ( use table A.column1 as parameter to query result from table B)

2014-10-21 Thread Vijay Khemlani
I think you are trying to establish a many-to-many relationship between the models, that way it would be like this poiRes = models.ManyToManyField(POIS) and the candidatePois is unnecessary in that case. On Tue, Oct 21, 2014 at 3:16 PM, zhang rock wrote: > Hi All, > > I have a question: how

Re: TypeError: can't concat bytes to tuple

2014-10-27 Thread Vijay Khemlani
Well, this is not a Django-related question, but still. The tutorial you are following uses Python 2.5.1, which differs a lot from the Python 3.4 that you are using. If you want to still follow that tutorial you'd better install Python 2.7, which is more compatible with 2.5 Also, try printing the

Re: How not to explicly write very very big json object when rendering page in django template ?

2014-11-02 Thread Vijay Khemlani
Do you really need all the data in that dictionary for the page? You could request the necessary parts by AJAX after the page has loaded. On Sun, Nov 2, 2014 at 6:59 PM, Matlau Issu wrote: > I mean, in my views.py i do : > return render(request, 'myapp/detail.html', { pydic_jsonized : > json.du

Re: DecimalField returns 'This value must be a decimal number' when blank

2014-11-16 Thread Vijay Khemlani
I'm not sure if a syncdb changes the null attribute of a field at the DB level, I think you need to make a migration for that. Either way, it would be useful if you could post the declarations of the form and the model to see if everything is ok. On Sun, Nov 16, 2014 at 2:51 PM, elcaiaimar wrote

Re: Form doesn't show in HTML template

2014-11-20 Thread Vijay Khemlani
If you set the settings TEMPLATE_DEBUG to True, does it display any errors? On Thu, Nov 20, 2014 at 6:39 PM, Some Developer wrote: > On 20/11/14 21:15, James Schneider wrote: > >> Dumb question, but there is a "main_content" block in base.html, right? >> >> I'm assuming the "Please register..."

Re: Form doesn't show in HTML template

2014-11-21 Thread Vijay Khemlani
If you manually call the form "as_p" method in the view (not the template), does it print the form? On Fri, Nov 21, 2014 at 12:28 PM, Some Developer wrote: > On 20/11/14 22:07, Vijay Khemlani wrote: > >> If you set the settings TEMPLATE_DEBUG to True, does it display any

Re: Using Sum() for a models method inside a Query

2014-11-23 Thread Vijay Khemlani
What do you mean by the sum or average of the method? As in the sum or average of the method applied to a list of objects "X"? On Sun, Nov 23, 2014 at 7:41 PM, Jorge Andrés Vergara Ebratt < javebr...@gmail.com> wrote: > Hello everyone, > > Well, the tittle says it all: > > I have a model X > > cl

Re: How to make database queries that “filters” results according to tuples of values?

2014-11-26 Thread Vijay Khemlani
I think you could construct a Q object like this: from django.db.models import Q query = Q() for preference in user.preferences.all(): query |= Q(dish=preference.dish) & Q(ingredient=preference.ingredient) Meal.objects.filter(query) That returns the meals where their (ingredient, dish) comb

Re: Re: How to make database queries that “filters” results according to tuples of values?

2014-11-27 Thread Vijay Khemlani
known, that |= also could be used on Q(). > Thought Q is only there for making "or" "not" and so stuff of calls! Great! > > Best Regards, > Mike > > *Gesendet:* Mittwoch, 26. November 2014 um 20:30 Uhr > *Von:* "Vijay Khemlani" > *An:* django-

Re: Error: 'NoneType' object has no attribute 'strip'

2014-12-01 Thread Vijay Khemlani
Have you tried following the stacktrace that resulted in the error? Does it fail when trying to strip the contents of the "name" field? On Mon, Dec 1, 2014 at 10:16 AM, Danish Ali wrote: > I am using admin to enter data. > This is the URL from where I am trying to save records: > http://127.0.0

Re: TypeError: unbound method save() must be called with NagiosLog instance as first argument (got nothing instead)

2014-12-06 Thread Vijay Khemlani
Call k.save() instad of NagiosLog.save() On Sat, Dec 6, 2014 at 8:26 AM, Phil F wrote: > Hi, > > I am attempting to write a python script that will populate the Django db > from data stored in a dictionary. > > I'm currently getting the error :"TypeError: unbound method save() must be > cal

Re: set current user value in Django admin for Foreign Key

2014-12-10 Thread Vijay Khemlani
Hmmm... why are you showing the user field in the first place? I would exclude it from the form and set it programatically after the user as submitted the form. On Wed, Dec 10, 2014 at 5:38 AM, Akshay Mukadam wrote: > Hi, > I just want to show the current logged in user in for foreign key in > D

Re: Need to search through several tables using one model

2014-12-12 Thread Vijay Khemlani
Just using the ORM I think not You could 1. Make a raw sql query using UNIONs for each table 2. Make a common superclass for the models with th search field 3. Use an external search engine (elasticsearch, etc) and store the entries for the required models under the same index. Finally, you co

Re: Need to search through several tables using one model

2014-12-13 Thread Vijay Khemlani
What search button are you talking about? On Sat, Dec 13, 2014 at 2:23 PM, Alon Nisser wrote: > > You could also create a model that foreign keys to all the relevant > models, and filter on that.. > Buy first you need to clarify (for your self..) The exact use case: is it > search? if so better u

Re: Need to search through several tables using one model

2014-12-15 Thread Vijay Khemlani
d search I think, I think it's need to overriden in order to implement >> custom model or something. >> >> On Sat, Dec 13, 2014 at 11:06 PM, Vijay Khemlani >> wrote: >>> >>> What search button are you talking about? >>> >>> On Sat, Dec

Re: how to connect parse.com with parse-rest

2014-12-15 Thread Vijay Khemlani
Are you running the dev server while having the viartualenv activated? On Mon, Dec 15, 2014 at 11:19 AM, Carlos Ons wrote: > > I cannot connect to parse.com with parse-rest API. > > I have a virtualenv installed and when I try to connect to parse.com It > is impossible. I made a basic app and the

Re: How can I add an attribute to each option in a django model form containing a foreign key?

2014-12-15 Thread Vijay Khemlani
If the crispy form is using the usual render methods of Django you can subclass the Select class (in forms/widgets.py), reimplement the "render_option" method and add the parameter to the returned HTML, then you can set the widget attribute of the form field to your created class. I don't know whe

Re: CBV with inline formset

2014-12-15 Thread Vijay Khemlani
Try changing the name of the parameter in the url from author_id to pk On Mon, Dec 15, 2014 at 5:39 PM, Brad Rice wrote: > > I've pretty much butchered the code for 3 days now and cannot figure out > how to insert an inline formset. Can anybody help me? > > I've tried to pare everything down to u

Re: ANN: Django website redesign launched

2014-12-17 Thread Vijay Khemlani
I really like the new design, the old one felt way too cluttered with too much information on the main page and overwhelmed new users. And... haters gonna hate. Congrats to the team! On Wed, Dec 17, 2014 at 10:37 AM, Daniele Procida wrote: > > On Wed, Dec 17, 2014, Rob wrote: > > >On Tuesday,

Re: Raw access to cache table

2014-12-18 Thread Vijay Khemlani
I'm not sure that using a cache system as a lock mechanism is a good idea. What I would do is setup a task queue (using celery and rabbitMQ) with a single worker, that way you guarantee that only one task is running at a time and you can queue as many as you want. Also, each task has a maximum lif

Re: filter Datetimefield

2014-12-21 Thread Vijay Khemlani
When you print the SQL query that is executed on the database print lista_de_balada.query Does it make sense? When you see the actual value stored in the database is it stored correctly? Also remember that the month and day are 1-based (january is 1, february is 2, etc) Suerte! :D On Sun, D

Re: How to capture any incorrect typing of a url and pass it to a default page

2014-12-24 Thread Vijay Khemlani
Try adding the *args and **kwargs parameters def my_default_2(request, *args, **kwargs): ... On Wed, Dec 24, 2014 at 1:15 PM, pythonista wrote: > I want to code the urls.py such that if someone types in any garbage inn > the browser the final line of the url router will grab the lin

Re: Two Django projects with common models and business logic

2014-12-24 Thread Vijay Khemlani
You can version it under a different repository, clone it in each server, and then add that path to the PYTHONPATH of each project, or just make a symbolic link to the app. On Wed, Dec 24, 2014 at 1:18 PM, andy wrote: > Thank you. Since it's only me that'd be using the apps do can I bypass the

Re: Storing files to Google Cloud Storage or Amazon S3 using Python 3.4

2014-12-27 Thread Vijay Khemlani
What error are you getting when using storages-redux? On Sat, Dec 27, 2014 at 5:15 PM, Some Developer wrote: > I know about Django storages (which is not compatible with Python 3.4) and > Django storages redux (which is compatible with Python 3.4 but gives an > error when trying to use it to syn

Re: delete OnetoOneField link

2014-12-30 Thread Vijay Khemlani
If you want to change a user's cashbox then yes, you would need to use your solution, but it's easier to get c1 by just saying c1 = user.cashbox instead of Cashbox.objects.get A more definite solution would be to add the OneToOne relation to the User model instead of the Cashbox object, but

Re: Can't save input to database

2014-12-30 Thread Vijay Khemlani
the code sample links are broken :( On Tue, Dec 30, 2014 at 4:59 PM, Thomas Lockhart wrote: > On 12/30/14 11:42 AM, Ronis wrote: > > Hi guys, I can't save the input from a custom form to database. I don't > know what I am missing. > > I'm not sure either. But the html form you posted looks a *l

Re: Write Multiple Text Files into a Single CSV File

2014-12-31 Thread Vijay Khemlani
I'm not too sure about the format of the content, but maybe this to create the file? import csv files = ['f1.txt', 'f2.txt', 'f3.txt'] with open('output.csv', 'wb') as f: writer = csv.writer(f) for input_file_name in files: with open(input_file_name, 'r') as input_file:

Re: Trying out django your first app.

2015-01-01 Thread Vijay Khemlani
For me the development server tends to throw that error at random, but does render the page correctly On Thu, Jan 1, 2015 at 2:22 PM, Joel Goldstick wrote: > > > On Thu, Jan 1, 2015 at 3:55 AM, Siddharth Shah > wrote: > >> Actually I was going through the first app example, >> https://docs.djan

Re: How to deplou 2 different django website in nginx?

2015-01-04 Thread Vijay Khemlani
as far as i know about nginx, server names are not separated by commas, just spaces. On Sun, Jan 4, 2015 at 3:51 PM, Fellipe Henrique wrote: > Hi there! > > I`m trying to make my nginx server work with 2 domains, with 2 different > django websites. > > So, I have a big, big problem here, becaus

Re: Expected performance of the django development server?

2015-01-05 Thread Vijay Khemlani
1189 queries is quite a large amount, are all of those really needed? I think some profiling is in order. On Mon, Jan 5, 2015 at 3:09 AM, Jani Tiainen wrote: > On Sun, 4 Jan 2015 20:41:58 -0800 (PST) > Richard Brockie wrote: > > > Hello again, > > > > I'm to the point in my django development t

Re: Error: No module named polls

2015-01-05 Thread Vijay Khemlani
Also make sure that there is an __init__.py file in the polls directory On Mon, Jan 5, 2015 at 12:47 PM, Xavier Ordoquy wrote: > Hi, > > > Le 5 janv. 2015 à 16:41, ibes ... a écrit : > > hello, > I am frustrated with django and phyton tutorial it is very difficult > i'm having a problem with th

Re: Not able to update a form in Django after post method

2015-01-05 Thread Vijay Khemlani
For starters, validate the form before getting its data smsPduForm = SmsPduForm(request.POST) if smsPduForm.is_valid(): d = smsPduForm.cleaned_data smsc = d['SMSC'] # etc... regarding the form assignment, I'm not too sure what you're trying to do. ¿Do you want to display the same form

Re: is there a Django library for AJAX support

2015-01-05 Thread Vijay Khemlani
I don't think Python is the right tool for frontend development. There are entire (and good) frameworks oriented to frontend using JavaScript (such as AngularJS), that also take care of DOM manipulation, handling events, encapsulating ajax requests, etc. On Mon, Jan 5, 2015 at 8:11 PM, Martin For

Re: CSRF verification failed when I use smart phone

2015-01-06 Thread Vijay Khemlani
¿Did you include de {% csrf_token %} tag in the form? ¿Is it generating the corresponding hidden input tag in the html? On Tue, Jan 6, 2015 at 6:09 AM, Sugita Shinsuke wrote: > Hello. > > When I use Django via my smart phone Android and iOS. > The error sometimes occurred. > > Forbidden (403) >

Re: Recommendations for hosting service?

2015-01-06 Thread Vijay Khemlani
I like Linode, and DigitalOcean is also a great choice. Both require low-level configuration of the server but I prefer that over the pre-packaged solutions. On Tue, Jan 6, 2015 at 10:44 AM, Brad Rice wrote: > I like webfaction, too. I think they would have all the stuff you list as > well as m

Re: Matching logic is case sensitive when I want it case insensitive

2015-01-06 Thread Vijay Khemlani
on line 12 you would need a more complex logic try: obj = SocialAccount.objects.get(social_profile=profile, service=service, value__iexact=value) except SocialAccount.DoesNotExist: obj = SocialAccount.objects.create(social_profile=profile, service=service, value=value) (assuming "value" i

Re: Serving static files and media in Django 1.7.1

2015-01-06 Thread Vijay Khemlani
the static tag should be {% static 'mainsite/bootstrap.css' %} according to the layout you said On Tue, Jan 6, 2015 at 8:30 PM, Sithembewena Lloyd Dube wrote: > Hi everyone, > > I have a Django 1.7.1 project structured as per documentation. In it, I > have an app called "mainsite". In mainsite

Re: Pulling data from two table

2015-01-08 Thread Vijay Khemlani
Please be more specific in your question, how are these tables related? what models are they associated with? On Thu, Jan 8, 2015 at 6:01 PM, sum abiut wrote: > Hi, > can someone please help. i am trying to pull data from two table in django > and display the results. can someone please point me

Re: Pulling data from two table

2015-01-08 Thread Vijay Khemlani
> username =models.ForeignKey(User, default =1) > staff =models.ForeignKey(staff, default =1) > > def __unicode__(self): > return self.leave_type > > > > > > On Fri, Jan 9, 2015 at 8:32 AM, Vijay Khemlani wrote: > >> Please be more speci

Re: Pulling data from two table

2015-01-08 Thread Vijay Khemlani
out > information in each table but i am a but confuse in joining the two tables > together. something like NATURAL JOIN in mysql. > > Cheers, > > > On Fri, Jan 9, 2015 at 12:07 PM, Vijay Khemlani > wrote: > >> OK, what query are you trying to make? or what information do

Re: updating data in a row

2015-01-08 Thread Vijay Khemlani
You have two choices 1. Change the URL mapping and pass the "id" in the url url(r'^update_form/(?P\d+)/$', 'eLeave.views.update_form'), (then the url is something like /update_form/15/) 2, Change the view so that it only accepts the "request" argument def update_form(request): in that case yo

Re: How to run background application via Django

2015-01-08 Thread Vijay Khemlani
Have you done the celery tutorial? Async tasks require you to have a broker (rabbitmq or something) and also to create some workers that actually execute the task. On Fri, Jan 9, 2015 at 12:55 AM, Sugita Shinsuke wrote: > Hi somecallitblues > > Thank you for replying. > I installed Celery 3.1.1

Re: Return to the requested page after successfull @login_required by the next variable

2015-01-09 Thread Vijay Khemlani
Add the "next" variable as part of the form in a hidden field ... other fields... and then you can get it in the view that handles the login Also, you seem to have a form object, why don't you use "form.as_p" or something like that to render the form? On Fri, Jan 9, 2015 at 2:02 AM, Robin

Re: updating data in a row

2015-01-11 Thread Vijay Khemlani
4:46 PM, James Schneider > wrote: > >> What URL are you visiting and can you post the traceback? >> On Jan 8, 2015 9:25 PM, "sum abiut" wrote: >> >>> Hi, >>> I have change the URL mapping to url(r'^update_form/(?P\d+

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

2015-01-12 Thread Vijay Khemlani
sqlall only prints the commands that would be executed to create the database from scratch, it does not output your current database schema if you are using django 1.7, then you need to create a migratino and apply it python manage.py makemigrations python manage.py migrate On Mon, Jan 12, 2015

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

2015-01-12 Thread Vijay Khemlani
Then you need to install south and configure it or update to django 1.7 On Mon, Jan 12, 2015 at 4:54 PM, dennis breland wrote: > I am using Django 1.6 > > > On Monday, January 12, 2015 at 1:16:17 PM UTC-5, dennis breland wrote: > >> All works fine before making this change. >> >> I added new dat

Re: page not found errors for most urls but main landing page displaying okay

2014-06-26 Thread Vijay Khemlani
Is it possible that the app is getting confused because it is not running at the root of the domain (/) but instead on a subdirectory (/project/)? On Wed, Jun 25, 2014 at 11:51 PM, Kelvin Wong wrote: > If you have access to your logs, check your logs to figure out where those > requests are goi

Re: tutorial site not working

2017-11-05 Thread Vijay Khemlani
did you keep the manage.py shell open while making the code changes? you need to close/open it again On Sat, Nov 4, 2017 at 10:36 PM, Kyle Foley wrote: > Let me also show what I have placed in the terminal > > >>> Question.objects.get(pk=1) > > > > >>> q = Question.objects.get(pk=1) > > >>> q.w

Re: Django Templates and Conditional CSS classes

2017-11-10 Thread Vijay Khemlani
You can also add a "state_css_class" (or something) method to your object class and just call ... the method should be quite simple On Fri, Nov 10, 2017 at 7:01 PM, Adam Simon wrote: > > You can pass the class from either the model or the view into the > template. For example, you can assign

Re: İ want to setup a server at home for testing and lerning to deploy django projects, thanks for any helping.

2017-12-01 Thread Vijay Khemlani
For a typical setup, a VM (using VirtualBox or similar) running the OS of your server should be enough to test On Fri, Dec 1, 2017 at 2:39 AM, Ali İNCE wrote: > İ want to setup a server at home for testing and lerning to deploy django > projects, can anyone help me , advice and share sources th

Re: Django 2.0 released

2017-12-04 Thread Vijay Khemlani
I just wanted to take the chance to thank Tim and all the other people working on Django, especially on this big milestone for the project. At least for me It has served me well over the last 5 years, has incorporated many useful features while still being relatively lean, and has top notch docume

Re: How to Design Models for Matches in Django Dating App?

2017-12-23 Thread Vijay Khemlani
If you have the survey answers for all the people and you are only going to base the matches based on that data, I'd rather use a K Nearest Neighbors implementation http://scikit-learn.org/stable/modules/neighbors.html Or some other similar system to suggest the matches. For 1.000 users it shoul

Re: Will django include a simpler way to change username to email for registration in the future ?

2018-01-23 Thread Vijay Khemlani
I have been using django-custom-user for that without any issues On Tue, Jan 23, 2018 at 6:43 PM, Daniel Cîrstea wrote: > Hello. For a while I noticed that it is a struggle to extend the > AbstractBaseUser in order to change user to email for registration and > login. Takes time and it is a lot

Re: Optimal query for related names in onetomany or manytomany using Django Queryset

2018-02-02 Thread Vijay Khemlani
"with large of records in A and B, the above takes lot of time" How long? At first glance it doesn't look like a complex query or something particularly inefficient for a DB. On Fri, Feb 2, 2018 at 11:31 AM, Andy wrote: > not that i know of > > > Am Freitag, 2. Februar 2018 15:28:26 UTC+1 schri

Re: Optimal query for related names in onetomany or manytomany using Django Queryset

2018-02-03 Thread Vijay Khemlani
t;> >>> A.objects.filter(bs__isnull=True) >> >>> from django.db import connection >> >>> for q in connection.queries: >> >>> print("{0}: {1}".format(q['sql'], q['time'])) >> >> This will show you both querie

Re: Django y Python

2018-04-16 Thread Vijay Khemlani
No es necesario usar anaconda para instalar Django Puedes usar Django 1.5 en adelante con Python 3, pero lo ideal es usar la última versión (2.0.4) On Sun, Apr 15, 2018 at 8:38 PM, Marcelo Giorno wrote: > Soy nuevo en todo esto. > Instale Anaconda. > Tengo Python 3,6 > La consulta es puedo inst

Re: committing migration files

2018-04-30 Thread Vijay Khemlani
At least for me I have custom migrations (for a materialized view) so that needs to be commited, and a migration seems the most logical place to do so Also if you already have a production database and you need to execute a complex change in the data model you may need a sequence of steps that inc

Re: M2M Magic Accessors without explicit ManyToMany Field

2018-05-08 Thread Vijay Khemlani
Why would it be a muti table inheritance? I would just inherit Car (class MyCar) and add the m2m field there, seems way more explicit and easy to understand too. On Tue, May 8, 2018 at 12:18 PM Clayton D wrote: > I posted a question on SO (https://stackoverflow.com/q/50222402/1978687), > but it

Re: Managing multiple user types in Django

2018-05-15 Thread Vijay Khemlani
I would make a UserType table and have a foreign key from your user model to it, or maybe just have an enumerated type in your user model depending on how much custom logic there is to each user type. On Tue, May 15, 2018 at 11:50 AM Frankline wrote: > Hello Everyone, > > I am developing an API

Re: Problem in part 6, CSS doesn't work

2018-05-29 Thread Vijay Khemlani
That's only for production environments, for development you don't need to run that command Where did you finally put the css file and what path did you put in the tag? On Tue, May 29, 2018 at 1:46 PM Mikko Meronen wrote: > Hi, > > Thank you, but I should have those correct. > > I did some goo

Re: Can not read request.body from a POST request

2016-04-23 Thread Vijay Khemlani
Yeah, I was wrong, I actually use request.body in my code without problem with the default middlewares enabled. On Sat, Apr 23, 2016 at 11:00 AM, Daniel Roseman wrote: > On Wednesday, 20 April 2016 21:29:09 UTC+1, Mihai Corciu wrote: >> >> Is there a method to access request.body from a POST req

Re: How to retrieve data from deep nested object?

2016-04-26 Thread Vijay Khemlani
I guess it is {% for question in subsection.question_set.all %} based on your models On Tue, Apr 26, 2016 at 9:33 AM, Said Akhmedbayev wrote: > I am trying to figure out how to loop over deep nested object in Django > template. > > Here is my app's code > > models.py > > from django.db import

Re: New to Django (stuck at the end of the tutorial)

2016-04-26 Thread Vijay Khemlani
You still haven't defined a rule to handle the root path, just admin and sistema On Tue, Apr 26, 2016 at 8:56 PM, Cronos Cto wrote: > > > ´ > > > Doesnt seem to fix

Re: run Parent __init__

2016-04-27 Thread Vijay Khemlani
Class B shouldn't extend View, A already does It doesn't make a lot of sense to call the constructor again (__init__) from another method (get) On Wed, Apr 27, 2016 at 11:18 AM, Григор Колев wrote: > Where is the problem in this code. > > class A (View): > > def __init__(self): > se

Re: Authenticate problem

2016-06-17 Thread Vijay Khemlani
usu.password shouldn't be "secret" (as in plain text "secret") it should be hashed. Try doing usu.set_password('secret') usu.save() # Not sure if it is necessary or set_password saves by itself then user = authenticate(username='john', password='secret') On Sat, Jun 18, 2016 at 6:33 AM, Briel

<    1   2   3   4   >