Re: request.read() is empty in POST

2017-01-03 Thread Vijay Khemlani
Yeah, because hitting a roadblock only happens in Django Why are you trying to read the request directly? django parses it in request.body, request.GET, request.POST, request.FILES, etc https://docs.djangoproject.com/en/1.10/ref/request-response/ On 1/4/17, Flávio Cardoso wrote: > Wow, that's s

Re: Facing performance issue bcoz of db data

2017-01-04 Thread Vijay Khemlani
A poorly optimized query or a query that returns too many results (too many as un hundrends of thousands), but it doesn't make sense to execute a query that large in a request / response cycle. Or too many subsequent queries after the original one Without more information it's kinda hard to tell

Re: good pratices to write many lines on database

2017-01-05 Thread Vijay Khemlani
You could queue the tasks in a broker (rabbitmq for example) and use a fixed number of celery workers to process them and save them to the database, assuming: - you don't have 1000 requests per second all the time - you don't need the data to be stored immediately On 1/4/17, Avraham Serour wrote

Re: Facing performance issue bcoz of db data

2017-01-05 Thread Vijay Khemlani
g the performance problem On 1/5/17, Anjali Pradeep wrote: > Vijay, > > Thanks for the response. > I will be executing multiple queries in a nested form based on one > particular criteria to form a final dictionary with a set of field values > from different db table as keys and v

Re: Use case for ALLOWED_HOSTS

2017-01-05 Thread Vijay Khemlani
To prevent Host header poisoning https://www.djangoproject.com/weblog/2013/feb/19/security/#s-issue-host-header-poisoning On 1/5/17, Antonis Christofides wrote: > If Django is listening at http://mydjangoproject.com/, then the web server > is > normally configured to proxy pass mydjangoproject.c

Re: Dynamic Models

