Re: How to clean up character database fields with leading and trailing spaces

2015-11-03 Thread Vijay Khemlani
As far as I know the Django ORM encapsulates SQL queries, so you can't put arbitrary python code in there (".strip()") If I remember correctly SQL does not have a standard TRIM method, but individual database engines do, for example for Postgres http://www.postgresql.org/docs/9.1/static/functions

Re: Duplicated queries

2015-11-07 Thread Vijay Khemlani
duplicated queries as in exactly the same or with different parameters? If they hace different parameters it sounds like something you can resolve with select_related https://docs.djangoproject.com/en/1.8/ref/models/querysets/#select-related Either way, you would need to post you rmodels and quer

Re: DoesNotExist: Group matching query does not exist.

2015-11-11 Thread Vijay Khemlani
It seems you don't have any groups in your database with the name "test" On Wed, Nov 11, 2015 at 7:14 PM, Robin Fourcade wrote: > Hi, > I'm working with the auth library. > > I've imported all of these: > > from django.shortcuts import render, redirect > from pizza_club_order.forms import * > fr

Re: I'm missing something with Models and database migrations

2015-12-22 Thread Vijay Khemlani
You have two pairs of fields with the same name (line_item_id and invoice_id), what are you trying to do exactly? Why the IntegerFields? In a Many To Many relation the columns are added to a third table between the models. On Tue, Dec 22, 2015 at 9:20 PM, Michael Molloy wrote: > Python 3.3 and

Re: I'm missing something with Models and database migrations

2015-12-23 Thread Vijay Khemlani
If you want to make the middle table by yourself then those ManyToManyField need to be ForeignKey instead. On Wed, Dec 23, 2015 at 2:33 AM, Michael Molloy wrote: > I figured it out, again with help from Vijay. Thanks for getting me > thinking in the right direction. > > So here

Re: How to serve a static file with django?

2015-12-23 Thread Vijay Khemlani
I guess the URL would be something like this 127.0.0.1:8000/static/my_app/hello.html (without the first "my_app") assuming your STATIC_URL is '/static/' On Wed, Dec 23, 2015 at 1:57 AM, Dan Bikle wrote: > *Hi List,* > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >

Re: Fitering on manytomany field whose results are contained within another set...

2015-12-23 Thread Vijay Khemlani
You should be able to query it as a ForeignKey Jobs.objects.filter(names__is_a_problem=True).distinct() (distinct to prevent repeated jobs with more than one worker problem) On Wed, Dec 23, 2015 at 9:31 AM, Jonty Needham wrote: > I have a model of the form: > > class Jobs(models.Model): >

Re: ModelForm.is_valid() doesn't work the first time but does the second

2016-01-02 Thread Vijay Khemlani
"First, why does uf.is_valid() return" because you called "uf.is_valid" (note the lack of parenthesis), that's just a reference to the method and does not call it. "Second, why does uf.save() return that stacktrace the first time I call it, but the second time I call it, the object saves? " As f

Re: ModelForm.is_valid() doesn't work the first time but does the second

2016-01-03 Thread Vijay Khemlani
g, but it doesn't work. Note > the code below. is_bound = False if I use instance=u. If I just pass the > Users instance without the 'instance' keyword, is_bound returns True. > > >>> u = Users() > > >>> u.email = 'je...@home.net' > >

Re: hello. get_queryset question

2016-01-03 Thread Vijay Khemlani
Try with self.request.GET['name'] On Sun, Jan 3, 2016 at 11:22 PM, Víctor Suárez wrote: > Hello all, > as it's my first post, if any django developer around, nice work! I > appreciate the package, I've been able to pull a small project I had in > mind for long, very easily with this. > > I am n

Re: why cannot delete attribute id of model?

2016-01-11 Thread Vijay Khemlani
I usually do product.id = None product.pk = None But I'm not sure whether that's the best way to do it On Mon, Jan 11, 2016 at 4:25 AM, Xudong Zhang wrote: > I want to delete the id attribute of a model but failed, it comlains that > the model has no attribute 'id'. But I use hasattr() checked

