Re: Error with Passing a class name as a parameter in a ManyToManyField

2013-07-14 Thread Mike Dewhirst

On 15/07/2013 1:02am, Charounson Saintilus wrote:

This is my first time using the Django Web Framework and I'm new to the
python language, so please bear with me.
I've created a model (i.e. a class) called Course which defines several
variables:

class Course(models.Model):
 name = models.CharField(max_length=32)
.
.
.
.
 prereq = models.ManyToManyField(*Course*, blank=True,
null=True, through='PreReqToCourse')


If you want to relate Course to Course then you need to use 'self' 
instead of Course in the prereq field


https://docs.djangoproject.com/en/1.5/ref/models/fields/#django.db.models.ManyToManyField.symmetrical




When I try to serve the files from the local server with, *python
manage.py runserver*, I get the following error:

...
...
prereq = models.ManyToManyField(Course, blank=True, null=True,
through='PreReqToCourse')
NameError: name '*Course*' is not defined


Any ideas?

Thanks in advance!

--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django statics

2013-07-14 Thread Sébastien Billion
Hi,

In your project folder, you can create a folder media zith a subfolder css,
an other img, js, whatever.
In your settings.py, you can use this line to get the absolute path
dynamically:

from os import path
PROJECT_ROOT = path.dirname(path.abspath(__file__))

After, you need to specify your MEDIA_ROOT and MEDIA_URL


MEDIA_ROOT = path.join(PROJECT_ROOT,'media')

MEDIA_URL = '/media/'

In your template, if you want to get your css or your js, img, etc... you
just need to do


Regards,
Seb


2013/7/15 Kakar Arunachal Service 

> Hello,
> I read the django docs, but my still confused. How do i use the static
> files, for css?
> Thank you.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: help with query set

2013-07-14 Thread Mike Dewhirst

On 15/07/2013 1:11am, Bobby Roberts wrote:

hi.  I  need help with this simple setup.  i need to get a list of
announcements where active =1 and the discontinueDate is either null OR
less than NOW.


I haven't looked at your code but your words above indicate you want all 
announcements which haven't expired. I think that means a 
discontinueDate in future?


If so, you probably want one which is greater than NOW

?

There are two issues:


1) the filter doesn't work
2) numannouncements always equals 1 even when nothing is returned

any ideas?
*
*
*
*
*
model:*

active_choices=(
 (1,"Yes"),
 (0,"No"),
)

class Announcement (models.Model):
 Id = models.AutoField (primary_key=True)
 adminTag = models.CharField (max_length=50, blank=False,
db_index=True,help_text=_("Shows in Admin for quick reference."))
 active = models.IntegerField(blank=False, choices=active_choices)
 synopsis = models.TextField (blank=False,
max_length=2000,help_text=_("Appears on sermon audio page."))
 announcementDate = models.DateField(blank=False)
 discontinueDate = models.DateField(blank=True)


class AnnouncementAdmin(admin.ModelAdmin):
 list_display =
('adminTag','announcementDate','discontinueDate','active')
 search_fields = ['adminTag','synopsis']

admin.site.register(Announcement,AnnouncementAdmin)



*view:*
def getAnnouncements (request):
 dateNow = datetime.datetime.now().strftime("%Y-%m-%d")
 try:
 tms =
Announcement.objects.filter(active__exact=1).filter(discontinueDate__lt=dateNow).order_by('announcementDate')
 numannouncements = Announcement.objects.count()
 except:
 tms = ''
 numannouncements = 0
 assert False, tms.active
 return render_to_response('announcements/listpage.html',{'tms':
tms,'numannouncements':numannouncements},
context_instance=RequestContext(request))


--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




django statics

2013-07-14 Thread Kakar Arunachal Service
Hello,
I read the django docs, but my still confused. How do i use the static
files, for css?
Thank you.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




how to do conditional order_by

2013-07-14 Thread surya


SELECT id, ((positive_count + 1.9208) / (positive_count + negative_count) - 
   1.96 * SQRT((positive_count * negative_count) / 
(positive_count + negative_count) + 0.9604) / 
  (positive_count + negative_count)) / (1 + 3.8416 / 
(positive_count + negative_count)) 
   AS ci_lower_bound FROM widgets WHERE positive_count + negative_count > 0 
   ORDER BY ci_lower_bound DESC;


This is what I have to do (ordering objects)..

The issue with my table is, I don't have positive_count, negative_count fields 
separately!!


