RE: Send mail after x hours

2016-08-17 Thread Dheerendra Rathor
I’ll suggest you to use some background task runner. Celery will work great for you as it is developed for Python and work on multiple platform with multiple types of message queues. Sent from Mail for Windows 10 From: Kishan Mehta -- You received this message because you are subscribed to th

Queries regarding Custom Managers with model inheritance.

2016-06-09 Thread Dheerendra Rathor
I was going through https://docs.djangoproject.com/en/1.9/topics/db/managers/#custom-managers-and-model-inheritance regarding custom managers and I decided to do some tests. Here are my models: from django.db import models class CustomManager(models.Manager): use_for_related_fields = T

Django tests on postgresql with fixtures

2016-03-09 Thread Dheerendra Rathor
According to django testing docs - database is flushed after each TestCase. It is working fine when I'm using sqlite for testing. But database is not flushed when using postgresql and testcases are failing since it is trying to load fixtures which have been loaded in previous TestCase. Is ther

Re: Redis cache for Django

2016-03-07 Thread Dheerendra Rathor
ctures in your project? > > On Mon, Mar 7, 2016 at 4:50 PM, Dheerendra Rathor < > dheeru.ratho...@gmail.com> wrote: > >> Hey folks, >> >> This post is for getting opinions >> >> I want to use Redis cache for my Django project. I found two apps for

Redis cache for Django

2016-03-07 Thread Dheerendra Rathor
Hey folks, This post is for getting opinions I want to use Redis cache for my Django project. I found two apps for that Django Redis (https://github.com/niwinz/django-redis) and Django Redis Cache (https://github.com/sebleier/django-redis-cache). I was going through docs and both looks promisi

Re: Single Page Application in Django

2016-03-07 Thread Dheerendra Rathor
Trying googling DRF django or DRF python. Anyway it is Django Rest Framework :-) On Monday, 7 March 2016 19:50:35 UTC+5:30, bob gailer wrote: > > > On Mar 7, 2016 7:04 AM, "Avraham Serour" > > wrote: > > > > DRF > I'll bite - what is DRF? Google does not help with that. > -- You received thi

3 level nested prefetch is not working on Django 1.8.x

2016-02-26 Thread Dheerendra Rathor
Three level nested prefetch with custom queryset throws an Attribute Error. It works perfectly fine on Django 1.9 but I was unable to find release notes or bug fix notes of the same. To reproduce: 1. Install Django 1.8.6+ 2. Add models from https://github.com/DheerendraRathor/Django-bugs/blo

Re: User logged in at same time as admin superuser?

2016-02-13 Thread Dheerendra Rathor
Extending on monoBOT's answer, you can also use your private IP (like 192.168.x.x) for another session. Though you need to start server on 0.0.0.0 On Sun, 14 Feb 2016 at 06:10 monoBOT wrote: > You can do that... > > For one of the users go to localhost:8000 and for the other go to > 127.0.0.1:80

Re: Django is creating duplicate queries for prefetch_related

2016-02-13 Thread Dheerendra Rathor
Thanks Tim, from the ticket and Patch it looks like this was my issue. On Sun, 14 Feb 2016 at 08:20 Tim Graham wrote: > Maybe https://code.djangoproject.com/ticket/25546 fixes it? This will be > in Django 1.10. > > > On Friday, February 12, 2016 at 10:18:22 PM UTC-5, Dheerend

Django is creating duplicate queries for prefetch_related

2016-02-12 Thread Dheerendra Rathor
Hello, Recently I was monitoring db queries created by Django and a particular block was behaving unusual. Here is the code block: from django.db import connection, reset_queries reset_queries() group = get_object_or_404( Group.objects.select_related('course')

Re: Front End and Back End separation

2016-02-11 Thread Dheerendra Rathor
nt - i.e. several deployments / day) > > > > On Thursday, February 11, 2016 at 2:24:51 AM UTC+1, Dheerendra Rathor > wrote: > >> If you don't want FE guys to touch your Python code, I will suggest to go >> with option 1. DRF is a great library and creating REST API is d

Re: Front End and Back End separation

2016-02-10 Thread Dheerendra Rathor
If you don't want FE guys to touch your Python code, I will suggest to go with option 1. DRF is a great library and creating REST API is dead simple. Data validation is pretty easy in DRF using serializers. I tend to write my own authorization methods with DRF but they are also easy. It is just plu

Re: Setting up django mailbox

2016-02-04 Thread Dheerendra Rathor
Are you sure imap.company.com is handling your imap server and not imap.google.com? On Thu, 4 Feb 2016 at 23:24 Daniel Chimeno wrote: > Hello, > If you are writing about his project: > https://github.com/coddingtonbear/django-mailbox I guess > it's better to ask in the issues page of that projec

Re: django unittest with post not working

2016-02-04 Thread Dheerendra Rathor
302 looks Okay as you're being redirect to LOGIN_REDIRECT_URL. During posting new branch, start your URL with `/` like r = self.client.post('/brand/new/', {'name': 'poko'}) On Thu, 4 Feb 2016 at 22:32 JAMES DAMILD ETIENNE wrote: > Hi , will some help with this please , > I am writting a djang