Re: why cannot delete attribute id of model?

2016-01-11 Thread Vijay Khemlani
At least I use it as part of the process to save a copy of an existing model instance On Mon, Jan 11, 2016 at 9:35 AM, Tony Flury wrote: > Why do you want to delete the id field. The idea of a primary key field is > central to relational databases. If you to suppress the automatically > generate

Re: How to view the generated SQL for test models?

2016-01-16 Thread Vijay Khemlani
At least to me it doesn't make a lot of sense to define new models in your tests, but I also don't know the particular problem you are solving. On Sat, Jan 16, 2016 at 1:27 PM, Brutus Schraiber wrote: > Wrong place to ask such things? > > This doesn't seem too uncommon or complicated, or am I mi

Re: Setting up Django

2016-01-16 Thread Vijay Khemlani
your app is called "generator", that's all you need to put in INSTALLED APPS also, I'm not sure if this matters, but I tend to put my apps after the ones bundled with django. On Sat, Jan 16, 2016 at 5:30 PM, ofeyofey wrote: > Hi, > > I am following the Django tutorial on the Django site. Gettin

Re: De Morgan's Law and QuerySet semantics

2016-02-13 Thread Vijay Khemlani
assert test_obj not in TestObj.objects.filter(Q(m2ms__int_value=10) & Q(m2ms__char_value='bar')) Why shouldn't test_obj be in that query result? test_obj has a m2m with int_value 10 and a m2m (although another one) with char_value bar On Sat, Feb 13, 2016 at 7:45 PM, Lucas Wiman wrote: > I'm wo

Re: Relations one-to-many on django

2016-02-23 Thread Vijay Khemlani
Each product is only associated with one category, so you can only do produto.categoria If you want to iterate over all categories, and then through the products of each category, you could do {% for categoria in categorias %} {% for produto in categoria.produto_set.all %} do comething with prod

Re: context dictionary

2016-02-24 Thread Vijay Khemlani
Django 'is' a framework, therefore you have the flexibility to create your context as you see fit. You could call an external API, query your database, obtain results from ElasticSearch, parse another webpage, or anything that suits the needs of your particular project. It completely depends on th

Re: Can't Get ListView to display result of SQL Query onto Custom Template

2016-02-25 Thread Vijay Khemlani
{{ codelist.arrow }} shouldn't you be using the for variable? something like {{ i.arrow }} On Thu, Feb 25, 2016 at 11:19 AM, Malik Rumi wrote: > *Note- This question was originally posted on SO before I completely > understood what my issue was. However, since editing it to reflect the true

Re: Encoding problem (Postgres)

2016-03-05 Thread Vijay Khemlani
The error you are seeing is at the application level, not database, so I don't think postgres is at fault. Post the full stack trace for the error and the relevant part of your code when it fails. On Sat, Mar 5, 2016 at 3:28 PM, Georges H wrote: > Hi to all the Django community ! > > I started

Re: Encoding problem (Postgres)

2016-03-06 Thread Vijay Khemlani
t I solved this little problem by adding at the top of my > models.py: > > django.utils.encoding import from python_2_unicode_compatible > > > And always in models.py before each class: > > @ python_2_unicode_compatible > > Perfect! > > Le dimanche 6 mars 2016

Re: ¿Como hacer mi primera aplicacion con Django en Ubuntu? ¿How Can I make my first project with Django?

2016-04-03 Thread Vijay Khemlani
Leiste el tutorial? https://docs.djangoproject.com/en/1.9/intro/tutorial01/ On Sat, Apr 2, 2016 at 3:25 AM, Kike Martinez wrote: > Hola quisiera saber como puedo hacer un proyecto con Djando desde cero > gracias > > -- > You received this message because you are subscribed to the Google Groups

Re: Problems with dumpdata/loaddata

2016-04-06 Thread Vijay Khemlani
Your apps are called members and posts, or those are the names of the models? On Wed, Apr 6, 2016 at 9:20 AM, ludovic coues wrote: > Both error look like encoding error. > In the JS file, it look like there is a byte order mark at the start > of the file. > The first line of both file might help