The CountTable table has a boolean field "count" which is either positive or 
negative. This table uses contenttypes to attach to other model objects.. and I 
use reverse generic relation to identify list of counts a object got (whether 
positive or negative).


How to pass positive_count, negative_count into this above query? (in raw sql)

or else can we use conditional statements in .order_by()??


thanks!

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Getting Started with Mac OS X

2013-07-14 Thread Thomas Lockhart

On 7/14/13 1:26 PM, Mando wrote:

Hi,

This is the way I have it set up my osx


$ sudo pip install virtualenv
$ virtualenv --distribute pytho_projects
$ source python_projects/bin/activate
$ (python projects) pip install django
$ django-admin.py startproject myblog

and that should get you past that. using virtualenv just makes it a 
lot more clean and organized imo. Let me know if that helped you out some.


+1 on that. pip is the only way to go.

And I would suggest installing PostgreSQL from MacPorts or an equivalent 
package manager to give yourself more control over your database 
versioning and contents. Otherwise you are relying on whatever is in 
Apple's current update which may change or be different from what you 
might need for reasons of your own.


I've also installed python and related packages from MacPorts so then 
the virtualenv will point to that installation when it initializes. That 
also gives you more control over versioning.


hth

   - Tom






On Saturday, July 13, 2013 2:25:06 PM UTC-5, Kayode Alayode wrote:

Yea I think they wanted you to add this "*django-admin.py
startproject mysite*"  at the cd commandpromopt I am stuck here as
well and don't really know how to proceed as well.


On Monday, February 27, 2012 7:36:21 PM UTC-5, JChlipala wrote:

Hello,

I am a Django beginner, and am trying to get Django set up in
Mac OS
X.  I am going through the tutorial, but getting stuck very early
(essentially at the beginning).  I have installed Python and
Django.
The next instruction is to enter the command "django-admin.py
startproject mysite".  When I do this, I get the following error:

File "", line 1
django-admin.py startproject mysite
^

SyntaxError:  invalid syntax

Does anybody know why I am getting this error?  The tutorial
has a
note for Mac OS X users explaining what to do if you get a
"permission
denied" error, but that is obviously not what is happening to me.

Thank you for any help!

--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Getting Started with Mac OS X

2013-07-14 Thread Mando
Hi,

This is the way I have it set up my osx


$ sudo pip install virtualenv
$ virtualenv --distribute pytho_projects
$ source python_projects/bin/activate
$ (python projects) pip install django
$ django-admin.py startproject myblog

and that should get you past that. using virtualenv just makes it a lot 
more clean and organized imo. Let me know if that helped you out some.



On Saturday, July 13, 2013 2:25:06 PM UTC-5, Kayode Alayode wrote:
>
> Yea I think they wanted you to add this "*django-admin.py 
> startproject mysite*"  at the cd commandpromopt I am stuck here as well 
> and don't really know how to proceed as well.
>
>
> On Monday, February 27, 2012 7:36:21 PM UTC-5, JChlipala wrote:
>>
>> Hello, 
>>
>> I am a Django beginner, and am trying to get Django set up in Mac OS 
>> X.  I am going through the tutorial, but getting stuck very early 
>> (essentially at the beginning).  I have installed Python and Django. 
>> The next instruction is to enter the command "django-admin.py 
>> startproject mysite".  When I do this, I get the following error: 
>>
>> File "", line 1 
>> django-admin.py startproject mysite 
>> ^ 
>>
>> SyntaxError:  invalid syntax 
>>
>> Does anybody know why I am getting this error?  The tutorial has a 
>> note for Mac OS X users explaining what to do if you get a "permission 
>> denied" error, but that is obviously not what is happening to me. 
>>
>> Thank you for any help!
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Big Picture?

2013-07-14 Thread Mark Phillips
A suggestionadd a note to explain the colors as you did in your
previous email.

Mark
On Jul 14, 2013 10:13 AM, "Amirouche Boubekki" 
wrote:

> The link to new version is missing:
> https://github.com/amirouche/experiments/tree/master/django-big-picture
>
> Thanks again, please share with us what were you misconceptions maybe one
> can improve from them or maybe can also make it more clear in the diagram :)
>
>
> 2013/7/14 Subhodip Biswas 
>
>> Hi,
>>
>> That diagram clears a lot of misconceptions that I had. Thanks a lot for
>> that. Will keep it as a reference.
>>
>>
>>
>>
>>
>> -
>> Regards
>> Subhodip Biswas
>>
>>
>> GPG key : FAEA34AB
>> Server : pgp.mit.edu
>> http://subhodipbiswas.wordpress.com
>>
>>
>>
>> On Sun, Jul 14, 2013 at 8:38 PM, Amirouche Boubekki <
>> amirouche.boube...@gmail.com> wrote:
>>
>>>
>>>