2017-01-05 Thread Vijay Khemlani
I had to implement dynamic models for our project. In the end we represented them in four django models, two for the "virtual models" and its fields and two for the actual data We used the django model system for these four base classes, but the "virtual models" on top of them were custom (so no

Re: Dynamic Models

2017-01-05 Thread Vijay Khemlani
"That was exacly the points i'm willing to avoid. Had any problems with the metaclass approach? Why did you chose the "virtual model" concept?" We had to represent multiple product categories, each with their own structure and particular fields. In the end we had around 700 virtual models, which

Re: data must be QuerySet-like (have count() and order_by()) or support list(data) -- NoneType has neither

2017-01-08 Thread Vijay Khemlani
At least by looking at the source code https://github.com/bradleyayers/django-tables2/blob/master/django_tables2/views.py It seems you need to have a "table_data" attribute, or a "object_list" attribute, or define a "get_table_data" method in your class On 1/8/17, Ali khan wrote: > I am using D

Re: Are we ever meant to make a totally new python module in our app?

2017-01-08 Thread Vijay Khemlani
Using urls.py and views.py as names is not mandatory in the app, the "urls.py" is referenced in the urls.py of the project, and can have any name you want, but these are convention names and useful for other people reading your code models.py is a tad more special because models need to be auto di

Re: data must be QuerySet-like (have count() and order_by()) or support list(data) -- NoneType has neither

2017-01-11 Thread Vijay Khemlani
Maybe because this is a list for django, not particular django libraries. Did you look at the source code? Did you implement the get_table_data() method? On Wed, Jan 11, 2017 at 3:43 AM, Ali khan wrote: > Vijay, > > I've tried many ways but its not working. > Can you show me a

Re: Get current site inside model

2017-01-13 Thread Vijay Khemlani
You would need to pass it as argument, or set a default Site, otherwise it doesn't make sense For example, when calling the method from the shell (not a web request) what will you expect it to return? On 1/13/17, Max wrote: > Hi, guys. I want to get absolute url for Model with domain based on re

Re: Get current site inside model

2017-01-13 Thread Vijay Khemlani
e template itself {{ domain }}{{ ob.get_absolute url }} where the absolute url is something like '/model/5' or something like that, without the domain. On 1/13/17, Max wrote: > Vijay Khemlani, i think my question have not a lot of details. More > 1) Django site framework (w

Re: Get current site inside model

2017-01-13 Thread Vijay Khemlani
I'm not gonna start on the "cool" part You could generate the urls on the view and pass them already generated to the template On 1/13/17, Max wrote: > {{ domain }}{{ ob.get_absolute url }} - is not cool , i set site with > context proccesor for domain > > Once again, if you don't have a default

Re: Need help with a school project

2017-01-14 Thread Vijay Khemlani
Read the tutorial I guess https://docs.djangoproject.com/en/1.10/intro/tutorial01/ After that handling form data and saving to the databse should be trivial On 1/14/17, Grant Holman wrote: > I need help starting a django project for a school project. I am brand new > to Django but have some exp

Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-17 Thread Vijay Khemlani
The only "custom include" in Django is for loading other url files The rest of the imports are typical Python module / packages On 1/17/17, 'Peter Müller' via Django users wrote: > Ah I now see the problem. However I tried to remove the entry in the > __init__.py file > Python is then unable to

Re: What is the best library for Facebook social auth?

2017-01-18 Thread Vijay Khemlani
I like django-allauth http://django-allauth.readthedocs.io/en/latest/ On 1/18/17, christina zou wrote: > Hi, > > I am new to Django and web development in general. I am trying to > incorporate facebook social auth into django. I assume this is a common > need for which there is a well supported

Re: urls with https and s3:// as parameters

2017-01-19 Thread Vijay Khemlani
Shouldn't the paths be passed as GET or POST arguments instead of part of the URL path? Why would you need the regex then? On 1/19/17, Ramon Ramirez-Linan wrote: > Hi > > I am building a django app which urls take 2 parameters a source and > destination. > The source is either a url for a file ht

Re: How to resole Integrity Error caused by NOT NULL

2019-03-09 Thread Vijay Khemlani
Your assign should be new_material_review.material = material_instance instead of new_material_review.material_instance = material_instance that you have now On Sat, Mar 9, 2019 at 4:29 AM Chukwunonso Nwankpa wrote: > Good Morning. > I'm new to django and currently using the framework for a

Re: Guardar many to many Django

2019-04-13 Thread Vijay Khemlani
Esta línea Articulo_Consolidacion.objects.create(articulo=articulo_data,tagicNone, tono=array_tono, tema__id=None) No tiene mucho sentido (que es tagicNone?, de donde sale arrary_tono? no estas usando tag_list ni tema_list...) Ademas en tu modelo el campo "articulo" de "ArticuloConsolidacion" es

Re: File not getting uploaded

2019-04-17 Thread Vijay Khemlani
In your HTML, the form tag should have an enctype ... On Wed, Apr 17, 2019 at 2:36 AM Aakash Baranwal wrote: > Sorry, the image file wasnt uploaded. > > > > On Wed, Apr 17, 2019 at 12:04 PM Aakash Baranwal > wrote: > >> Hi Everybody, >> >> I am trying to upload a file, but it says "No file c

Re: File not getting uploaded

2019-04-17 Thread Vijay Khemlani
When he said "uploading it from there" I was not sure whether "there" meant Django's admin page or the same view that's failing now As far as I know the form has to have a multipart enctype to upload files On Wed, Apr 17, 2019 at 9:53 AM Ram sundar wrote: > Hi

Re: Existing database for users to use django user auths

2019-06-05 Thread Vijay Khemlani
Yes, you can write your own Authentication Backend with your custom authentication logic https://docs.djangoproject.com/en/2.2/topics/auth/customizing/ On Wed, Jun 5, 2019 at 8:53 AM michael ababao wrote: > I am new to django and i would like to know if it is possible to use the > django user a

Re: Redireccionamiento

2019-07-10 Thread Vijay Khemlani
No hay ningun JavaScript interceptando los links en tu pagina? On Tue, Jul 9, 2019 at 10:23 PM samuel lopez wrote: > Tengo un problema con los links y es que todo está bien internamente osea > los tags, urls, views y todo, pero cuando le doy click al botón o al enlace > del nav o cualquier otro,

Re: Model forms

2017-01-24 Thread Vijay Khemlani
Crispy forms is also good http://django-crispy-forms.readthedocs.io/en/latest/ On 1/24/17, Fred Chevitarese wrote: > Hey! > > I use this app to make my job easier :P > https://github.com/dyve/django-bootstrap3 > > Just install it and follow the instructions ;) > > > Cheers! > > > > *"* > *São os

Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-28 Thread Vijay Khemlani
> A quick one is e.g. that there is no explanation of what a view is and what > > its purpose is. "The code above maps URLs, as simple regular expressions, to the location of Python callback functions (“views”)" "Each view is responsible for doing one of two things: Returning an HttpResponse obje

Re: Django Debug Toolbar installation

2017-01-28 Thread Vijay Khemlani
Did you install debug_toolber on your server? pip install django-debug-toolbar On 1/28/17, Richard Jackson wrote: > Hi everyone, > > I've recently installed the Django Debug Toolbar for local use; I've just > pushed the code online and am greeted with the below error: > > [81.95.157.172] out: Tr

Re: get_or_create IntegrityError

2017-02-16 Thread Vijay Khemlani
As far as I know Postgres uses "sequences" for generating the model IDs. If you set the id manually I think you are bypassing the sequence, which doesn't autoincrement. So when you use the sequence the next time the ID clashes. pgAdmin should auto generate the id if you leave the field blank. On

Re: Having trouble with Django tutorial

2017-03-02 Thread Vijay Khemlani
Did you do this step? The next step is to point the root URLconf at the polls.urls module. In mysite/urls.py, add an import for django.conf.urls.include and insert an include() in the urlpatterns list, so you have: mysite/

Re: Having trouble with Django tutorial

2017-03-03 Thread Vijay Khemlani
How does your learning_python.urls look like? On 3/3/17, Yves S. Garret wrote: > Yes. > > On Thursday, March 2, 2017 at 11:09:58 AM UTC-5, Vijay Khemlani wrote: >> >> Did you do this step? >> >> The next step is to point the root URLconf at the polls.urls mod

Re: Having trouble with Django tutorial

2017-03-03 Thread Vijay Khemlani
url(r'^polls/', urls), > url(r'^admin/', admin.site.urls), > ] > > Is there a way to print out strings to indicate where the problem is? > > On Friday, March 3, 2017 at 8:35:47 AM UTC-5, Vijay Khemlani wrote: >> >> How does your learning_pyth

