Re: Extended pages - wait and render with parent template

2015-07-11 Thread Peith Vergil
I think the issue here is in how you're loading jQuery. It doesn't seem like jQuery has been loaded successfully. Make sure the path to your jQuery file is correct. This seems more like a client side issue rather than a server side (Django) issue. When Django sends the HTML response to your browse

Re: Inconsistency when importing views and models

2015-06-19 Thread Peith Vergil
It depends on how your project files are structured. If you have a file structure that looks like this: app/ __init__.py models.py views.py urls.py Then, you can simply use relative imports. In views.py: from models import * In urls.py: from views import * If, for example, your

Re: datepicker

2015-05-26 Thread Peith Vergil
Actually, use the DateField instead of the CharField so you get server side validation of the date input. It should just render as a text input on the front-end. On May 27, 2015 01:40, "Peith Vergil" wrote: > I don't think you do it with models. You do it with form fields. A

Re: datepicker

2015-05-26 Thread Peith Vergil
I don't think you do it with models. You do it with form fields. An easy way is to simply create a regular CharField, render it like usual. Then, on the front-end, you simply target that specific char field and initialize the datepicker on it. On May 27, 2015 01:31, "sum abiut" wrote: > Hi, > Is

Re: Flexible For loop

2015-04-03 Thread Peith Vergil
The tiled cards with varying sizes are done in JavaScript. Have a look at the Masonry JS library. It'll allow you to easily get the same effect. You just need to render the Django templates as usual. Then, use Masonry to automatically rearrange the tiles. On Apr 3, 2015 11:48 PM, "Nkansah Rexford"

Re: More robust way of handling login_required decorator?

2013-07-13 Thread Peith Vergil
django-braces have a LoginRequiredMixin. Using it is a much cleaner solution to overriding the dispatch method. On Sat, Jul 13, 2013 at 6:56 PM, Some Developer wrote: > I make heavy use the login_required decorator and for the most part it is > extremel

Re: Javascript AJAX url call not responding

2013-07-04 Thread Peith Vergil
If that's an AJAX POST request, then it may be because you are not passing the CSRF token in the header. Add this code before doing the AJAX call: function csrfSafeMethod(method) { // these HTTP methods do not require CSRF protection return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));}$.aj

Re: Advanced Search in django

2013-06-27 Thread Peith Vergil
What I would probably do in that situation is setup Whoosh and django-haystack. Then use Haystack's EdgeNgramField on your user model's firstname and lastname. On Thu, Jun 27, 2013 at 4:33 PM, Harjot Mann wrote: > On Thu, Jun 27, 2013 at 1:16 PM, Peith Vergil > wrote: >

Re: Advanced Search in django

2013-06-27 Thread Peith Vergil
Try using django-haystack. It's a nice Django app, very easy to use, and with good documentation: http://django-haystack.readthedocs.org/en/latest/. It provides a QuerySet like API for several search engine backends. It works with Solr, ElasticSearch, Whoosh, Xapian, etc. -- You received this me

Re: Upload Image

2013-04-19 Thread Peith Vergil
Try this in your view: from django.shortcuts import render_to_response from django.template import RequestContext from django.http import HttpResponseRedirect from django.shortcuts import render_to_response from models import Document from forms import DocumentForm def index(request): if re

Re: Upload Image

2013-04-19 Thread Peith Vergil
the *else:* should be part of *if form.is_valid():*, so just indent it. On Sat, Apr 20, 2013 at 2:13 AM, Hélio Miranda wrote: > So it gives me an error: > > local variable 'form' referenced before assignment > > > in views.py > > -- > You received this message because you are subscribed to the

Re: Upload Image

2013-04-19 Thread Peith Vergil
Try this: In your forms.py *class DocumentForm(forms.ModelForm): class Meta: model = Document* *...* In your views.py *def index(request): if request.method == 'POST': form = DocumentForm(request.POST, request.FILES) if form.is_valid(): form.sa

Re: Upload Image

2013-04-19 Thread Peith Vergil
Maybe DocumentForm should inherit from ModelForm: *class DocumentForm(forms.ModelForm): class Meta: model = Document* -- 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,

Re: Pinterest like UI implementation

2012-09-28 Thread Peith Vergil
I use Masonry to get that Pinterest-like tile of images. Then I use Infinite-scroll to detect user scrolling event and load more images by sending an AJAX request to the server. You can learn about Masonry and infinite-scroll here: http://masonry.desandro.com/ -- You received this message becaus

Re: Choosing a JS framework to go together with Django

2012-09-04 Thread Peith Vergil
i've been playing with KnockoutJS lately. one thing i like about it is that it's built-in templating engine has a different syntax than Django's, so there shouldn't have any conflict. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to th

Re: I LOVE THIS COMMUNITY!

2012-08-21 Thread Peith Vergil
i agree -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this gr