> I normally dislike technical "diagrams", but this is simple and
> awesome :-) -- it's a really nice "big picture" and introduction to the
> different components that can be hard to visualize in one's head when just
> getting started .. do you mind if I use it when introducing people to
> Django? (with credit, of course:))
>

 Thanks!

 I've moved it online, with licensing cc by sa [1] so anybody anywhere
 can use it, both png and svg version (edited with inkscape) are available.

>>>
>>> an updated version with minor correction ;)
>>>
>>> Of course any contributions is welcomed.
>>>
>>>

 [1] http://creativecommons.org/licenses/by-sa/3.0/

>>>  --
>>> 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 post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Big Picture?

2013-07-14 Thread Amirouche Boubekki
The link to new version is missing:
https://github.com/amirouche/experiments/tree/master/django-big-picture

Thanks again, please share with us what were you misconceptions maybe one
can improve from them or maybe can also make it more clear in the diagram :)


2013/7/14 Subhodip Biswas 

> Hi,
>
> That diagram clears a lot of misconceptions that I had. Thanks a lot for
> that. Will keep it as a reference.
>
>
>
>
>
> -
> Regards
> Subhodip Biswas
>
>
> GPG key : FAEA34AB
> Server : pgp.mit.edu
> http://subhodipbiswas.wordpress.com
>
>
>
> On Sun, Jul 14, 2013 at 8:38 PM, Amirouche Boubekki <
> amirouche.boube...@gmail.com> wrote:
>
>>
>>
>>>
 I normally dislike technical "diagrams", but this is simple and awesome
 :-) -- it's a really nice "big picture" and introduction to the different
 components that can be hard to visualize in one's head when just getting
 started .. do you mind if I use it when introducing people to Django? (with
 credit, of course:))

>>>
>>> Thanks!
>>>
>>> I've moved it online, with licensing cc by sa [1] so anybody anywhere
>>> can use it, both png and svg version (edited with inkscape) are available.
>>>
>>
>> an updated version with minor correction ;)
>>
>> Of course any contributions is welcomed.
>>
>>
>>>
>>> [1] http://creativecommons.org/licenses/by-sa/3.0/
>>>
>>  --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Big Picture?

2013-07-14 Thread Subhodip Biswas
Hi,

That diagram clears a lot of misconceptions that I had. Thanks a lot for
that. Will keep it as a reference.





-
Regards
Subhodip Biswas


GPG key : FAEA34AB
Server : pgp.mit.edu
http://subhodipbiswas.wordpress.com



On Sun, Jul 14, 2013 at 8:38 PM, Amirouche Boubekki <
amirouche.boube...@gmail.com> wrote:

>
>
>>
>>> I normally dislike technical "diagrams", but this is simple and awesome
>>> :-) -- it's a really nice "big picture" and introduction to the different
>>> components that can be hard to visualize in one's head when just getting
>>> started .. do you mind if I use it when introducing people to Django? (with
>>> credit, of course:))
>>>
>>
>> Thanks!
>>
>> I've moved it online, with licensing cc by sa [1] so anybody anywhere can
>> use it, both png and svg version (edited with inkscape) are available.
>>
>
> an updated version with minor correction ;)
>
> Of course any contributions is welcomed.
>
>
>>
>> [1] http://creativecommons.org/licenses/by-sa/3.0/
>>
>  --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Error with Passing a class name as a parameter in a ManyToManyField

2013-07-14 Thread Jonathan Baker
You error is in the following line:
prereq = models.ManyToManyField(*Course*, blank=True, null=True,
through='PreReqToCourse')

To phrase this as a sentence, you're saying that "Many courses can belong
to many courses." which doesn't follow. I'm guessing that you're aiming to
achieve something more like this:
prereq = models.ManyToManyField(*PreReq*, blank=True, null=True,
through='PreReqToCourse')

So long as the PreReq model is defined above the Course model, you're
golden.

JDB


On Sun, Jul 14, 2013 at 9:02 AM, Charounson Saintilus  wrote:

