Re: Project Structure - Lots of scattered custom views

2013-01-08 Thread Sanjay Bhangar
hey all, This seems to be an itch I've had to scratch myself in the past - let me see if I understand the situation vaguely correctly: You have a site that uses Django / database features for some things, but then you also have a lot of content that's being designed in some design tool and needs

Re: Project Structure - Lots of scattered custom views

2013-01-13 Thread Sanjay Bhangar
On Sat, Jan 12, 2013 at 12:04 AM, chad petzoldt wrote: > Sanjay, you were hitting things pretty close. I think that making sure slug > names match up to real *static* locations is the key. I am hosting with > Apache, and I thought about using some configurations to cheat a little bit, > and get so

Re: Project Structure - Lots of scattered custom views

2013-01-15 Thread Sanjay Bhangar
On Mon, Jan 14, 2013 at 8:16 PM, chad petzoldt wrote: >> It had occurred to me that Django wasn't the right tool for this job - >> not everything is a nail :) > > > I am embedding these files within a template, so they are not direct static > serves. But the content must be inserted within the tem

Re: Generic views and url issues

2013-01-23 Thread Sanjay Bhangar
(reply inline) On Thu, Jan 24, 2013 at 5:09 AM, wrote: > I've been trying to understand how to use generic views. I've followed some > tutorials, and read through Django docs, but I can't get the url function to > work in my templates. > > I get the error > NoReverseMatch at /testadcall/ > > Re

Re: Moving a Django website to another server

2013-01-26 Thread Sanjay Bhangar
On Sat, Jan 26, 2013 at 7:09 AM, Addy Yeow wrote: > I was looking for a consistent and error-free deployment as I switch > between servers frequently despite using the same public domain. rsync > was great but I had to manually reload server thereafter or issue a > syncdb, etc. > > I have since mo

Re: Automating deployments

2013-02-03 Thread Sanjay Bhangar
On Sun, Feb 3, 2013 at 1:32 PM, Ashwin Kumar wrote: > thats so kind of you, i struggled a lot for 1 month to setup a server > (ubuntu+nginx+uWSGI+mysql+pil+virtualenv+emperor). > still i didn't succeed running emepror on system restart, i removed > virtualenv as i got python-mysqldb error. > for

Re: On the fly image resize

2013-02-03 Thread Sanjay Bhangar
On Mon, Feb 4, 2013 at 6:32 AM, Spencer Summerville wrote: > Hello, there are a lot of solutions to resizing images in Django. I commend > you for wanting to create your own solution, but one of the greatest things > about Django is that there's tons of projects that people have made that > solve

Re: How to associate a formset with a field in a form

2013-02-12 Thread Sanjay Bhangar
Hey, I, too, initially found the formsets documentation a bit confusing, but they're quite straightforward to work with once you figure them out.. Firstly, you probably want to use inlineformset_factory and not formset_factory: https://docs.djangoproject.com/en/dev/ref/forms/models/#django.forms.

Re: Has the djangoproject.com site been down?

2013-02-13 Thread Sanjay Bhangar
for future reference, I find http://downforeveryoneorjustme.com/ to be quite useful for checking this sort of thing On Wed, Feb 13, 2013 at 5:12 PM, Babatunde Akinyanmi wrote: > Its not just you, at least when I'm not trying with my phone. > > ..and say your from Nigeria not Africa > > Sent f

Re: Need help with GeoDjango distance query.

2013-02-16 Thread Sanjay Bhangar
On Fri, Feb 15, 2013 at 10:00 PM, mack the finger wrote: > http://stackoverflow.com/questions/14889780/distance-query-within-a-certain-distance-based-on-value-in-joined-table > > Basically I want all objects within a certain distance, AS WELL as within > each object's preferred distance. > just o

Re: plugin for selecting files