Re: How known duration (length) video and audio files?

2016-02-04 Thread Dheerendra Rathor
This is not a Django problem. But for getting length of streams (vidoe and audio) I use python ffprobe ( https://pypi.python.org/pypi/ffprobe/0.1). This is a wrapper over ffmpeg. On Thu, 4 Feb 2016 at 18:53 ylativ oknesyl <2vlyse...@gmail.com> wrote: > I need third-party library from pypi, that

Re: Additional Search/Filtering based on a Model's fields in horizontal_filter

2016-01-20 Thread Dheerendra Rathor
You can add your fields in search_fields in ModelAdmin to make them searchable. On Thu, 21 Jan 2016 at 03:35 Keehun Nam wrote: > Hi Django Users, > > Is there a preexisting solution where I can have an admin widget like > horizontal_filter except it has the ability to search by the model's field

Re: Debugging Django with Debug set to False

2016-01-06 Thread Dheerendra Rathor
What I do is to log things in log files. All exceptions are logged in error.log files and I've enabled admin mail which sends me an email whenever there is an exception. So basically logs and emails are quite helpful in debugging and makes it smooth. On Wed, 6 Jan 2016 at 10:20 Web Architect wrot

Re: Django + Ckeditor

2016-01-05 Thread Dheerendra Rathor
Adding to whycrying's method, you can use {{ content|safe }} to escape things as well. On Sun, 3 Jan 2016 at 19:13 whycrying wrote: > Hi, David, > > You can close the auto-escaping behavior like this :: > > {% autoescape off %} > {{ content }} > {% endautoescape %} > > ref: > https

Strange behaviour while deleting related object

2015-12-31 Thread Dheerendra Rathor
Hello All, I have a model like this: class Concept(models.Model): tag = models.ForeignKey(Tag, null=True, on_delete=models.SET_NULL) Now, I've a piece of code in my view: if concept.tag: concept.tag.delete() concept.save() I'm getting this error in line concept.save() ValueError: sav

Re: Commenting system to use to build with REST API

2015-12-23 Thread Dheerendra Rathor
You can write your own system with just two models - Post and Comment. Then write custom serializers and viewsets to submit comments. It's an easy task and won't take much of your time. I've worked in similar fashion on few of my own works. Here is a link of custom models I wrote: https://github.c

Re: i just tried django with microsft visual studio

2015-12-09 Thread Dheerendra Rathor
Pass view in url as url(r'^$', app.views.home, name='home'), URL with string view has been deprecated. On Thu, 10 Dec 2015 at 03:31 Emmanuel Olodun wrote: > hello > i just tried django with visual studio, on performing migration i got this > error report can some please help out? dont know how t

Re: Why my aggregate is not working?

2015-11-05 Thread Dheerendra Rathor
Are you sure you want to use aggregate? Aggregate will return you a dictionary like {'total': 10}. Probably you want to use annotate which will return you a queryset. On Thu, 5 Nov 2015 at 22:09 Fellipe Henrique wrote: > Hi, I have these model: > > class ProductClicks(models.Model): > produc

Re: django-admin.py startproject mysite

2015-11-04 Thread Dheerendra Rathor
Start your site with python manage.py runserver 0.0.0.0:8000 On Thu, 5 Nov 2015 at 11:35 Muhammad Asamov wrote: > HI > I was wodering whether someone can hepl me with startproject > > The thing is when I am running startproject from the server ip > 127.0.0.1:8000 > which was created automaticly

Re: How do I relate two tables using field name instead of id?

2015-11-04 Thread Dheerendra Rathor
In your model use define __str__ method to name1. Then django admin will use name1 in dropdown box. On Wed, 4 Nov 2015 at 21:50 frocco wrote: > Hello, > > I have two existing tables > table1 has name1 > > table2 has name2 > > when I edit table2 in admin, I want a dropdownbox that shows values fr

Re: Best practices for writing functional tests to exercise forms?

2015-11-04 Thread Dheerendra Rathor
You can use unittest.TestCase.assertRegexpMatches for checking if form is present in rendered template. If you want to check the entire cycle (form loading, filling) you can use selenium for testing on live server. On Wed, 4 Nov 2015 at 22:08 Tim Chase wrote: > Beginning a new project, I'd like

Re: Login with email address

2015-11-04 Thread Dheerendra Rathor
By default emails are not unique in Django. There are several approaches you can use: 1. In your login view use email to fetch user and then call authenticate for username. For signup you can use any garbage username! 2. Write custom user model (Just extend User model and change USERNAME_FIELD to e

Re: Form to login

2015-11-03 Thread Dheerendra Rathor
Django do have built-in forms. Take a look here https://docs.djangoproject.com/en/1.8/topics/auth/default/#module-django.contrib.auth.forms On Wed, 4 Nov 2015 at 11:21 Dariusz Mysior wrote: > I try do login view and I find it on > > https://docs.djangoproject.com/en/1.8/topics/auth/default/ > >

Re: MySQL queries-connection to django

2015-10-29 Thread Dheerendra Rathor
Hi, Django docs discuss about mysql connection here https://docs.djangoproject.com/en/1.8/ref/databases/#mysql-db-api-drivers On Fri, 30 Oct 2015 at 07:12 Sid wrote: > So there is any way before creating model we can connect django sql server > 2012 > > > On Wednesday, October 28, 2015 at 11:18:

Re: django filebrowser decoding

2015-10-29 Thread Dheerendra Rathor
Do you have the full stacktrace? Can you post that here? On Fri, 30 Oct 2015 at 02:37 Emīls Brass wrote: > I got django filebrowser for admin, where admin can see all added files in > special folder. > > When admin click on folder to see whats inside, if there is some file with > name who contain

Re: Standalone Project using django ORM

2015-10-27 Thread Dheerendra Rathor
Is this the full stacktrace? Looks like error message is missing in stacktrace. On Wed, 28 Oct 2015 at 04:05 ADEWALE ADISA wrote: > Hello; > I have being having issues trying to use django orm in my application. > This issues occur when using django 1.85. The application run perfectly > well on

Re: Template variables not showing up in web-page

2015-10-23 Thread Dheerendra Rathor
signature for request is render(request, template_name, context, **kwargs) So it should be like render(request, 'response_page.html', context=context) On Sat, 24 Oct 2015 at 01:21 CTA2052 wrote: > Hello All, > > This may be the most basic question to ask and believe me it does not come > withou

Get unversioned static file url while using CachedStaticFilesStorage

2015-10-11 Thread Dheerendra Rathor
Hello all, I want to retrieve static file url without version number for a specific static file url while using staticfiles app. Is there any way to achieve this with {% static %} tag? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsub

Re: Ajax in Django

2015-08-31 Thread Dheerendra Rathor
Ajax are just normal HTTP requests. You can write a view in your code which returns data from db. If it is a post requests then make sure you're adding "csrfmiddlewaretoken" in the ajax data. On Mon, 31 Aug 2015 at 19:30 jasir1903 wrote: > How to retrive Data from Db in Django to Template using

Re: Moderator and publishing workflow implementation in Django

2015-08-28 Thread Dheerendra Rathor
Django has auth apps (Admin) and it also has user groups, permissions. What you asking is quite simple, you can add your editor and moderator on admin site, can write custom actions to do on news articles. On Fri, 28 Aug 2015 at 20:53 Shawn Milochik wrote: > One easy solution: > > Add an "approv

Re: Pick up information for the current session out of view

2015-08-28 Thread Dheerendra Rathor
what do you mean by another file? Please be specific. On Fri, 28 Aug 2015 at 18:28 Aurélio Moreira wrote: > I'm friends with the problem, I'm recording some data in the session, and > I need to catch them out of view, I tried to create a session using the > following code: > > > s = SessionStore

WHEN EXISTS Query in SQL to Django Queryset

2015-08-20 Thread Dheerendra Rathor
Hello, I've a complex SQL Query SELECT DISTINCT "event_event"."id", "event_event"."title", "event_event". "description", "event_event"."category", "event_event"."event_time", "event_event"."event_place", "event_event"."time", "event_event"."cancelled" , "event_event"."posted_by_id", CASE WHEN E

Re: Query question

2015-08-17 Thread Dheerendra Rathor
You should use 'F' expression from django.db.models So your expression would be like: ProductSale.objects.all().filter(date_expires__lt = now().date).exclude( date_purchased__gt = F('date_expires')) Which roughly translates to SELECT * FROM productsale WHERE date_expires < CURRENT_DATE AND NOT

Re: Query question

2015-08-17 Thread Dheerendra Rathor
You should use 'F' expression from django.db.models So your expression would be like: ProductSale.objects.all().filter(date_expires__lg = now()).exclude(date_purchased__gt = F('date_expires')) On Tuesday, 18 August 2015 06:26:56 UTC+5:30, Lee Hinde wrote: > > Given this model, I want to find

Re: Not able to retain data in session after login

2015-08-16 Thread Dheerendra Rathor
Make sure you're not using 'dummyCache' in CACHE setting. And also check if you're not accidentally destroying the session. On Monday, 17 August 2015 00:25:14 UTC+5:30, Anil Kumar wrote: > > Hello All, > > In my web application, I am making an ajax call to save data in session as > user clicks

Accessing Django models using DJANGO_SETTINGS_MODULE

2015-03-08 Thread Dheerendra Rathor
I've a django project and I've few models like ChatRoom and Chat etc I'm accessing the ChatRooms from commandline using ipython as follow In [1]: import os In [2]: os.environ['DJANGO_SETTINGS_MODULE'] = 'chat_project.settings' In [3]: from chat.models import Chat, ChatRoom In [4]: ChatRoom.obje