> This is my first time using the Django Web Framework and I'm new to the
> python language, so please bear with me.
> I've created a model (i.e. a class) called Course which defines several
> variables:
>
> class Course(models.Model):
> name = models.CharField(max_length=32)
>.
>.
>.
>.
> prereq = models.ManyToManyField(*Course*, blank=True, null=True,
> through='PreReqToCourse')
>
> When I try to serve the files from the local server with, *python
> manage.py runserver*, I get the following error:
>
> ...
> ...
> prereq = models.ManyToManyField(Course, blank=True, null=True,
> through='PreReqToCourse')
> NameError: name '*Course*' is not defined
>
>
> Any ideas?
>
> Thanks in advance!
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Jonathan D. Baker
Developer
http://jonathandbaker.com

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Error with Passing a class name as a parameter in a ManyToManyField

2013-07-14 Thread Charounson Saintilus
This is my first time using the Django Web Framework and I'm new to the 
python language, so please bear with me.
I've created a model (i.e. a class) called Course which defines several 
variables:

class Course(models.Model):
name = models.CharField(max_length=32)
   .
   .  
   .
   .
prereq = models.ManyToManyField(*Course*, blank=True, null=True, 
through='PreReqToCourse')

When I try to serve the files from the local server with, *python manage.py 
runserver*, I get the following error:

...
...
prereq = models.ManyToManyField(Course, blank=True, null=True, 
through='PreReqToCourse')
NameError: name '*Course*' is not defined


Any ideas? 

Thanks in advance! 

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




help with query set

2013-07-14 Thread Bobby Roberts
hi.  I  need help with this simple setup.  i need to get a list of 
announcements where active =1 and the discontinueDate is either null OR 
less than NOW.  There are two issues:

1) the filter doesn't work
2) numannouncements always equals 1 even when nothing is returned 

any ideas?
*


model:*

active_choices=(
(1,"Yes"),
(0,"No"),
)

class Announcement (models.Model):
Id = models.AutoField (primary_key=True)
adminTag = models.CharField (max_length=50, blank=False, 
db_index=True,help_text=_("Shows in Admin for quick reference."))
active = models.IntegerField(blank=False, choices=active_choices)
synopsis = models.TextField (blank=False, 
max_length=2000,help_text=_("Appears on sermon audio page."))
announcementDate = models.DateField(blank=False)
discontinueDate = models.DateField(blank=True)


class AnnouncementAdmin(admin.ModelAdmin):
list_display = 
('adminTag','announcementDate','discontinueDate','active')
search_fields = ['adminTag','synopsis']

admin.site.register(Announcement,AnnouncementAdmin)



*view:*
def getAnnouncements (request):
dateNow = datetime.datetime.now().strftime("%Y-%m-%d")
try:
tms = 
Announcement.objects.filter(active__exact=1).filter(discontinueDate__lt=dateNow).order_by('announcementDate')
numannouncements = Announcement.objects.count()
except:
tms = ''
numannouncements = 0
assert False, tms.active
return render_to_response('announcements/listpage.html',{'tms': 
tms,'numannouncements':numannouncements}, 
context_instance=RequestContext(request))


-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Django-Ajax Issue

2013-07-14 Thread vijay shanker
Hey all
I am trying to make a simple ajax call to show items retrieved from 
database.
I am displaying bunch of fields like a text input for keyword and radio 
button for filter in a form like this:

{% csrf_token %}

 Search 



All
Paying
Uploaded
Staff Pick
 


This form is displayed by a function which inherits generic View class, 
from its get method.

class Home(View):
def get(self,request, *args, **kwargs):
return render_to_response('items/search_page.html', 
context_instance = RequestContext(request) )
def post(self, request, *args, **kwargs):
print 'in home post'

What puzzles me is that when i am trying to submit the form data via ajax 
call (on same page) with jquery when someone clicks on search button, it 
takes me to post view of Home and not on to other function i have defined.
The javascript on the html page is:

   function search(e) {
e.preventDefault();
search_for = $("#search").val()
rval = $('input:radio[name=fancy_radio]:checked').val()
$.ajax({
url:"/search/",
method : "POST",
data : { 'keyword': search_for, 'filter': rval },
success:function(result){
alert(result)
}
});
   }


why is this happening ? 

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Getting started with django( the new one is confusing , especially first episode)

2013-07-14 Thread cingusoft
Hi,

Why you don't use google
If you find vagrant, virtualenv and more you obtain all the informations.
You obtain more infos from the projects site than in any mailing group.