Re: Any Django users based in Chile?

2016-04-07 Thread Vijay Khemlani
Chilean Django dev here We are not many, but at least there are plenty of Python developers here. Regards! On Thu, Apr 7, 2016 at 12:24 PM, John wrote: > Curious to connect with Django devs in Chile. > > Hoping to do a Django project with Chilean devs in the coming months and > would love to c

Re: Simple to say but difficult in django?

2016-04-09 Thread Vijay Khemlani
Your question seems to be incomplete considering you are using a login_required decorator then you also want to limit access to the file If you put it in your static directory then it will be public if anyone knows the URL to the file On Sat, Apr 9, 2016 at 1:56 PM, Luca Brandi wrote: > Hi, >

Re: No Downtime Code Releases

2016-04-19 Thread Vijay Khemlani
Also, you don't need to restart Apache / nginx or whatever, or delete the pyc files, just reload uwsgi / gunicorn. On Tue, Apr 19, 2016 at 6:48 PM, Avraham Serour wrote: > you can easily do code reloading with uwsgi graceful reload, no user will > ever know you reloaded your application, no need

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

2016-04-20 Thread Vijay Khemlani
Why would you want to access request.body directly? You should use request.POST, request.GET, request.FILES. On Wed, Apr 20, 2016 at 5:27 PM, Mihai Corciu wrote: > Is there a method to access request.body from a POST request in Django, > without disabling 'django.middleware.csrf.CsrfViewMiddlewa

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

2016-04-21 Thread Vijay Khemlani
What could be in the body that's not in the supplied Django fields? I have implemented RESTful APIs as you say (no idea why that matters as they are just HTTP requests) and never had the need to read the actual body.. On Thu, Apr 21, 2016 at 2:13 AM, Gergely Polonkai wrote: > Vijay:

Re: Passing Django Template Vars to JS

2018-06-10 Thread Vijay Khemlani
I'm not sure why your code does not work (maybe there is a "race condition" between the JS click handlers), but that global variable is a bad idea in general. You can add the comment ID as an attribute to your button, like and in your event handler obtain the comment id $("#like_comment_button

Re: Interfaz administrativa, login con SSH

2018-06-10 Thread Vijay Khemlani
En general SSH sirve para hacer conexiones remotas por terminal (bueno, puedes hacer una sesión X a través de SSH pero no creo que sea lo que necesites) La forma más común de aumentar la seguridad del login es por two factor authorization, básicamente mandar una validación a tu celular o algun otr

Re: Interfaz administrativa, login con SSH

2018-06-11 Thread Vijay Khemlani
"Vijay, thanks for the help, but the authentication of two factors seems quite uncomfortable, considering that an administrator can enter every day, several times a day, having to depend on a mobile device for each login. " Session cookies last for 2 weeks by default in Django, regardl

Re: Interfaz administrativa, login con SSH

2018-06-12 Thread Vijay Khemlani
La máxima seguridad (razonable) sería conectarse a una VPN y que el admin de Django solo acepte logins desde dentro de la VPN, pero para el 99% de los casos suena innecesario. Para abrir un navegador dentro del servidor mismo tendrías que tener instalado todo ambiente de escritorio en el servidor

Re: Nested for loops in templates

2018-06-13 Thread Vijay Khemlani
As far as I know you can't do it directly in the templating system Yo could write a template tag as described here https://stackoverflow.com/questions/2894365/use-variable-as-dictionary-key-in-django-template/10700142#10700142 or use a different data structure, for example each row as a list of

Re: A few doubts with an implementation.

