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
jango Debug Toolbar you can run python manage.py debugsqlshell which runs a console that prints all SQL statements that are executed, then you need to check whether the UPDATE command is according to expected. On Thu, Oct 16, 2014 at 6:14 PM, carlos wrote: > Hi, @Vijay you suggestion not

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
Remember that |= is just a shorthand for query = query | ... rest of parameters So in the end it is just an "or" like you say, nothing magical about that Glad I could help Regards! On Thu, Nov 27, 2014 at 4:56 AM, wrote: > Hi Vijay, > > thank you very much. I have not

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

django, multi-tenancy and urls

2014-12-05 Thread vijay shanker
am writing a e-commerce application where different people can have stores with urls like this: www.store-one.saas.com, www.store-two.saas.com, and so on. These domains have to be generated automatically when a user signs up for store. I have read somewhere that www.saas.com/store-one can be

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
OK, what query are you trying to make? or what information do you want to display? On Thu, Jan 8, 2015 at 6:50 PM, sum abiut wrote: > Hi Vijay, > Thank you for your email. Here is my models. i want to be able to pull out > all the data from both table and display them. i am a bit new

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

Inserting image alongwith text in django's TextField

2013-12-23 Thread vijay shanker
but it did not have any option to insert image in between of article object.How can i accomplish it ? Regards Vijay -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send

Re: Inserting image alongwith text in django's TextField

2013-12-23 Thread Vijay Shanker
Thanks Mrinmoy. using redactor instead. On Mon, Dec 23, 2013 at 3:17 PM, Mrinmoy Das wrote: > Hi Vijay, > > Use something which allows you to do that. > > There are a bunch of tools available > > https://www.djangopackages.com/grids/g/wysiwyg/ > > > Mrinmoy Das >

LiveFyre vs disqus Commenting system

2014-03-03 Thread vijay shanker
pros and cons of using it,as compared to disqus and other similar APIs.Hope to hear from people who had taste of both these pies. Regards Vijay -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop r

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

retain form data when a user session expires while filling a form

2018-04-12 Thread Vijay Shanker
I have to code this scenario: Some user comes to fill a form and while user is at it, session expires; User tries to submit form, as session has expired it will take him to login page after which he is rediredted to form page with a prefilled form with data he filled previously. my propsed s

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

Re: Error uploading images

2016-07-02 Thread Vijay Khemlani
The typical problem is forgetting to add the enctype='multipart/form-data' attribute to the form tag On Sat, Jul 2, 2016 at 9:40 PM, Lee Hinde wrote: > Using django-storages to put user uploaded files on s3. > > Uploading images in the shell works fine. So, I assume I've got > django-storage

Re: Slow Django dev server reload

2016-07-04 Thread Vijay Khemlani
How many models are there in your project? On Mon, Jul 4, 2016 at 3:46 AM, Hildeberto Mendonça wrote: > Isn't it related to the amount of migration files in your project? > > On Mon, Jul 4, 2016 at 9:13 AM, Babatunde Akinyanmi > wrote: > >> This is a punch in the dark. It takes about 3 - 5 sec

Re: Slow Django dev server reload

2016-07-04 Thread Vijay Khemlani
Why... are you answering questions directed to Krishna? You are not the one with the slow loading server. On Mon, Jul 4, 2016 at 4:19 PM, Fred Stluka wrote: > Krishna, > > I'm using: > - Mac OSX 10.11.5 (El Capitan) > - 2.3GHz Intel Core i7 > - 16 GB 1333 MHz DDR3 > - 512GB SSD > - Python 2.7.3

Re: Any one tried of Django Postgres with Ngnix?

2016-07-14 Thread Vijay Khemlani
nginx + uwsgi + postgres here On Thu, Jul 14, 2016 at 10:43 AM, Rafael E. Ferrero < rafael.ferr...@gmail.com> wrote: > YES, I do !! > > > Rafael E. Ferrero > > 2016-07-14 11:16 GMT-03:00 : > >> >> Any one tried of Django Postgres with Ngnix? >> >> -- >> You received this message because you are

Re: django 1.9, migrations SUCK