BlackBerry de movistar, allí donde estés está tu oficin@

-Original Message-
From: naufalyah...@gmail.com
Sender: django-users@googlegroups.com
Date: Sun, 14 Jul 2013 03:05:16 
To: 
Reply-To: django-users@googlegroups.com
Subject: Getting started with django( the new one is confusing , especially
 first episode)

What is vagrant ?? how do i set it up,
what is cheffile?
what is virtual env???

Please could someone explain these to me.

Cheers!
Naufal

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.



-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Big Picture?

2013-07-14 Thread Amirouche Boubekki
>
>> I normally dislike technical "diagrams", but this is simple and awesome
>> :-) -- it's a really nice "big picture" and introduction to the different
>> components that can be hard to visualize in one's head when just getting
>> started .. do you mind if I use it when introducing people to Django? (with
>> credit, of course:))
>>
>
> Thanks!
>
> I've moved it online, with licensing cc by sa [1] so anybody anywhere can
> use it, both png and svg version (edited with inkscape) are available.
>

an updated version with minor correction ;)

Of course any contributions is welcomed.


>
> [1] http://creativecommons.org/licenses/by-sa/3.0/
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Big Picture?

2013-07-14 Thread Amirouche Boubekki
2013/7/8 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 gray you have to make a choice for.
>>
>> Anything blue is your code.
>>
>> Arrows are kind of inspired snakes I'm not sure of the meaning of each of
>> them ;)
>>
>>
>>
> I normally dislike technical "diagrams", but this is simple and awesome
> :-) -- it's a really nice "big picture" and introduction to the different
> components that can be hard to visualize in one's head when just getting
> started .. do you mind if I use it when introducing people to Django? (with
> credit, of course:))
>

Thanks!

I've moved it online, with licensing cc by sa [1] so anybody anywhere can
use it, both png and svg version (edited with inkscape) are available.


[1] http://creativecommons.org/licenses/by-sa/3.0/


> Thanks again!
> -Sanjay
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Choosing a JS framework to go together with Django

2013-07-14 Thread François Schiettecatte
Hi

FWIW an approach I have taken is to split the app into two components, one is a 
REST based API (developed in Java, but you could use Django), and a website 
developed with Django. The website renders pages of content  (all SEO friendly, 
with known urls), all interactive JS is provided by jquery, and I use the 
'/ajax/...' url for browser calls to the website app (validation, autocomplete, 
etc...). This split gives you the option to develop mobile clients against the 
API, and to host components on different machines. If you want to start small 
one option would be to build you API with Django and use the '/api/...' url. 
That way you can combine API and website on the same server until you need to 
split things. And using host names like api.foo.com and foo.com makes that 
relatively painless.

François


On Jul 14, 2013, at 10:52 AM, Jon  wrote:

> The idea is to generate pure HTML views for non JS clients like search bots. 
> If your view depends on AJAX calls, then it defies the purpose.
> 
> I've been developing native mobile apps for the past year, so I get your 
> argument about providing REST end points for your data.
> 
> The point of my original post was to NOT do two different views; one for 
> search bots and one for browsers.
>  I agree that providing a REST interface is the "right" way to provide data 
> for both browsers and mobile apps. To that end, the project I was suppose to 
> work on, used tastypie.
> 
> // Jon
> 
> On 14/07/2013, at 15.16, Phang Mulianto  wrote:
> 
>> Hi ,
>> 
>> Why not using REST for serving your data to the Front End app, it can be 
>> from mobile app or just web app with HTML + javascript.
>> 
>> With that you don't need to worry about redo the template side in django and 
>> in your front end js app.
>> With REST serving JSON, no template / html needed for the response. 
>> 
>> You can use Tastypie or Django rest framework which still using Django 
>> engine . This way also your application server no need to rendering the HTML 
>> view in every request from the first time.
>> 
>> Any front end will be able to process the JSON with javascript. 
>> 
>> Regards,
>> 
>> Mulianto
>> 
>> 
>> On Sun, Jul 14, 2013 at 8:18 PM, dotnetCarpenter  
>> wrote:
>> In the end, my project stalled due to lack of resources. We might pick it up 
>> but it's been abandoned for quite some time. I haven't had any django 
>> projects since. Hence, I can't make any recommendations.
>> 
>> DjangoAjax looks promising but might lack the community support you expect. 
>> It is however based on jQuery and ASP.NET MVC, so if you can see past the M$ 
>> cruft, some guides etc are available.
>> 
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>> 
>> 
>> 
>> 
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/django-users/X_9qJJjiDfE/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
> 
> -- 
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Choosing a JS framework to go together with Django