Re: Having trouble with Django tutorial

2017-03-03 Thread Vijay Khemlani
ves S. Garret wrote: > Is this learning_python/urls.py or learning_python/learning_python/urls.py? > > On Friday, March 3, 2017 at 10:04:32 AM UTC-5, Vijay Khemlani wrote: >> >> You should import the polls urls as it appears in the tutorial >> >> url(r'^polls/'

Re: Request for advice on refactoring a big Django project

2017-03-06 Thread Vijay Khemlani
Also, this type mailing lists are usually for specific questions about the framework "How do I make this particular query with the ORM" "Why isn't this variable getting rendered in the template" etc Your question is kinda broad On 3/6/17, Bob Haugen wrote: > Antonis, thank you very much for th

Re: Chart library for django

2017-03-06 Thread Vijay Khemlani
Rendering server-side charts is usually a mess, and the result (usually a static image) is not as good as using a JS library. I use Highcharts, just had to make a little layer on top of it to make it compatible with the JSON django was generating. It also encourages separation of concerns between

Re: Advice: count hits/pageview for high traffic website

2017-03-08 Thread Vijay Khemlani
Maybe I'm missing something, but why not Google Analytics? On 3/8/17, ludovic coues wrote: > Have you looked at an analytics solution like piwik ? > > 2017-03-08 6:40 GMT+01:00 carlos : >> Daniel, no i say i used django for a website with high traffic maybe 70k >> per >> days, but i need count vi

Re: Django queryset High CPU Usage

2017-03-10 Thread Vijay Khemlani
There is something wrong in your setup I can query a 400.000 item table in less than a second with the typical "Model.objects.all()". Django does not convert all of the entries into objects just by that query. You don't have any managers, or anything that can result in a side-effect beyond the qu

Re: Django queryset High CPU Usage

2017-03-10 Thread Vijay Khemlani
ts are created. > > But when you say not all objects are created at one go, you mean they can > be deferred? You mean the query results are stored in the memory till each > record is accessed or something using the objects? Could you please > clarify? > > Thanks. > > On F

Re: Migrations

2017-03-11 Thread Vijay Khemlani
Not really, as long as you understand what's going on and not inputting commands just for the sake of it. On 3/11/17, Mike Dewhirst wrote: > On 11/03/2017 7:17 AM, Matthew Pava wrote: >> >> Does anyone else get a migraine when working migrations? >> > > Only when I try to game them. If I follow i

Re: Django queryset High CPU Usage

2017-03-11 Thread Vijay Khemlani
Am I the only one who thinks that generating a report over a set of just 10.000 records could be done in 10 - 20 secs unless there are some serious computations going on with that data? For a report I have to query around 200.000 records, with aggregations, and it takes less than a minute using th

Re: Django queryset High CPU Usage

2017-03-11 Thread Vijay Khemlani
r the high cpu and time taken are due to the basic query ("Model.objects.all()") or the further processing of the report. It could easily be a missing "select_related" which causes thousands of joins inside a for loop. On 3/11/17, James Schneider wrote: > On Mar 11, 2017 12:0

Re: Django queryset High CPU Usage

2017-03-14 Thread Vijay Khemlani
"In the above, the CPU was hitting almost 100% and was taking almost a second" So, your query was resolved in a second, that's normal, also the spike in cpu usage because... the cpu is working... Your problem seems to be in your for loop for a in As: retrieve other related data from associa

Re: 'OneToOneField' object has no attribute 'get' in function-based view

2017-03-15 Thread Vijay Khemlani
Can you post the whole stack trace of the error? There are some things that don't make sense in the view function (for example returning "new_title" from the view) but they are not related to your initial error. On 3/15/17, Pedro Paulo Palazzo wrote: > > > I am writing a two-part form where I wa

Re: 'OneToOneField' object has no attribute 'get' in function-based view

2017-03-15 Thread Vijay Khemlani
path/to/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in > _get_response 185. response = wrapped_callback(request, > *callback_args, **callback_kwargs)File > "/path/to/project/objectinfo/views.py" in object_entry 45. > object_form = Objec

Re: Django and Nginx through uwsgi is not working

2017-03-16 Thread Vijay Khemlani
Not sure if a typo on your email, but your command says "chown nginx:nginx -R /sockect/uwsgi.sock" sockect ? On 3/16/17, valerio orfano wrote: > Hi All > > i ve created a django application not using virtual environment. I ve > installed nginx and trying to integrate them via uwsgi application.

Re: Error running Django tutorial

2017-03-16 Thread Vijay Khemlani
Why is there a backslash in from django.conf.urls import polls\ ? On 3/16/17, Camilo Torres wrote: > Hi. > > You may have a strange, non-visible character in your file just before the > line giving error. > > -- > You received this message because you are subscribed to the Google Groups > "Djan

Re: Django and Nginx through uwsgi is not working

2017-03-17 Thread Vijay Khemlani
I fail to see what's so complex of uwsgi for a simple deploy, my typical configuration file has 8 lines On 3/17/17, Antonis Christofides wrote: >> Thanx you very much, i've spent days on this issue > I'm sorry to hear that, especially because when I was using uwsgi I was > also > spending days fo

Re: cannot get div to reload with ajax

2017-03-17 Thread Vijay Khemlani
And what error are you getting? The only weird thing I see at first is url: "{% url candidate_notes %}", If your JS file is a standalone file served as a static file then you have no "url" tag available inside it. On 3/17/17, Shezan Kazi wrote: > hi all, > > i am trying to reload a div that is

Re: Will function based views ever be deprecated?

2017-04-03 Thread Vijay Khemlani
Any function based view can be reduced to a CBV trivially class MyView(View): def get(request):# or post, or whatever http method Point is there are patterns that repeat themselves enough to justify CBV, aside from the benefits of using classes (inheritance, mixins, etc). Also

Re: Manage.py runserver is showing somthing else

2017-04-12 Thread Vijay Khemlani
Please copy and paste the whole stack trace (the messages on the command prompt) On Wed, Apr 12, 2017 at 3:01 PM, Divya Rajpurohit wrote: > I started learning django a few days ago & i am trying to run a example > project for a demo but when i put this command "manage.py runserver" it > show so

Re: Error with Tutorial - Writing your first Django app, part 1

2017-04-12 Thread Vijay Khemlani
In the first case he mispelled "urlpatters", it should be "urlpatterns" (notice the n) On Wed, Apr 12, 2017 at 3:47 PM, Lynn Capps wrote: > Shah, > > Did you get this figured out? I am having the same issue as you did. > > > > On Friday, December 9, 2016 at 1:50:22 PM UTC-6, shah wrote: >> >> Hi

Re: Django forks

2017-04-17 Thread Vijay Khemlani
Django is essentially a backend development framework (essentially receive http request, make http response) Ruby on Rails tried to integrate with a javascript "framework" in its time (Prototype / Scriptaculous if I remember correctly) and it exploded on their faces in my humble opinion. On Mon,

Re: Django forks

2017-04-17 Thread Vijay Khemlani
d basically had not been capitalizing on Django itself for > the last decade. > > Vijay, that RoR failed at it, fails to scare me out, and does not look > like a logic argument *for me*. I'm a lot more comfortable with failing > than with not trying. And even if it was really "

Re: How to set mysql database in setting up django setup in eclipse ?

2017-04-23 Thread Vijay Khemlani
I don't use Eclipse for development, but your screenshot says "Django version 1.1 or earlier" which is awfully old, we are at 1.11, as in there was a versions 1.2 1.3 1.4 1.5 1.11. settings file has changed a lot since that time. On 4/23/17, Pubudu Goonetilleke wrote: > Hi, > I am very new

Re: Models not appearing in Admin page.

2017-04-25 Thread Vijay Khemlani
Register in in the admin.py file https://docs.djangoproject.com/en/1.11/intro/tutorial02/#make-the-poll-app-modifiable-in-the-admin On Tue, Apr 25, 2017 at 9:46 AM, Ratul Shams wrote: > Hey Pythonistas! > I was working on Django and made a Model, but its not appearing on my > Django Admin page

Re: Make a separate table for a model without additional fields

2017-05-01 Thread Vijay Khemlani
Why do you need an additional model for automatic payments? I don't know the whole project, but I would just add a field to the Payment class On 5/1/17, Victor Porton wrote: > I store into the DB payments received through PayPal. Every payment is > either manual or automatic (automatic payment

Re: makemigration detect error

2017-05-06 Thread Vijay Khemlani
You are adding a non-null field to a table, so the existing rows from that table need a value to put in it to enforce the non-null rule. If you select 1, you type that value, and it is used for all previously existing rows in the table. On 5/6/17, Er. Rv Ranga wrote: > python manage.py makemigr

Re: get method inside class based view

2017-05-07 Thread Vijay Khemlani
Assuming this view is for a path like http://example.com/shortener If you make a GET request to it (as in navigating to it in a browser) it displays the form calling the "get" method in the view. When you submit the form it usually does so to the same URL but with the POST method. So in this cas

Re: Unicode error in __unicode__(self) function

2017-05-09 Thread Vijay Khemlani
Paste the whole stack traceof the error On 5/9/17, rmschne wrote: > > >> I'm sorry - but this isn't your real error. >> >> You will see it in your WSGI daemon logs once you set DEBUG to false. >> >> >> >> This error is caused by Django trying to print the error using ascii codec >> >> for the deb

Re: null value in column violates not-null constraint

2017-05-25 Thread Vijay Khemlani
"form.instance.user" should be "form.instance.seller" But the "null value in column" error could also apply to any of the non-nullable fields in your Product model that are not set by the time you save the instance. On 5/25/17, Ismail Sarenkapic wrote: > Tnx. > The slug is not important here.

Re: Retrieve field values from ManyToMany field in model

2017-06-25 Thread Vijay Khemlani
A DocumentMetaData instance may be associated with multiple documents and multiple metadata according to your model, so your question is ambiguous. If you want a particular DocumentMetaData to only refer to a single document and a single metadata then change the ManyToManyField for a ForeignKey I

Re: ModuleNot Found Error

2017-06-26 Thread Vijay Khemlani
Could you post the stack trace of the error? On Mon, Jun 26, 2017 at 5:35 AM, akhil kumar wrote: > this is my polls/urls.py > > > from django.conf.urls import url > from . import views > > urlpatterns=[ > url(r'^$',views.index,name='index'), >] > > > > mysite/urls.py > > > from djang

Re: 'migrate' does not find existing postgres database

2017-06-26 Thread Vijay Khemlani
Maybe I'm misunderstanding, but you don't access PostgreSQL databases as normal files with a path. If you were using SQlite that might work, but not on typical SQL databases (MySQL, Postgres, etc) On 6/26/17, Rich Shepard wrote: >This is my first django project and is intended for my own use

Re: NOVICE Question; Installing Django 1.11.2 in Python 3.6 with the correct path

2017-06-27 Thread Vijay Khemlani
You should run pip from the command line, not from inside the python interpreter shell On Tue, Jun 27, 2017 at 11:25 AM, wrote: > A a Novice to Python and to Django How do i install Django into the > correct path , I followed the instruction in a Django manual and got an > error message; How do

Re: Django signals **kwargs

2017-06-27 Thread Vijay Khemlani
https://docs.djangoproject.com/en/1.11/topics/signals/#receiver-functions We’ll look at senders a bit later, but right now look at the **kwargs argument. All signals send keyword arguments, and may change those keyword arguments at any time. In the case of request_finished, it’s documented as send

Re: Django signals **kwargs

2017-06-27 Thread Vijay Khemlani
; Okk. > > But what i am actually asking is, what type of contents does the **kwargs. > Give me a typical example of **kwargs in the context of signals. The actual > data **kwargs may contain. > > Yingi Kem > > On 27 Jun 2017, at 9:24 PM, Vijay Khemlani wrote: > >

Re: django webframework

2017-07-03 Thread Vijay Khemlani
You can use Django even if you are new to Python, but it will be more difficult (basically learning 2 things at the same time). You can run a django application over tomcat using Jython and django-jython, but I've never done so myself https://docs.djangoproject.com/en/1.11/howto/jython/ On Mon,

Re: Math filter

2017-07-19 Thread Vijay Khemlani
Also I guess mathfilters just executes left-to-right so a|mul:b|add:b|mul:c is (((a * b) + b) * c) On Wed, Jul 19, 2017 at 1:50 AM, James Schneider wrote: > > > On Jul 18, 2017 7:21 PM, "sum abiut" wrote: > > Hi, > needed direction maths filters on django templates. for example how to you >

Re: Math filter

2017-07-19 Thread Vijay Khemlani
I'm guessing he's using the mathfilters package https://github.com/dbrgn/django-mathfilters On Wed, Jul 19, 2017 at 7:28 PM, Mike Morris wrote: > Of course, if they're integers you could implement the "mul" as a loop of > "add"s... clumsy, but would work. > > On 07/19/2017 03:39 PM, Mike Morris

Re: Math filter

2017-07-20 Thread Vijay Khemlani
Don't worry, I only knew about the project because I use it in a small part of an application that can't execute computations on the view On Wed, Jul 19, 2017 at 10:02 PM, Mike Morris wrote: > On 07/19/2017 06:20 PM, Vijay Khemlani wrote: > >> I'm guessing he'

Re: Dos Modelos en un formulario django

2017-07-28 Thread Vijay Khemlani
Puedes crear un formulario común y corriente de Django class Formulario(forms.Form): ... campos del usuario ... campos de sus caracteristicas Y manejar la lógica en tu vista formulario = Formulario(this.request.POST) if formulario.is_valid(): ... actualizar usuario con campos de formul

Re: Unable to extend User model and see it in Django Admin

2017-07-29 Thread Vijay Khemlani
AUTH_USER_MODEL should point to your model class, not the model admin use AUTH_USER_MODEL = 'user_text.User' Assuming that the app where the User model lives is called "user_text" On Sat, Jul 29, 2017 at 12:56 PM, Binny Zupnick wrote: > I've tried many things, but I'll write what I currently

Re: Row based permissions: In DB or App? ... farewell pain

2017-08-07 Thread Vijay Khemlani
I use django-guardian for object level permissions and it works surprisingly well On Mon, Aug 7, 2017 at 4:59 AM, Antonis Christofides < anto...@djangodeployment.com> wrote: > Hello, > > This is a tricky issue and we need to start from the basics. You already > know the basics, but they bear repe

Re: database tables are not being created

2017-08-07 Thread Vijay Khemlani
As far as I know you also need to declare the app_label for each model class Meta: app_label = 'your_app_name_here' On Mon, Aug 7, 2017 at 4:15 PM, Andréas Kühne wrote: > Ok, > > Regarding point 2 there - have you added the models to the __init__.py > file? Imported them as in: > > from .mo

Re: Row based permissions: In DB or App? ... farewell pain

2017-08-09 Thread Vijay Khemlani
https://django-guardian.readthedocs.io/en/stable/userguide/check.html#get-objects-for-user projects = get_objects_for_user(request.user, 'projects.view_project') On Wed, Aug 9, 2017 at 10:55 AM, guettli wrote: > > > Am Mittwoch, 9. August 2017 10:04:25 UTC+2 schrieb James Schneider: > >> >> >>

Re: Row based permissions: In DB or App? ... farewell pain

2017-08-10 Thread Vijay Khemlani
> > > Am Mittwoch, 9. August 2017 18:03:44 UTC+2 schrieb Vijay Khemlani: >> >> https://django-guardian.readthedocs.io/en/stable/userguide/ >> check.html#get-objects-for-user >> >> projects = get_objects_for_user(request.user, 'projects.view_project')

Re: How to use try..except, but when DEBUG is True, show the error?

2017-08-12 Thread Vijay Khemlani
from django.conf import settings try: x = parse_date('') except TypeError: if settings.DEBUG: raise else: return False On Sat, Aug 12, 2017 at 10:54 AM, Fellipe Henrique wrote: > Hello, > > i have these code, for example: > > try: >x = parse_date('') > except TypeErr

Re: Row based permissions: In DB or App? ... farewell pain

2017-08-16 Thread Vijay Khemlani
So, please share the specific numbers you got from your profiling. On Wed, Aug 16, 2017 at 6:10 AM, guettli wrote: > > > Am Donnerstag, 10. August 2017 14:30:31 UTC+2 schrieb Vijay Khemlani: >> >> It's still implemented like that in the background, but I'm not

Re: Making/Creating a verified user for unit test (django-allauth)

2017-08-17 Thread Vijay Khemlani
Check that the created user has the "is_active" field set to True On Thu, Aug 17, 2017 at 2:41 AM, Desmond Lim wrote: > Hi there, > > I'm wonder, how do we create a verified user for testing purpose > > I have this line that creates a user > > *cls.user = get_user_model().objects.create_user(use

Re: Row based permissions: In DB or App? ... farewell pain

2017-08-17 Thread Vijay Khemlani
bject-level permissions extensively in my own project and haven't had any performance issues yet. If nothing else, your results would prove useful to the community. On Thu, Aug 17, 2017 at 10:18 AM, guettli wrote: > > > Am Mittwoch, 16. August 2017 13:39:53 UTC+2 schrieb Vijay

Re: please help me about django error that encoding is wrong

2017-08-22 Thread Vijay Khemlani
What is the hostname of your machine? If you are using Windows then you can execute "ipconfig /all" on a cmd prompt On Mon, Aug 21, 2017 at 11:27 PM, 輝夜三日月 wrote: > >

Re: Deploy app under subdirectory

2017-08-28 Thread Vijay Khemlani
If possible try and run as a subdomain myapp.mydomain.com it is easier to configure things in that case On Sun, Aug 27, 2017 at 11:39 PM, Angel Ruiz wrote: > Hello everybody, I need run my app under subdirectory, e.g. > mydomain.com/myapp > > I have one app running with Nginx and Gunicorn in U

Re: how to write APIview to access a specific item by using APIViews only

2017-09-05 Thread Vijay Khemlani
To retrieve a particular object in your API you should implement it in a method called "retrieve", not "get", if I remember correctly On Tue, Sep 5, 2017 at 10:28 AM, Rakhee Menon wrote: > CODE: > > class FormList(APIView): > def get(self, request, id): > import ipdb;ipdb.set_trace() > item_obj

Re: Email validation in form

2017-09-12 Thread Vijay Khemlani
"asdf@asdf" is not a valid email so form.is_valid returns False and form.save is never called On Tue, Sep 12, 2017 at 4:52 AM, Moreplavec wrote: > Greetings, > > i have strange problem with my model form. I have simple form for taking > orders, model looks like: > > class Order(models.Model):

Re: Email validation in form

2017-09-12 Thread Vijay Khemlani
erstand, but why while using model form it's not cought by form > itself same as missing or incorect field like "asdf" for email? This is my > problem. I need to show error and not to try to save :) > > > > Dne úterý 12. září 2017 12:47:16 UTC+2 Vijay Khemlani nap

Re: make a button element outside be on the right side of another element inside

2017-09-28 Thread Vijay Khemlani
An input with type "button" instead of "submit" should not trigger the form submit. On Thu, Sep 28, 2017 at 7:56 PM, fábio andrews rocha marques < fabioandrewsrochamarq...@gmail.com> wrote: > In my template, I have a form. This form has a lot of textfields and a > submit button. There's another b

Re: help with my signup api

2020-05-13 Thread Vijay Khemlani
in your code data is json.dumps(request.data), which is a string representation of the json dictionary so data is a str and then you are trying to do item assignment to it On Wed, May 13, 2020 at 8:05 AM ola neat wrote: > good day guys, please i need help with my signup api, when the user click

Django 1.8 migrations showing "AttributeError"

2015-07-27 Thread vijay kumar
Hi, Problem: Empty migration doesn't show user friendly message. When i run "python manage.py migrate" with no new migrations to be applied it show me error message "AttributeError: '_Meta' object has no attribute 'model_name'" instead of showing user friendly message "no migration to apply"

Re: Passing parameters / attributes to javascript in a template

2015-08-04 Thread Vijay Khemlani
Have you checked the HTML that is actually rendered by the Django template? On Tue, Aug 4, 2015 at 10:39 AM, Déborah Leder wrote: > Hello Larry, thank you for your response. > > I didn't run the debugger, but i know that my values are correctly passed > in the template (when it it outside of the

Re: Django 1.6.11 model class query

2015-08-19 Thread Vijay Khemlani
I'm guessing Django does not update all of the fields of the instance when saving it, only the id On Wed, Aug 19, 2015 at 11:31 AM, Nikunj Badjatya wrote: > Also, > When the same object is retrieved using > > > print(Test.objects.get(id=row.id).uuid) # Prints uuid. > > > > -- > You received thi

Re: Integrating RabbitMQ with Django

2015-09-16 Thread Vijay Khemlani
Celery would be the usual choice for this, why is it not an option? Seems far easier and more stable than trying to use a webserver as a queue worker. On Wed, Sep 16, 2015 at 10:22 AM, Erol Merdanović wrote: > Hi all > > I'm using Django to develop a service. Service connects to RabbitMQ and > r

Re: Integrating RabbitMQ with Django

2015-09-16 Thread Vijay Khemlani
Is the origin of the messages something different than your Django application? Seems overkill to have a custom message format. On Wed, Sep 16, 2015 at 10:34 AM, Erol Merdanović wrote: > Hello Vijay > > The differences are > 1. Celery message and our message has different format

Re: Best way to trigger javascript function when returning a page from django view

2015-09-20 Thread Vijay Khemlani
"It's true that when it's not filled correctly, the form returns the validation but we have cases in which the data in the fields is not returned when the form operation is not successful." What cases? Dynamic fields or something like that? Django forms are supposed to pre-fill all the fields when

Re: [newbie] import error after restart (virtualenv)

2015-09-20 Thread Vijay Khemlani
Aren't tests supposed to run with "python manage.py test lists"? On Fri, Sep 18, 2015 at 8:55 PM, David wrote: > Dear Django experts, > > I am reading through Harry Percival's "Test-Driven Development with > Python". > > As I finished chapter 3 yesterday, I was fully on track, perfectly > aligne

Re: Django was present in FSD in Costa Rica

2015-09-21 Thread Vijay Khemlani
Felicitaciones desde Chile también, y espero que más gente por allá se interese en el framework :) On Mon, Sep 21, 2015 at 5:26 PM, Rafael E. Ferrero wrote: > BUENÍSIMO LUIS!!! EXCELENTE INICIATIVA!!! > > Muchos exitos para tí y para Django en Costa Rica > > Saludos, Rafael Ferrero (desde Argent

Re: Method call at end of Django session

2015-10-02 Thread Vijay Khemlani
Also it is most likely inconsistent if the user has the same webpage opened on two different tabs On Fri, Oct 2, 2015 at 5:55 PM, Andreas Kuhne wrote: > Hi, > > I don't think you can reliably do that. Django never knows when the user > closes his browser window. Because a session is stateless (t

Re: KeyError

2015-10-07 Thread Vijay Khemlani
"is_valid" is a method, you should call if user_form.is_valid(): ... On Wed, Oct 7, 2015 at 2:14 PM, Benjamin Smith wrote: > I am making a registration form to register new users using the User model. > > This is the forms.py: > > class UserForm(forms.ModelForm): > confirm_email = forms

Re: Reverse access model through a “double” ForeignKey

2015-10-14 Thread Vijay Khemlani
Value.objects.filter(grouping__build=your_build) I guess You can add it as a method to the Build class On Wed, Oct 14, 2015 at 6:11 AM, Gergely Polonkai wrote: > Hello, > > I have three models: > > • Build > • BuildGrouping, with a ForeignKey “build” pointing to Build > • Value, with a ForeignK

Re: Cron Job

2015-10-14 Thread Vijay Khemlani
The easiest way would be using a custom management command https://docs.djangoproject.com/en/1.8/howto/custom-management-commands/ On Wed, Oct 14, 2015 at 10:53 AM, 'Chris Norman' via Django users < django-users@googlegroups.com> wrote: > Hi again, > I would like to set up a cron job to email th

Re: Question about Django Tutorial Part 5

2015-10-15 Thread Vijay Khemlani
The "create" method (as in Question.objects.create) saves the object to the database On Thu, Oct 15, 2015 at 6:08 AM, Shun Liang wrote: > Dear All, > > In the 5th part of the Django Tutorial ( > https://docs.djangoproject.com/en/1.8/intro/tutorial05/#testing-our-new-view > ), there is a helper f

Re: Issues with django-storages and gunicorn processes

2015-10-22 Thread Vijay Khemlani
Media Library? I'm not aware of something like that in django-storages On Wed, Oct 21, 2015 at 5:22 PM, Mike Herring wrote: > I am using django-storages to store media files in Amazon S3. > > Gunicorn spaws three worker processes, each running their own copy of > S3BotoStorage. When I go into fi

Re: How do I let forms.models.ModelChoiceField.queryset relate on request.user?

2015-11-02 Thread Vijay Khemlani
At least what I do in those cases is to add a constructor (__init__) to the form class which takes the user as a parameter, modify the choicefield queryset, and then call the original constructor of the form. On Sun, Nov 1, 2015 at 3:50 PM, Axel Rau wrote: > User should see only choices related

<    1   2   3   4   5   >