2016-07-29 Thread Vijay Khemlani
File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/forms.py", line 12, in BuySearchForm country = forms.ChoiceField(choices=[ (d.country_name, d.country_name) for d in DidCountry.objects.filter(is_active=True) ], required=False) Theres your problem, you are trying to query the databas

Re: beginner . problem simple form.

2016-08-22 Thread Vijay Khemlani
Also, why do you have two form tags in your html? On Sun, Aug 21, 2016 at 10:40 AM, ludovic coues wrote: > Do you have any message in the console where you run "python manage.py > runserver" ? > > 2016-08-21 12:16 GMT+02:00 Jordi Fernandez : > > hi, > > > > I have my firts application django it'

Re: A Backup Model in Django?

2016-10-16 Thread Vijay Khemlani
For starters, why are you trying to backup a model to the same database instead of just dumping the whole database? On Sun, Oct 16, 2016 at 10:02 AM, Andromeda Yelton < andromeda.yel...@gmail.com> wrote: > I've found myself in the situation of needing to copy model data to new > model instances.

Re: Tutorial part 3 help: bulleted-list

2016-10-18 Thread Vijay Khemlani
You wrote "latest_quesion_list" in the context dictionary key, it should be "latest_question_list" On Tue, Oct 18, 2016 at 3:00 PM, Johnny McClung wrote: > I have gotten down to the part where the tutorial reads "Load the page by > pointing your browser at “/polls/”, and you should see a bullete

Re: Django can't find database

2016-10-22 Thread Vijay Khemlani
Can you connect to the database via command line? psql -U gary -d archivedb On Sat, Oct 22, 2016 at 3:48 PM, Jamie Lawrence wrote: > > > On Oct 22, 2016, at 11:35 AM, Gary Roach > wrote: > > > When I try to migrate, I get the following error: > > > >> psycopg2.OperationalError: FATAL: databa

Re: Updating mixin subclassed instances

2016-11-01 Thread Vijay Khemlani
You could use a metaclass to keep track of all the classes that inherit from a given one, in a pure Python way it would be something like this class PluginMeta(type): # we use __init__ rather than __new__ here because we want # to modify attributes of the class *after* they have been #

Re: How to delete a certain model instance in django after a given date

2016-11-05 Thread Vijay Khemlani
You could write a management command https://docs.djangoproject.com/en/1.10/howto/custom-management-commands/ and execute it regularly (for example using a cron job) On Sat, Nov 5, 2016 at 3:31 PM, YOGITHA A N wrote: > So here are my models: > > * class Mess(models.Model):* > muser =

Re: Django first example needs minor but significant improvement?

2016-11-06 Thread Vijay Khemlani
All the paths in that documentation are relative to the path of the project: polls/views.py polls/urls.py etc and at the beginning of the page it even shows the file tree mysite/ manage.py mysite/ __init__.py settings.py urls.py wsgi.py Also there are on

Re: Best practices for directories in which to store stuff in production

2016-11-09 Thread Vijay Khemlani
I prefer to keep everything in /home (at least the virtualenv, project code, settings and logs), that way you don't need special permissions to modify those files and it is more or less separated from the system files. static and media files in Amazon S3 Caching... I used memcached, so I have no

Re: How to access Django data with the field name in text?

2016-11-14 Thread Vijay Khemlani
If I understood it correctly, you might want to do it like this setattr(att, "fname", "value_to_be_set") and to get the value first_name = getattr(att, "fname") On Mon, Nov 14, 2016 at 8:38 AM, rmschne wrote: > I have a extracted all the field names from a Django model into a list > called "f

Re: Template Data

2016-11-18 Thread Vijay Khemlani
In your model a contact may have multiple phone numbers (multiple Contactnumber instances with foreign key to the same Contact instance) so your question is a bit vague. If you wanted to list all numbers for a given contact you could do somethinkg like {% for contact in practice.contacts.all %}

Re: Template Data

2016-11-18 Thread Vijay Khemlani
> What other infromation would you need to further advise me. > Thanks > > On 18 November 2016 at 13:42, Vijay Khemlani wrote: > >> In your model a contact may have multiple phone numbers (multiple >> Contactnumber instances with foreign key to the same Contact instance) so

Re: Django Migration Error in Heroku, but migrate correctly in heroku local