2013-03-15 Thread Sanjay Bhangar
Hey, I believe there are some jquery plugins by now to handle asynchronously uploading multiple files, and they should contain some examples of how to handle them on the server side - this is one thing I found on github - https://github.com/sigurdga/django-jquery-file-upload , though I'm certain t

Re: plugin for selecting files

2013-03-16 Thread Sanjay Bhangar
On Sun, Mar 17, 2013 at 12:00 AM, Larry Martell wrote: > > Is there a way for me to get the path on the local computer of the > files? In request.FILES all I see are the base names. > No. That would be pose serious security / privacy issues and afaik, is definitely not possible to do. What would

Re: Changing User model

2013-03-18 Thread Sanjay Bhangar
Hey L, On Mon, Mar 18, 2013 at 9:13 AM, Lachlan Musicman wrote: > Hola, > > For a new project, I will be creating a separate Profile class for all > information about my Users that isn't covered by User. > > One thing I did want though, was to change the login username to the > email address. >

Re: Changing User model

2013-03-18 Thread Sanjay Bhangar
27;Permissions' dict in the fieldsets attribute of your custom UserAdmin class. Hm, the value of looking at code again with a clear head :) I think I just lost myself a bit fiddling with it the last time I looked at it, also working on adding tangential functionality that may have thrown me

Re: m2m symmetry confusion

2013-04-11 Thread Sanjay Bhangar
Lachlan, Not sure if I grokked your problem exactly, but just from personal experience when I found my brain turned to jelly with a similar-sounding issue before, I believe I found the answer in the "symmetrical=False" option .. I do believe setting symmetrical=False for your 'parents' and 'childr

Re: PostgreSQL on windows 7 (psycopg2 install problem)

2013-04-14 Thread Sanjay Bhangar
On Windows, I'd strongly recommend just installing the pre-compiled binaries for these sort've things, unless you're experienced with compiling software / making this sort've thing work on Windows .. So, install something like http://www.stickpeople.com/projects/python/win-psycopg/ and then, make

Re: Help with integration of bootstrap and Django 1.4.3