2013-07-14 Thread Jon
The idea is to generate pure HTML views for non JS clients like search bots. If 
your view depends on AJAX calls, then it defies the purpose.

I've been developing native mobile apps for the past year, so I get your 
argument about providing REST end points for your data.

The point of my original post was to NOT do two different views; one for search 
bots and one for browsers.
 I agree that providing a REST interface is the "right" way to provide data for 
both browsers and mobile apps. To that end, the project I was suppose to work 
on, used tastypie.

// Jon

On 14/07/2013, at 15.16, Phang Mulianto  wrote:

> Hi ,
> 
> Why not using REST for serving your data to the Front End app, it can be from 
> mobile app or just web app with HTML + javascript.
> 
> With that you don't need to worry about redo the template side in django and 
> in your front end js app.
> With REST serving JSON, no template / html needed for the response. 
> 
> You can use Tastypie or Django rest framework which still using Django engine 
> . This way also your application server no need to rendering the HTML view in 
> every request from the first time.
> 
> Any front end will be able to process the JSON with javascript. 
> 
> Regards,
> 
> Mulianto
> 
> 
> On Sun, Jul 14, 2013 at 8:18 PM, dotnetCarpenter  
> wrote:
>> In the end, my project stalled due to lack of resources. We might pick it up 
>> but it's been abandoned for quite some time. I haven't had any django 
>> projects since. Hence, I can't make any recommendations.
>> 
>> DjangoAjax looks promising but might lack the community support you expect. 
>> It is however based on jQuery and ASP.NET MVC, so if you can see past the M$ 
>> cruft, some guides etc are available.
>> 
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Django users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/django-users/X_9qJJjiDfE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Big Picture?

2013-07-14 Thread Amirouche Boubekki
2013/7/7 Amirouche Boubekki 

> 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 gray you have to make a choice for.
>
> Anything blue is your code.
>
> Arrows are kind of inspired snakes I'm not sure of the meaning of each of
> them ;)
>

There at least one mistake in this diagram, middlwares come after routing
but before view processing

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Getting started with django( the new one is confusing , especially first episode)

2013-07-14 Thread Randy Baxley
http://docs.python-guide.org/en/latest/dev/virtualenvs.html

https://github.com/applicationsonline/librarian

http://docs.vagrantup.com/v2/why-vagrant/index.html

Now maybe you can help me by telling me what episode you are refering to?


On Sun, Jul 14, 2013 at 5:05 AM,  wrote:

> What is vagrant ?? how do i set it up,
> what is cheffile?
> what is virtual env???
>
> Please could someone explain these to me.
>
> Cheers!
> Naufal
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Getting started with django( the new one is confusing , especially first episode)

2013-07-14 Thread naufalyahaya
What is vagrant ?? how do i set it up,
what is cheffile?
what is virtual env???

Please could someone explain these to me.

Cheers!
Naufal

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Choosing a JS framework to go together with Django

2013-07-14 Thread Phang Mulianto
Hi ,

Why not using REST for serving your data to the Front End app, it can be
from mobile app or just web app with HTML + javascript.

With that you don't need to worry about redo the template side in django
and in your front end js app.
With REST serving JSON, no template / html needed for the response.

You can use Tastypie or Django rest
frameworkwhich still using Django
engine . This way also your application server no
need to rendering the HTML view in every request from the first time.

Any front end will be able to process the JSON with javascript.

Regards,

Mulianto


On Sun, Jul 14, 2013 at 8:18 PM, dotnetCarpenter
wrote:

> In the end, my project stalled due to lack of resources. We might pick it
> up but it's been abandoned for quite some time. I haven't had any django
> projects since. Hence, I can't make any recommendations.
>
> DjangoAjax looks promising but might lack the community support you
> expect. It is however based on jQuery and ASP.NET MVC, so if you can see
> past the M$ cruft, some guides etc are available.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Choosing a JS framework to go together with Django

2013-07-14 Thread dotnetCarpenter
In the end, my project stalled due to lack of resources. We might pick it up 
but it's been abandoned for quite some time. I haven't had any django projects 
since. Hence, I can't make any recommendations.

DjangoAjax looks promising but might lack the community support you expect. It 
is however based on jQuery and ASP.NET MVC, so if you can see past the M$ 
cruft, some guides etc are available.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.