2016-12-03 Thread Vijay Khemlani
If you are versioning your migration files (most liketly) then you don't have to run makemigrations in the server again. On Fri, Dec 2, 2016 at 11:55 PM, zhangdb7 wrote: > Python 3.5, Django 1.10.3, Sqlite > I have deployed a django app in heroku.It ran without errors before. One > day I make so

Re: Compiling CSS to one single CSS file

2016-12-18 Thread Vijay Khemlani
django-compressor does the job On Sun, Dec 18, 2016 at 7:08 AM, ludovic coues wrote: > Yes, collectstatic copy static files scattered inside all your apps > inside a single directory. This make it easier to serve the files > directly from your apache or nginx or a different server from the one >

Re: validate_email returns None for any or format

2016-12-20 Thread Vijay Khemlani
As far as I know validators don't return anything, just raise an Exception if the parameters don't validate On Tue, Dec 20, 2016 at 10:28 AM, NoviceSortOf wrote: > > Why does validate_email return None irregardless of what is typed in? > > >>> from django.core.validators import validate_email >

Re: Erroneous links in my URLs - all load the home page -- not a 404 or other error.page

2016-12-21 Thread Vijay Khemlani
show your urls.py On Wed, Dec 21, 2016 at 10:43 PM, NoviceSortOf wrote: > > URLs not defined in my urls.py all show my home page and not a 404 missing > page error. > > For instance > > www.mysite.com > Naturally shows my home page. > > www.mysite.com/catalogs > Shows the downloadable catalogs >

Re: Erroneous links in my URLs - all load the home page -- not a 404 or other error.page

2016-12-22 Thread Vijay Khemlani
tml")), > (r'^about.htm/$', TemplateView.as_view(template_name= > "about.html")), > (r'^contactus.htm/$', TemplateView.as_view(template_name= > "contactus.html")), > (r'^subjectslst/$', TemplateView.as_view(temp

Re: Postgres SQL vs SQLite vs MS SQL vs MY SQL

2016-12-22 Thread Vijay Khemlani
https://sqlite.org/whentouse.html SQLite is not directly comparable to client/server SQL database engines such as MySQL, Oracle, PostgreSQL, or SQL Server since SQLite is trying to solve a different problem. Client/server SQL database engines strive to implement a shared repository of enterprise

Re: Form Validation Error NOT Raised When Form Is Submitted

2016-12-22 Thread Vijay Khemlani
I'm not following If you submit the form with incorrect information (non unique email) then your view does not return anything because form.is_valid() returns False Validation errors don't prevent the form from being submitted, they prevent the form from validation (making form.is_valid() return

Re: Form Validation Error NOT Raised When Form Is Submitted

2016-12-22 Thread Vijay Khemlani
if the form is not valid then form.errors should contain human-readable errors for each field, including the one you validate yourself (the string inside the raise ValidationError call), you can return that. On Thu, Dec 22, 2016 at 11:49 PM, Chris Kavanagh wrote: > Yeah, I was wrong Vijay.

Re: Advise for first project in Django

2016-12-23 Thread Vijay Khemlani
Yes, it is feasible As a starting project i find it a bit too complicated, at least the listening online part On Fri, Dec 23, 2016 at 12:39 PM, imed chaabouni wrote: > Hello, > > > I am a Tunisian novice developer, and I am about to make my first project > in Django this year after studying Pyt

Re: Define Django Base Model Class

2016-12-28 Thread Vijay Khemlani
That doesn't change the advise I would find it weird to import a class only to have something else loaded https://www.python.org/dev/peps/pep-0020/ "Explicit is better than implicit." On Wed, Dec 28, 2016 at 3:02 PM, Guilherme Leal wrote: > Got it. > > The custom model doesn't have any signi

Re: Deploying a Django App on GitHub Pages with the aid of Firebase

2017-01-02 Thread Vijay Khemlani
Github pages is only for static files, so no, unless your application only consists of static html files (in which case you woudn't be using django) On 1/2/17, Mostafa Elgayar wrote: > Is it possible to deploy a Django Application on GitHub pages, by having > the backend on Firebase for example a

<    1   2   3   4   5   >