2018-07-02 Thread Vijay Khemlani
You can also use PubNub (https://www.pubnub.com/) or similar services On Mon, Jul 2, 2018 at 10:29 AM Vineeth Sagar wrote: > Mikhailo Keda wrote: >> >> to fetch emails every N minutes or hours - >> http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html >> I want the user to

Re: Use an external REST API in django admin

2018-07-16 Thread Vijay Khemlani
django rest framework would be your best bet http://www.django-rest-framework.org/ On Mon, Jul 16, 2018 at 10:16 AM micka wrote: > Hello, > > I wish I could use the data from an external API in the administration of > Django. I wish I could list, read, edit and create objects but instead of > u

Re: Django performance issue that's troubling

2018-08-23 Thread Vijay Khemlani
Maybe your update form has a field related to a model with thousands of records? like rendering a select combo box with thousands of choices? On Thu, Aug 23, 2018 at 5:30 PM Jim Illback wrote: > I have a Django app in development that performed perfectly with about 20 > client records. Each clie

Re: Django performance issue that's troubling

2018-08-24 Thread Vijay Khemlani
On Thu, Aug 23, 2018 at 8:19 PM Jim Illback wrote: > Vijay, you are exactly correct. Thank you much! > > Now, knowing the problem, I still don’t have a great solution. Here’s how > it is supposed to work. > > Someone chooses a client from the list or a search. All the possibl

Re: Django performance issue that's troubling

2018-08-24 Thread Vijay Khemlani
you want to be editable by the user On Fri, Aug 24, 2018 at 2:06 PM Jim Illback wrote: > Vijay, think of this is a parent - child relationship. I have 37K parents. > Now I want to update a child of one of the parents. But, in order to have > the update work, it needs the ForeignKey t

Re: A questionale developer had added exraneous code to image URLS that used to work. I would be gratefuldor your assitamce please?

2018-09-09 Thread Vijay Khemlani
If you're using django-storages with S3 as the media backend then there is a setting called AWS_S3_FILE_OVERWRITE that prevents files with the same name form being uploaded. In those cases the library appends a suffix similar to your example. Usually this is useful to prevent files from being over

Re: "Project object has no attribute review_set"

2018-10-12 Thread Vijay Khemlani
Since the related name in the project foreign key is "review" you have to use that keyword for the related query from project, so it should be "self.review.all()" instead of "self.review_set.all()" in your Project methods. Regards! On Fri, Oct 12, 2018 at 9:25 AM Melissa Malala wrote: > Getting

Re: hello guys, help me please, I could not associate username to a post

2020-12-16 Thread vijay naudiyal
You can also try get_user(request) instead of request.user Or also self.requesr.user if you take self as argument. Let me know if it works for you Cheers Vijay On Tue, Dec 15, 2020, 23:56 Chelsea Fan wrote: > [image: image.png] > > -- > You received this message because you are s

Chat Application in Django

2021-03-10 Thread vijay naudiyal
but still not sure what is the right way to do it. Any help would be appreciated. Thanks in advance. Have a nice day. 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 e

Re: Chat Application in Django

2021-03-10 Thread vijay naudiyal
to me at vijaynaudiyal...@gmail.com Have a good day. Vijay On Thu, Mar 11, 2021 at 3:53 AM Rajesh Ranjan_067 < rajeshrausan3...@gmail.com> wrote: > Dear sakshi mam may I join you, as you are doing on chat app > > On Thu, 11 Mar, 2021, 12:15 am sakshi jain, wrote: > >>

Re: Chat Application in Django

2021-03-10 Thread vijay naudiyal
Hi Kasper, Sure I am not offended and thank you for asking that. I will be glad to share the project once completed. Regards Vijay On Thu, 11 Mar, 2021, 08:23 Kasper Laudrup, wrote: > On 11/03/2021 03.34, vijay naudiyal wrote: > > > > Pls no personal attacks. Lets keep the th

/accounts/password/reset/ Exception Value: No module named 'django.shop'

2021-08-22 Thread vijay chourey
Environment: Request Method: POST Request URL: http://127.0.0.1:8000/accounts/password/reset/ Django Version: 3.1.1 Python Version: 3.6.6 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages',

Re: error in models

2019-08-05 Thread Vijay Khemlani
Remove the quotes On Mon, Aug 5, 2019 at 11:24 AM Mudasir Mian wrote: > Dear Team, > im facing this error in models > help me please > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emai

How to create user registration

2019-09-06 Thread VIJAY RAJA
How to create user registration forms -- 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 an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the w

<    1   2   3   4   5