2013-04-20 Thread Sanjay Bhangar
On Sat, Apr 20, 2013 at 10:43 AM, Paras Nath Chaudhary < opnchaudh...@gmail.com> wrote: > How I do this is in settings.py: > PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) > STATIC_ROOT = os.path.join(PROJECT_ROOT, '../static') > STATIC_URL = '/static/' > STATICFILES_DIRS = ( > # Pu

Re: An easy way to integrate Jcrop in Django's admin?

2013-06-26 Thread Sanjay Bhangar
On Wed, Jun 26, 2013 at 3:48 AM, thoms wrote: > An easy way to integrate Jcrop in Django's admin? > > Hello, > > I'm new in the Django world, and I have a question regarding image > resizing. > > What I'm trying to do: > 1) A user upload an image in the admin > 2) He is shown the Jcrop interf

Re: wsgi + XAMMP

2013-06-26 Thread Sanjay Bhangar
Hi Timur, If you are using this to test / develop on your local machine, you should not need XAMPP. Django comes with its own testing development server, so you should not need Apache if you are using this to test / develop locally. The way I have done this on Windows is just install the python b

Re: Get Form from string?

2013-07-01 Thread Sanjay Bhangar
Hey MacVictor, So when I needed to do something similar, I landed up hard-coding a dict with form-name -> form-class in my model definition. Honestly, there is probably a better way to do it, but that worked fine for my use-case, though it did feel slightly "not right". Any-how, fwiw, I did someth

Re: Django 1.6 doesn't install via pip

2013-07-01 Thread Sanjay Bhangar
On Sun, Jun 30, 2013 at 8:00 PM, Lachlan Musicman wrote: > Hola, > > I read the release notes, and tried to install 1.6. I encountered this > error: > > $ pip install Django==1.6b1 > Downloading/unpacking Django==1.6b1 > Could not find a version that satisfies the requirement > Django==1.6b1 (f

Re: Returning data from view to ajax call

2013-07-02 Thread Sanjay Bhangar
On Tue, Jul 2, 2013 at 3:37 PM, Larry Martell wrote: > On Tue, Jul 2, 2013 at 4:24 PM, Sithembewena Lloyd Dube > wrote: > > What data format is your view returning? Django views return HTTP > response > > objects (by default, at least) - although Python lists (and other Python > > collections?) s

Re: Returning data from view to ajax call

2013-07-02 Thread Sanjay Bhangar
On Tue, Jul 2, 2013 at 4:01 PM, Larry Martell wrote: > > In the browser the response has this: > > HTTP/1.0 200 OK > Date: Tue, 02 Jul 2013 22:53:47 GMT > Server: WSGIServer/0.1 Python/2.7.2 > Vary: Cookie > Content-Type: text/plain > > No content. But I verified from pdb that the python code is

Re: Returning data from view to ajax call

2013-07-02 Thread Sanjay Bhangar
On Tue, Jul 2, 2013 at 4:20 PM, Larry Martell wrote: > On Tue, Jul 2, 2013 at 5:14 PM, Sanjay Bhangar > wrote: > > On Tue, Jul 2, 2013 at 4:01 PM, Larry Martell > > wrote: > >> > >> > >> > >> In the browser the response has this: > >

Re: CSRF verification failed

2013-07-06 Thread Sanjay Bhangar
On Sat, Jul 6, 2013 at 9:38 AM, Kakar Arunachal Service < kakararunachalserv...@gmail.com> wrote: > Hello! > I am getting CSRF verification failed error, even after i added {% > csrf_token %} tag in the html file. > > Here's my html file: > > {% extends "base.html" %} > {% block title %} User Regi

Re: Big Picture?

2013-07-07 Thread Sanjay Bhangar
On Sun, Jul 7, 2013 at 7:05 AM, Amirouche Boubekki < amirouche.boube...@gmail.com> wrote: > Hi, > > I have a diagram I call big picture, you might find it useful (see > attachment). > > Anything green is most of the time provided by the framework at least it > is the case in Django. > > Anything g

Re: PDF generator in Django

2013-08-05 Thread Sanjay Bhangar
On Mon, Aug 5, 2013 at 12:27 PM, Nigel Legg wrote: > I'm currently looking at ReportLab following > https://docs.djangoproject.com/en/dev/howto/outputting-pdf/ - but open to > suggestions. > > i have used wkhtmltopdf for this .. not a django / python tool per se, but I could make my pages as norm

Re: Middleware Causing OperationalError: (2006, 'MySQL server has gone away')

2013-09-10 Thread Sanjay Bhangar
On Tue, Sep 10, 2013 at 7:50 PM, Paul Childs wrote: > I went as far as to reboot my machine. > I tried the view and it worked but then my other view started exhibiting > the same error message. > > Not sure if this helps, but I saw this once recently on a colleague's windows machine. I'm going to

Re: Restrict access to user-uploaded files to authorized users

2013-09-26 Thread Sanjay Bhangar
On Thu, Sep 26, 2013 at 6:54 AM, m1chael wrote: > I think Xsendfile is what you want > > +1. I know the OP said it maybe hard to install apache modules, but I would really try and check with the host, etc. - it should ideally not be such an issue to install mod-xsendfile, and this is exactly the

Re: Image browsing in django

2013-10-16 Thread Sanjay Bhangar
Harjot, It is enctype='multipart/form-data' and not encoding='multipart/form-data' Hope that helps - all the best, Sanjay On Wed, Oct 16, 2013 at 10:11 AM, Harjot Mann wrote: > On Mon, Oct 14, 2013 at 9:48 PM, Harjot Mann wrote: >> I have not done anything special in views..it just contains a

Geo support with Django Rest Framework

2013-10-20 Thread Sanjay Bhangar
Hi all, I'm developing an app using GeoDjango that requires me to create an API. Ideally, I would output GeoJSON at various API end-points and support a few geo-queries like "within bounding box", etc. I have done something similar before without Django Rest Framework and just writing vanilla vie

Re: Geo support with Django Rest Framework

2013-10-21 Thread Sanjay Bhangar
e that helps! > Tremendously! Thanks, Sanjay > Tom > > On Sunday, 20 October 2013 15:06:26 UTC+1, Sanjay Bhangar wrote: >> >> Hi all, >> >> I'm developing an app using GeoDjango that requires me to create an >> API. Ideally, I would output GeoJSON at

Re: Geo support with Django Rest Framework

2013-10-21 Thread Sanjay Bhangar
bundle.data['lat'] = bundle.obj.city.coordinates.x > bundle.data['lng'] = bundle.obj.city.coordinates.y > bundle.data['distance'] = > bundle.obj.city.coordinates.distance(self._current_location) * 100 > return bundle > > H

Re: How to call url and get json data

2013-10-21 Thread Sanjay Bhangar
Mahantesh, On Mon, Oct 21, 2013 at 3:48 PM, Mahantesh U wrote: > Hi, > >How to call the below url in django in views file: > > > > http://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=O-lzp4Hyqp8&format=json > > The above api returns json data which further i need to use and fil

Re: deploying djnago on apache

2014-08-11 Thread Sanjay Bhangar
hey Ngangsia, On Mon, Aug 11, 2014 at 7:17 PM, ngangsia akumbo wrote: > i have these configs > > project path > yems bluepearlhotel # ls > blog bluepearlhotel event gallery home images manage.py media static > yems bluepearlhotel # > > > cd /etc/apcahe2/sites-available > > yems sites-av

Re: deploying djnago on apache

2014-08-12 Thread Sanjay Bhangar
e, ping me on chat (sanjayb on IRC/Freenode or my current email address on google-chat) -- we can go over these things step by step and make sure things are in order. Cheers, Sanjay > > There are no erros at the bluepearlhotel > > > On Monday, August 11, 2014 4:52:11 PM UTC+1, San

Re: Retrieving recurring events using Django queries

2014-09-19 Thread Sanjay Bhangar
hey Stodge, Interesting question :) My guess is there are probably a number of approaches one can take. Of course, processing all your entries in python "on the fly" would probably get to be quite an intensive operation. One possible idea maybe to create a "cache" table of sorts where you pre-ca

Re: Django 1.7, KeyError: u'manager' error

2014-10-17 Thread Sanjay Bhangar
On Fri, Oct 17, 2014 at 2:53 PM, Taenyon Kim wrote: > Example > > class ModelA(models.Model): > fielda = models.CharField(max_length=10) > > class ModelB(models.Model): > modela = models.ForeignKey(ModelA) > fieldb = models.CharField(max_length=10) > > > When I query like "modela_inst

Re: Question on a resembling function on truncatewords

2014-04-12 Thread Sanjay Bhangar
On Sat, Apr 12, 2014 at 7:50 PM, Camilo Torres wrote: > On Saturday, April 12, 2014 1:10:34 AM UTC-4:30, Kimitaka wrote: >> >> I wrote the function in my Product class in my models.py: >> class Product(models.Model): >> title = models.CharField(max_length=220) >> description = models.CharField(max

Re: Opinion needed for a BookMarker project - Regarding CSRF token

2014-05-12 Thread Sanjay Bhangar
Hi Aseem, On Mon, May 12, 2014 at 11:25 PM, Aseem Bansal wrote: > I am new to Django and am learning it baically because I wanted to create a > BookMarker project. A project for managing bookmarks. For this I am going to > create a UI through Django and a JavaScript for sending the URLs to the ap

Re: Formsets, adding new forms and autocomplete/ajax selects

2014-05-28 Thread Sanjay Bhangar
hey Lachlan, So this had driven me a bit crazy some years ago .. On Wed, May 28, 2014 at 8:42 AM, Lachlan Musicman wrote: > Hola, > > I am trying to get two different "extras" to work. > > I have a form with an inline_formset, which I would like to be able to > add multiple formsets of on the fl

Re: backbonejs and django

2014-05-29 Thread Sanjay Bhangar
Hi, On Thu, May 29, 2014 at 3:07 PM, Eddilbert Macharia wrote: > Hi All, > > i am using django-tastypie to return django models as json object. > > when i run the following code > > var org = Backbone.Model.extend({ > >urlRoot: 'api/orgnanization/', > }); > > > var

Re: Admin site doesn't work

2014-06-11 Thread Sanjay Bhangar
hey Glen, Sorry if this is a silly question - but are you sure you are visiting /admin on your site? If you are and still getting this error, can you please paste the contents of your urls.py On Wed, Jun 11, 2014 at 4:24 PM, Glen J wrote: > I've tried it both on the development server you indica

Re: Admin site doesn't work

2014-06-11 Thread Sanjay Bhangar
On 11 Jun 2014 18:04, "Glen J" wrote: > Sanjay, > Thanks for the reply. I've tried accessing it various ways using both > nginx and the included devserver on :8000. I've done both 127.0.0.1/admin > and 127.0.0.1/admin/ with the same results. I can post the contents of > my urls.py later today

Re: Admin site doesn't work

2014-06-12 Thread Sanjay Bhangar
Hey Glen, Hm, whatever it is, is not apparent to me, sorry :/. The only thing I can think of is possibly inconsistent indentation. Some comments / questions inline -- On Thu, Jun 12, 2014 at 3:39 AM, Glen J wrote: > urls.py: > from django.conf.urls import patterns, include, url > > # Uncomment t

Re: Extracting results of a join

2016-10-10 Thread Sanjay Bhangar
On Mon, Oct 10, 2016 at 12:56 PM, Geoff Kuenning wrote: > > > So is there a way to get Django to issue this join and collect the > results into an aggregate set? I've read through the docs and > experimented with different filter and double-underscore notations, > without success. It seems sill

GeoDjango: Filter by Area

2016-12-19 Thread Sanjay Bhangar
Hey folks, I am trying to use the 'Area' function documented here: https://docs.djangoproject.com/en/1.10/ref/contrib/gis/functions/#area to annotate my geo queryset results with Area of the polygon geometries in my database. This works great with something like: annotated_qset = GeoModel.obje

Re: GeoDjango: Filter by Area

2016-12-22 Thread Sanjay Bhangar
On Wed, Dec 21, 2016 at 10:08 PM, Tim Graham wrote: > If you don't get an answer here, you can also ask on the geodjango list: > https://groups.google.com/forum/#!forum/geodjango. > > Will do. Thanks Tim, you're the best! -- You received this message because you are subscribed to the Google Gro

Validating count + property of a Many2Many with a through table

2018-07-31 Thread Sanjay Bhangar
Hello! This is more of a code organization question than a "something is not working" question - it might get slightly rambling, so if this kind of question is not your cup of tea, you have been warned :-) So - I have a set of models like this (highly simplified): class Item(models.Model): tit

Re: New entry tries to use an existing unique id

2018-10-26 Thread Sanjay Bhangar
Hi Michel, So, a little explanation of why you're facing this issue: When you create an "auto-increment" field in Postgres, Postgres creates something called a "sequence" to keep track of the increments. If you were to `psql` into your database and check the schema of the table, you'll see the `i

Re: Many to Many field in ModelForm - with tens of thousands of records

2018-10-29 Thread Sanjay Bhangar
My recommendation would be to use a bit of Javascript to implement an "autocomplete" to fetch records via AJAX as the user types (with perhaps a minimum of 3 characters or so), so you only ever fetch a subset of records and don't overload your template. You can find quite a few 3rd party libraries