Re: Crispy forms not showing bootstrap and save/submit button

2017-07-13 Thread JHeasly
Also, do you have any FormActions defined? That's where the Bootstrap 
button comes from:
http://django-crispy-forms.readthedocs.io/en/latest/layouts.html#bootstrap-layout-objects

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/75fb72c8-00d9-42fe-896e-66fa0a938cee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Crispy forms not showing bootstrap and save/submit button

2017-07-13 Thread JHeasly
Hello Taufiq —

Have you tried using the "instance level helper"?
See 
http://django-crispy-forms.readthedocs.io/en/latest/crispy_tag_forms.html#crispy-tag-with-forms
>From the docs link above:

from crispy_forms.helper import FormHelper
class ExampleForm(forms.Form):
[...]
def __init__(self, *args, **kwargs):
super(ExampleForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()



Hope this helps,
John

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0ece72e2-2890-4c9c-9520-27608f57a198%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django with generic odbc database

2017-05-03 Thread JHeasly
I've had a good experience with the mxODBC Django Database Engine 
. (The web page says 
you can use the ORM, but elsewhere it clarifies that's only if you're using 
MS SQL Server 2005, 2008 and 2012.) But as Jani says, you do have to do all 
the querying, updating in raw SQL.

 — John

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/983eb4a3-636e-409b-bbca-e929e06720f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: __unicode__ rather than __str__ in Part 2 of 'Writing you first Django app"?

2016-02-12 Thread JHeasly
Hi Simon —

I was pretty sure I was missing something obvious. Thanks for pointing it 
out.

— John

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c3217b5d-a980-4752-bb1c-4f951640b4e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


__unicode__ rather than __str__ in Part 2 of 'Writing you first Django app"?

2016-02-11 Thread JHeasly
In "Writing your first Django app, part 2" 
(https://docs.djangoproject.com/en/1.9/intro/tutorial02/), it's outlines 
adding a __str__() method  to your models.

But if you've got a unicode string that's called in the admin, you're going 
to get a big, unfriendly UnicodeEncodeError error when you load that admin 
change_form.html.

Wouldn't it be safer/better newbie user experience to go with a __unicode__ 
method instead?

— John

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b91cb5be-ea46-46af-9e81-344b610d124b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: utf-16le encode generic view object_list

2015-05-22 Thread JHeasly
@Tim: render_to_string! Forgot about that, somehow. That could clean it up 
a bit. Thanks!

@Stephen: Thanks for the feedback. This app's running internally and is on 
insecure and ancient 1.4, but the mimetype parameter reminder is a good 
one! 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ff1a98cf-8cdc-475d-aeb4-516564d741f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


utf-16le encode generic view object_list

2015-05-21 Thread JHeasly
Hello all,

I've got a function-based generic view that I want to return a utf-16le 
encoded response (for use as an InDesign tagged text file; the utf-16le is 
what InDesign wants). I've got it working here 
<https://gist.github.com/jheasly/0f7c53eec6d92905e127>, but am wondering if 
there's an more straightforward way.

For comparison, the "original" utf-8 encoded version is here 
<https://gist.github.com/jheasly/e94c8c283b103d954159> and shorter. I tried 
a 

response.content.encode('utf-16le')

as response seems to have some sort of HttpResponse wrapper on it.

Thanks,
John

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/396a9248-5930-43d9-a3bb-43154fd2ae9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sharing templates across multiple projects

2015-03-09 Thread JHeasly
Thanks for the feedback Simon & Ilya.

I've done submodules in Git before, but I think I'll keep the templates in 
a separate repo and symbolic link to the repo ... 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c9d516db-43df-48f7-819f-41496b51b9c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Sharing templates across multiple projects

2015-03-06 Thread JHeasly
Hello —

I'm looking for any blogposts/best practices for deploying a common set of 
templates across multiple Django projects.

My initial impulse is to just make a master Github repo of the template and 
pull it into each of the projects. Are there better approaches?

TIA,
John

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/59566fdb-8e41-42c9-a121-f0c303b41412%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: HELP with unicode!!!!!

2012-05-01 Thread JHeasly
Also, have a look at this slidedeck: http://farmdev.com/talks/unicode/

It's from a PyCon 2008 talk, "Unicode In Python, Completely Demystified" A 
video of the talk is at http://www.youtube.com/watch?v=cecJ9o5GGmw, but the 
audio's miserable, and the slides are pretty good, so it may be all you 
need to get your head around what's going on.

Also, in your code example, the error says Unicode*Encode*Error, *not*Decode, 
so try 
val.*encode*('utf-8')(not val.*decode*('utf-8')).

— John

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/DgoBL-3OoD4J.
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 group at 
http://groups.google.com/group/django-users?hl=en.



Re: admin list_filter: limit choices to model values?

2012-01-30 Thread JHeasly
In 1.4/trunk, looks like filterspec.py gets replaced by filters.py (as part 
of adding the ability to filter a list_filter), so we'll just sit tight and 
wait for 1.4 to be released (rather than have to go  back and remove the 
defunct filterspec code).

— John

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/fHJwHJZDaZMJ.
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 group at 
http://groups.google.com/group/django-users?hl=en.



Re: Using the same storage backend for media and static files.

2011-11-05 Thread JHeasly
Hi Ian —

You might get better traction with your question over on the 
django-developerslist.
 And thanks for your django-storages work!

— John

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/9R_pu1VOwOkJ.
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 group at 
http://groups.google.com/group/django-users?hl=en.



Re: Having trouble overriding template_object_name for the list_detail in generic view

2011-02-11 Thread JHeasly
You need to closely read the second sentence of template_object_name item in 
the *Optional arguments* section of the generic view bject_list 
docs.
 
Based on the template_object_name in your code, I think you'll find that 
your template object name is now "latest_poll_list_list". That appending 
"_list" to the variable name has bitten me (at least once!) too.

Cheers,
John

-- 
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 group at 
http://groups.google.com/group/django-users?hl=en.



Re: admin panel fieldsets for different type of users?

2010-09-03 Thread JHeasly
Also wondering the exact same thing, so +1 on any pointers/hints/
help ...

On Aug 1, 3:50 am, gondor  wrote:
> I use formset in my admin panel to group/title my related fields.
> This works great except when I go to exclude some fields for lesser
> users.
>
> In the simple example below if i'm a super user all works great.
> If i log in as a staff user thus the code exclude A formset I get the
> following error:
>
> Caught KeyError while rendering: Key 'A' not found in Form
>
> I don't mind having a conditional formset but I don't know how to do
> that based on the type of user.  Does anyone know how to solve this?
>
> model.py
> 
> class Cars(models.Model):
>   A = models.CharField('A', ...)
>   B = models
>   C = models...
>   D = models...
>
> admin.py
> 
> class CarsAdmin(admin.ModelAdmin):
>   fieldsets = (_('first group'},{'fields':(('A','B'),('C','D'),)})
>   def get_form(self,request,obj=None, **kwargs):
>     self.exclude = []
>     if not request.user.is_superuser:
>        self.exclude.append('A')
>     return super(CarAdmin,self).get_form(request, obj=None, **kwargs)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: what do you do to take your site down?

2010-08-06 Thread JHeasly
Also, see
"Maintenance Mode for Django Sites"
http://www.weavingtheweb.com/professional-blogs/78-maintenance-mode
and this related link
http://pypi.python.org/pypi/django-maintenancemode/

HTH,
John

On Aug 6, 9:24 am, Margie Roginski  wrote:
> Thank you very much - that all makes perfect sense.
>
> Margie
>
> On Aug 6, 9:09 am, akaariai  wrote:
>
> > On 6 elo, 18:36, Margie Roginski  wrote:
>
> > > Could anyone give me some pointers as to how you deal with taking your
> > > site down for maintenance?  Is there some standard thing that people
> > > do to redirect all page requests to some sort of "Sorry, the site is
> > > down" page?    Do you do this directly via apache or do you do it via
> > > django?
>
> > Make a simple model for notifications and use that on your front page
> > to notify upcoming maintenance breaks. I also use this style to inform
> > updates done etc. The model could be something like this:
>
> > class Notification(models.Model):
> >     notification = models.TextField()
> >     show_from = models.DateTimeField()
> >     show_until = models.DateTimeField()
>
> >     def __unicode__(self):
> >         return self.notification
>
> > Put notifictions =
> > Notification.objects.filter(show_from__lte=datetime.now(),
> > show_until__gte=datetime.now()) into your template and show the
> > notification list there. Use apache to show the actual maintenance
> > break message when the site is down.
>
> > > I additionally have a situation where when our mail server goes down,
> > > I would like to allow people to do GETS, but not POSTS.  If you have
> > > any ideas on this I would be interested.
>
> > One approach is to use middleware, and in the middleware check:
> > if request.method == 'POST' and email_is_down():
> >     return error page.
>
> > You could also use a default context processor which puts
> > posts_allowed variable in the context and then in base.html have {% if
> > not posts_allowed %} Technical problems... saving not allowed {% endif
> > %}. You could also wrap your submit buttons in {% if posts_allowed %}.
> > Maybe disable also the edit links...
>
> > - Anssi
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Dynamic data into a form

2010-07-05 Thread JHeasly
Hi Plaoto,

The blog post below is about the Admin, but I think the principles may
apply to your situation:

Runtime ChoiceField filtering in Django’s admin
http://www.artfulcode.net/articles/runtime-choicefield-filtering-in-djangos-admin/

HTH,
John

On Jul 5, 1:43 am, Plaoto  wrote:
> Hi all,
>
> I've got 2 Multiplechoicefields into my form both bounded to a
> queryset. The data in both fields are relational. This means that when
> I click on the 1st field and I select for example 'Netherlands' in the
> second field only the footballclubs of 'Netherlands' should show,...
>
> I should like to know the follwing:
>
> 1) How i filter the queryset from the 2nd list dynamically? Should I
> use some javascript doing this or can django handle this somehow?
> 2) How i pass my queryset from 1) to my forms.py as an argument or is
> there another way to do this?
>
> Thanks in advance
>
> Regards

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Clean method across multiple models?

2010-06-16 Thread JHeasly
Hello all,

Is there a sane way to make a clean [1] method that depends on fields
from across multiple models?

I've got a view that uses two form classes and want to write custom
validation that checks clean_data fields in both models and I'm
looking for an example of such.

TIA,
John

[1] 
http://docs.djangoproject.com/en/1.1/ref/forms/validation/#s-cleaning-and-validating-fields-that-depend-on-each-other

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Working for a startup.

2010-04-22 Thread JHeasly
There's also this:

http://kurtgrandis.com/blog/2010/02/24/python-django-vs-c-asp-
net-productivity-showdown/">Python + Django vs. C# + ASP.NET:
Productivity Showdown

>From the above:

"People are often asking me how and why my department shifted from an
ASP.NET environment to Django. I’ve finally gotten around to writing
about the process leading up to our decision. I hope people out there
find it useful in their own development groups and discussions. ... "

On Apr 22, 9:26 am, Jonathan Chen  wrote:
> Just to add my two cents. I think the fight between FOSS vs
> Proprietary is kind of a faulty argument because there is pros and
> cons for both sides. Anybody who says FOSS is the best or this
> Proprietary software is the best really doesn't understand the
> difference between FOSS and Proprietary software. I have worked with
> FOSS products and proprietary software before and they both have
> interesting issues between both of them. ASP.NET in my opinion is
> easier to scale.
>
> For proprietary stuff you'll probably have better support vs FOSS
> stuff generally. The cost to support FOSS products vs the cost of
> buying proprietary stuff usually ends up being equal in the long run.
> But I think its more important to understand as a business what are
> the key use cases and see if django or asp.net will fit the features
> needed. Basically, the decision between the two needs to be a business
> decision rather than a technological decision. I'm all for whatever is
> the best solution for the company. I think it is silly to say that
> FOSS is always better. If FOSS is always better then why don't more
> companies use it over Oracle or SAP or RHEL or SLES? It really needs
> to be a business decision. There are some cases where windows would do
> better.
>
> Other than that I would really just mention why django is better over
> asp.net. In my opinion, django has better organization and pushes for
> better organization than asp.net does in general. ASP.NET MVC is kind
> of behind the times versus other web frameworks, but it is catching
> up. Finding django developers are a lot fewer than asp.net developers,
> but I think (generally) you'll find better quality python developers
> than asp.net developers. There are probably other reasons, but can't
> think of them off the top of my head. Also, Python has more
> applications than C# does, and django has a mascot. Where is C#
> mascot? Retired!!
>
> Jonathan C.
>
> On Apr 22, 8:28 am, Kenneth Loafman  wrote:
>
>
>
>
>
> > Joe Goldthwaite wrote:
> > > I’ve been working for a startup for a month or so.  The main guy is
> > > enthusiastic about technology.  He probably runs more applications on
> > > his computer than anyone I know.  He also switched from a Windows
> > > background to a Mac notebook a year ago.  He doesn’t know a lot about
> > > web development or how it all works.  That’s what I’ve been helping with.
>
> > > He’s interviewed a number of companies trying to find a good one to
> > > develop version1 of the application.  I’ve been pushing him towards
> > > Linux/Python/Django and thought I had him convinced.  The company he’s
> > > thinking about going with is a .net shop.  They say they can do anything
> > > but the bulk of their developers are .net.  Still, he was thinking about
> > > going with this company but still having them develop in Django.
>
> > > This morning we had a conference call with one of the references the
> > > development company provided.  It turns out they’re a startup that’s
> > > working on a different application in the same industry as us so there
> > > was an affinity there.  The guy mentioned that they originally started
> > > with a different company using Ruby on Rails.  He said that after the
> > > other company got bogged down and wasn’t making progress, he switched to
> > > the new company that we’re considering.  He said that they got the
> > > project back on track and organized but ended up running into lots of
> > > problems with Rails.  They talked it over and decided to rewrite
> > > everything in .net.  Now he’s happy with the progress and feels like
> > > .net is a superior platform and is allowing him to develop his program
> > > at a lower total cost.
>
> > > This has my boss worried.  Most of the people he’s been talking to are
> > > from large companies.  One of them was even a high end Microsoft
> > > person.  I think he’s starting to think that the Microsoft technology
> > > stack might be the safer choice. He wants to get to the point of having
> > > millions of users and is worried that Django wont cut it. I’m also
> > > worried that if he does stick with Django, the development company might
> > > blame any setbacks on Django and push for a rewrite in .net.
>
> > I also work for a startup company and we are firmly entrenched in Linux,
> > Django, Postgress, and other FOSS products.  We could not afford to go
> > any other route.
>
> > When someone asks about FOSS vs proprietary, my first question 

Re: Order model objects by foreign key "set" count

2010-03-11 Thread JHeasly
This post was exactly was I was looking for!

Just a reminder, don't forget to
from db.models import Count

On Jan 11, 8:51 pm, Margie Roginski  wrote:
> Ah - yes, that is so awesome!  For anyone interested, here's the magic
> incantation:
>
> Book.objects.annotate(Count('reader')).order_by('reader__count')
>
> Or more verbosely:
>
> Book.objects.annotate(num_readers=Count('reader')).order_by
> ('num_readers')
>
> That documentation link describes it very well.   Thanks Scott!
>
> Margie
>
> On Jan 11, 7:51 pm, Scott Maher  wrote:
>
>
>
> > Margie Roginski wrote:
> > > Say I have a Readermodelthat has aforeignkeyto a Book
>
> > > class Reader(models.Model):
> > >   book = models.ForeignKey(Book)
>
> > > Now say I want to find all books andorderthem by the number of
> > > readers.  Is that possible, ie something like this?
>
> > > Book.objects.all().order_by(reader_set__count)
>
> > > This syntax doesn't work, however.  Is this possible?
>
> > > Margie
>
> > I can't give you specific code but I think that you want is under the
> > Aggregation section of the documentation. Specifically I think you want
> > to apply the Count object on the Book reader set. You were almost there. :)
>
> >http://docs.djangoproject.com/en/dev/topics/db/aggregation/#topics-db...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Good way to modify admin list_filter based on is_superuser?

2009-11-20 Thread JHeasly
In using Simon W.'s "simple example of row-level permissions in the
admin"  (http://www.djangosnippets.org/snippets/1054/), I'm trying to
extend the concept by modifying the 'list_filter' tuple of the
subclassed ModelAdmin based upon the request.user.is_superuser
property buy am struggling with how to hook it into my class.

Intuitively, it seems like overriding the __init__ ModelAdmin is where
it needs to go. I've tried something like:

def __init__(self, model, admin_site, request, *args, **kwargs):
if request:
if request.user.is_superuser:
self.list_filter = ('has_run',)
super(Death_noticeAdmin, self).__init__(model, admin_site,
request, *args, **kwargs)

but the above fouls the registering of the Death_noticeAdmin class:

  File "/usr/local/lib/python2.5/site-packages/django/contrib/admin/
sites.py", line 93, in register
self._registry[model] = admin_class(model, self)

TypeError: __init__() takes at least 4 arguments (3 given)

My lack of a completely thorough understanding of 'super' probably
isn't helping either. Any suggestions, ideas appreciated.

— J.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.




Re: default blank choice on form.Form select widget

2009-08-07 Thread jheasly

Paulo -

Just to follow-up, I tried the patch (4092_9912_nullselect.diff), but
it being about 1500 checkins out of date, it only half worked.

In my forms.py, I ended up overriding the USStateSelect with a hack:

class HackedUSStateSelect(Select):
def __init__(self, attrs=None):
from django.contrib.localflavor.us.us_states import
STATE_CHOICES
STATE_CHOICES = (('',u'-'),) + STATE_CHOICES
super(HackedUSStateSelect, self).__init__(attrs,
choices=STATE_CHOICES)

Unless someone has a better suggestion, I think I'll live with it and
try to help with getting ticket 4092 into trunk ...

- John

On Aug 5, 1:49 pm, Paulo Almeida  wrote:
> Did you see this ticket?
>
> http://code.djangoproject.com/ticket/4092
>
> Maybe you can use the patch code to customize your field.
>
> - Paulo
>
> On Wed, Aug 5, 2009 at 8:01 PM, JHeasly  wrote:
>
> > The doc page "Creating forms from models"
> > (http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#topics-
> > forms-modelforms<http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#topics-...>
> > )
> > describes how
> > "If the model field has choices set ... [snip] ... The choices will
> > normally include the blank choice which is selected by default. ... "
>
> > I have a form that's not associated with a database model (i.e.,
> > form.Form) and I'm using the USStateSelect widget, but the blank
> > choice isn't included in the STATE_CHOICE list. When the form loads,
> > what I get is "Alabama" selected by default. I'd like to get the
> > forms.ModelForm-style blank choice default selection behavior.
>
> > I'm guessing some sort of super() def __init__ trickery is called for
> > but am stumped so far ...
>
> > Thanks,
> > John
>
>
--~--~-~--~~~---~--~~
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 group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: default blank choice on form.Form select widget

2009-08-05 Thread jheasly

Hey Paulo,

No I hadn't seen the ticket. Thanks for the heads up.

Hard to tell from Trac what is holding up 4092. I see 10969 is more
recent, but a different angle of attack on the issue.

— John
--~--~-~--~~~---~--~~
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 group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



default blank choice on form.Form select widget

2009-08-05 Thread JHeasly

The doc page "Creating forms from models"
(http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#topics-
forms-modelforms)
describes how
"If the model field has choices set ... [snip] ... The choices will
normally include the blank choice which is selected by default. ... "

I have a form that's not associated with a database model (i.e.,
form.Form) and I'm using the USStateSelect widget, but the blank
choice isn't included in the STATE_CHOICE list. When the form loads,
what I get is "Alabama" selected by default. I'd like to get the
forms.ModelForm-style blank choice default selection behavior.

I'm guessing some sort of super() def __init__ trickery is called for
but am stumped so far ...

Thanks,
John
--~--~-~--~~~---~--~~
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 group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Count the number of times FormPreview displays preview?

2009-03-18 Thread JHeasly

Hello all,

Using Django's sessions, I want to keep track of how many times a user
displays the FormPreview preview. After a given number of re-displays,
I'd like to redirect the user (via an HttpResponseRedirect) to a help
page.

I'm trying to discern if this is A.) a feasible workflow and B.) where
to put the logic.

Assuming A.), browsing the code online (http://code.djangoproject.com/
browser/django/trunk/django/contrib/formtools/preview.py), it looks
like the best place to do this is by overriding the preview_post
method of the FormPreview class (Line 58), but I'd rather not override
bits that weren't intended for such, and preview_post is part of
section labeled "METHODS SUBCLASSES SHOULDN'T OVERRIDE"

Is there a better way to do this?

TIA,
John
--~--~-~--~~~---~--~~
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 group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django-contact-form contexts?

2009-01-16 Thread JHeasly

Hello Ryan,

Admittedly the docs at 
http://django-contact-form.googlecode.com/svn/trunk/docs/overview.txt
just say you need to create the template files "contact_form/
contact_form_subject.txt" and "contact_form/contact_form.txt" and not
much else, but in "contact_form_subject.txt" you need to put a subject
line. In "contact_form.txt" you can put something like:

The sender: {{ name }}
The sender's e-mail address: {{ email }}
Any comments: {% autoescape off %}{{ body }}{% endautoescape %}

I also found this helpful:
http://patrickbeeson.com/blog/2007/oct/30/how-install-djangocontactform/

Cheers,
John


On Jan 16, 12:59 pm, chyea  wrote:
> What contexts are made available to the email templates (.txt files)?
> When I receive emails from the form provided by the default setup, I'm
> being given the following for both the subject, and the message of the
> email.
>
>  at 0x80c85d0c>>
>
> Thank you in advance
> Ryan
--~--~-~--~~~---~--~~
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 group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



date_hierarchy on a ForeignKey?

2007-12-20 Thread JHeasly

My hunch is the answer is "No," but is it possible to do a
'date_heirarchy' on a ForeignKey date object? Haven't been able to
find anything in the archive on the topic. Pointers gratefully
accepted.

John
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Why are 'greater than', 'less than's getting rendered as HTML entities?

2007-12-04 Thread JHeasly

Ya see? I *knew* it was obvious ... as I already had the "Backwards-
incompatible changes" page open.

The problem was is that I was convinced it was a unicode-merge issue
so I've been up and down
http://code.djangoproject.com/wiki/UnicodeBranch#PortingApplicationsTheQuickChecklist
and
http://www.djangoproject.com/documentation/unicode/

Then I was thinking it might be a render_to_response issue, so I was
poring over
http://www.djangoproject.com/documentation/shortcuts/

So it's not as if I warn't RTFM'ing, just RTFM'ing in the wrong
place(s). Which is why I asked for (and received) a point in the
*right* direction.

(I'll read all the docs a'fore wondering about how much magic's taking
place  : )  )

Anyways, *many* thanks James!

On Dec 4, 1:04 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On 12/4/07, JHeasly <[EMAIL PROTECTED]> wrote:
>
> > it works as expected. So it seems something in the templating response
> > food chain is converting the greater than's/less than's(?).
>
> > What is the obvious thing I'm missing?
>
> You're going against the strong recommendation of the Django project,
> which is that if you're going to track trunk you should be keeping an
> eye on the development process and, at the very least, watching the
> list of backwards-incompatible changes which occur between stable
> releases; this page will tell you what's going on.
>
> http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Why are 'greater than', 'less than's getting rendered as HTML entities?

2007-12-04 Thread JHeasly

Hello,

I'm missing something somewhere. Somebody please point me in the right
direction. I'm using Rev. 6865.

My view.py:

def foo(request) :
return render_to_response('classifieds/blank.html',
{
'content': "",
},
mimetype = "text/html"
)

My blank.html:

{{ content }}

The urls.py works, as the view is getting correctly dispatched. I have
no DEFAULT_CONTENT_TYPE in settings.py.

The problem:

When I request the page, I'm getting



instead of



Firebug shows the Response Header as:

Content-Type: text/html

If I do it this way:

response = HttpResponse()
response.write("")
return response

it works as expected. So it seems something in the templating response
food chain is converting the greater than's/less than's(?).

What is the obvious thing I'm missing?

John
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: remember me feature

2007-08-01 Thread JHeasly

Hey James,

This might get you going in the right direction:

"The default SessionMiddleware that comes with Django lets you pick if
you want all sessions to be browser-length or persistent, if you want
to use different types of sessions based on a users preference (e.g.
the good old "Remember Me" check-box) you're gonna have to write your
own middleware. ... "

http://code.djangoproject.com/wiki/CookBookDualSessionMiddleware

Hope this helps.

John


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



More of a lighttpd question (I think)

2007-07-31 Thread JHeasly

I keep getting this loop in my lighttpd error log:

09:41:07: (mod_fastcgi.c.3457) all handlers for  /mysite.fcgi/
classifieds/topjobs/5/ on /mysite.fcgi are down.
09:41:12: (mod_fastcgi.c.2669) fcgi-server re-enabled: unix:/usr1/
local/oper/class.sock
09:41:18: (mod_fastcgi.c.1739) connect failed: Connection refused on
unix:/usr1/local/oper/class.sock
09:41:18: (mod_fastcgi.c.2851) backend died, we disable it for a 5
seconds and send the request to another backend instead: reconnects: 0
load: 16

Occasionally, a few of these get logged too:

09:45:00: (connections.c.222) unexpected end-of-file: 8
09:45:41: (connections.c.222) unexpected end-of-file: 7

Any ideas on what to check? Seems like the fcgi process is dying(?).
Permission-wise, the class.sock socket has "srwxrwxrwx"

Any suggestions much appreciated.

Regards,
John


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Working '/comments/flag/[comment.id here]/' examples?

2007-07-03 Thread JHeasly

> Ah, ok.  Yeah, this has been broken a long while.

Well, I guess that's a good reason for it not to work! : )

> The comments contrib needs some love, but I understand Jacob's working
> on a rewrite

Good deal! I look forward to it.

> But you're in luck; I recently ported from an old version of Django to
> 0.96, so I had the fun of sorting through the bugs.
>
> I've filed a couple comment-related patches on tickets, but I'll
> attach a single diff here for convenience.

Thanks! I don't have server root access, so I'll have to wait to get
the patch(es) applied. I can see the 'objects' fix in django/contrib/
comments/models.py!

> You may also be interested in James' recent comment 
> utilities:http://www.b-list.org/weblog/2007/06/25/hacking-comments-without-hack...

Yeah, I've seen those and will undoubtedly be monkeying about with
them soon.

Thanks again Jeremy for all your help.

John


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Working '/comments/flag/[comment.id here]/' examples?

2007-07-02 Thread JHeasly

On Jun 29, 6:05 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> Very odd.  UserFlag has an objects attribute which is an of
> UserFlagManager.  Looking at the svn source, I don't see how UserFlag
> in views.userflags.flag() could refer to a UseFlagManager object
> rather than the UserFlag model.  :-/

Sorry, I didn't mean to convey that ... userflags.flag() refers to
UserFlagManager directly. It's as you say, UserFlag's object is an
instance of UserFlagManager, but nonetheless, here's the line (no.
254) in UserFlagManager (called from UserFlag) where the request
fails:

 f = self.objects.get(user__pk=user.id, comment__pk=comment.id)

I was hoping for a working example from someone/somewheres, to help me
troubleshoot this ...

Cheers.
John


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Working '/comments/flag/[comment.id here]/' examples?

2007-06-29 Thread JHeasly

Hello,

I've been poking around the SVN Comments and
django.contrib.comments.views.userflags.

I've got the URL "/comments/flag/[comment.id here]/" working the
"first" time, i.e. like it's used on an ljworld.com story page, where
it returns an "are you sure?" page and a "Yes, go ahead" form button
that POSTs flagging the comment. In my example, when I click to POST I
get:

'UserFlagManager' object has no attribute 'objects'

The "/comments/flag/[comment.id here]/" POST action URL dispatches to
django.contrib.comments.models.UserFlag, which imports
UserFlagManager, which then throws the error. After that, I'm
scratching my head.

I'm stumped. Any suggestions as to where to look for working Comment
(not FreeComment) models?

Regards,
John


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Common problem? Grouping date based objects by year?

2007-01-17 Thread JHeasly

Hi Rob,

Try something like this (untested):

{% regroup news_list by year as grouped %}
{% for group in grouped %}
{{ group.grouper }}
{% for item in group.list|dictsort:"year" %}

{{ 
item.date_posted|date:"F
Y" }}

{% endfor %}
{% endfor %}

I added an optional  "subhead" with the year in the above, which
you may find useful. Or not.

Also, see
http://groups.google.com/group/django-users/browse_thread/thread/126fd2da721737f7/858e38a7b440b294?lnk=gst&q=tredinnick+dictsort&rnum=1#858e38a7b440b294
and search Django-users for "group dictsort"

Hope this helps,
John


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



"Decimal not JSON serializable"?

2006-12-18 Thread JHeasly

Hello all,

I'm following the "Serializing Django objects" documentation and have a
view pretty much verbatim from the docs:

def my_json_view(request):
data = serializers.serialize("json", Location.objects.all())
return HttpResponse(data, mimetype='text/javascript')

My Location model includes decimal latitude and longitude data. When I
test the above view using the Django shell, it works, but when I try it
via a browser request, I get this:

Decimal("44.048708") is not JSON serializable
Request Method: GET
Request URL:http://www.my_url.com/maps/json/
Exception Type: TypeError
Exception Value:Decimal("44.048708") is not JSON serializable
Exception Location:  ... [snip] ...
/django/utils/simplejson/encoder.py in default, line 258

Also, the above will works via the browser when I specify "xml" as the
serialization format. The "json" format just doesn't like my decimals.
What am I doing wrong?

Thanks for any guidance,
John


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Lighttpd log timestamp

2006-11-03 Thread JHeasly

It's more of a Lighttpd issue, (I've Googled, posted to the Lighttpd
wiki and e-mailed and heard nothing back ... ) but I'm serving Django
with the Lighttpd/flup/FastCGI combo which works fine. The problem is I
can't get the proper time zone to show up in the access logs. The
timestamps are GMT and I need Pacific time in order to sync the hits
with our Apache logs (which are PT, as they should be).

I've tried the formatting examples in the Lighttpd mod_access docs and
no joy.

Anybody out there successfully moved their Lighttpd logs off of GMT? If
so, how'dya do it?

Regards,
John


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



RSS syndication and URLs

2006-10-17 Thread JHeasly

Just to verify, to get something like the "complex example" of the docs
(http://www.djangoproject.com/documentation/syndication/) to work --
where feeds publish different data for different URL parameters -- is
there anything special you need to do to the URLConf regex? Is

(r'^rss/(?P.*)/$', 'django.contrib.syndication.views.feed',
{'feed_dict': feeds}),

with a URL like:

http://www.foo.com/rss/the_slug/11344/bar/

and this from the URLConf:

feeds = {
'rss': CustomRSS,
}

supposed to work?

It's my understanding that in the above URL "the_slug" is the slug and
anything after that should be shipped off in a list (i.e., ['11344',
'bar']) to get_objects(self, bits). Yes? Mebbe?

I keep getting a 404 with this message:
"Invalid feed parameters. Slug 'the_slug' is valid, but other
parameters, or lack thereof, are not."

John H.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Mysql 3.23.xx

2006-10-10 Thread JHeasly

James Bennett wrote:
>
> I can't think of anything we do that would break it, but I also don't
> know nearly enough about ancient versions of MySQL.

If you have a "date_hierarchy" in your models.py, it will break with
MySQL 3.23.53 as Django builds a query that uses "CAST()", which didn't
exist until MySQL 4.0.2. That's when I took my Webmaster's advice and
installed Postgres. : )

John Heasly


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Using Django in a Cron Job

2006-08-09 Thread JHeasly

Steven Armstrong wrote:
> On 08/09/06 17:56, Joe wrote:
> > I would like to set up a python script that runs every night to send
> > out an email subscription.  I would like to access a Django model that
> > has the user's email addresses, as well as use the Django sendmail
> > function.  Can someone help me understand what imports/path setup I
> > have to do to get this working? (Note: I will not be setting up the
> > Cron job, nor do I know now.  I will simply be giving a python script
> > to our IT staff for them to set up).

Also, if you're using Django's send_mass_mail, note that "As in
send_mail(), recipients in the same recipient_list will all see the
other addresses in the e-mail messages's 'To:' field." (from
http://www.djangoproject.com/documentation/email/#send-mass-mail)

I think if you want to use a "Bcc:" header, straight Python may be the
way to go. As the e-mail doc says, have a look at
http://www.python.org/doc/current/lib/module-smtplib.html (and
http://www.python.org/doc/current/lib/module-email.html).

Regards,
John


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Declare a variable in a template

2006-08-04 Thread JHeasly

Don Arbow wrote:
>
> list_1 = Shows.objects.filter(upcoming=True)
> list_2 = Shows.objects.filter(past=True)
>
> return render_to_response('template.html'
>   {'upcoming_shows':list_1, 'past_shows':list_2})
>
> Don

Don,

Thanks for the clean, clear example! It helped me see a way out in a
variation of the same situation, i.e., a
loader.get_template('template.html').render(Context({'upcoming_shows':list_1,
'past_shows':list_2})) situation. I'm using the Django templates & API
in a "outside-of-Django" Python script to create and send an e-mail
document.

{%minor_nit%}In your render_to_response example, oughtn't there be a
comma after 'template.html'?{% end minor_nit %}

Thanks again!

John


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: error in your SQL syntax near '(DATE_FORMAT... on adding date_hierarchy = 'pub_date'

2006-06-13 Thread JHeasly


Andy Dustman wrote:
> ... [snip] ...
> Your original error was: "You have an error in your SQL syntax near
> '(DATE_FORMAT(`polls_poll`.`pub_date`, '%Y-01-01 00:00:00') AS
> DATETIME) FROM `p' at line 1"  I'm going to guess that the bit before
> the leading parenthesis is "CAST", and CAST() does not exist prior to
> MySQL-4.0.
>
> http://dev.mysql.com/doc/refman/4.1/en/cast-functions.html
>
> Solution: I recommend MySQL-4.1 or newer with MySQL-python-1.2.1.

Yeah, you're spot on. I found the query and it is a pre-4.0
MySQL/"CAST" issue. The MySQL documentation
(http://dev.mysql.com/doc/refman/4.1/en/cast-functions.html) says:
"CAST() and CONVERT() are available as of MySQL 4.0.2."

It's entirely possible that I'm a near-sighted dolt, but I don't see
any MySQL version requirements notes on the install doc. Might it be a
Good Thing to note that "if you want to use date_hierarchy in your
models.py Admin classes, use MySQL 4.0.2 and up ... " on
http://www.djangoproject.com/documentation/install/ ?

John H.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: html input tag width corresponding to CharFields always fixed

2006-05-30 Thread JHeasly

Is there a way to fold this into a model that uses only generic views
(i.e., without getting into custom manipulators)? And if so, an example
would be humongously appreciated!

John H.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Three models linked together: how do i do (...) ?

2006-05-04 Thread JHeasly

For a some ideas, you might want to have a look at Paul Bissex's twenty
minute trouble ticket system: http://e-scribe.com/news/230

John


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: load comments

2006-05-04 Thread JHeasly

Adrian Holovaty wrote:
>
> Hi John,
>
> Yes, that's the proper "fix." The comments app is an add-on; we'd
> rather not force the installation of those database tables for every
> Django user, so it's up to you to opt into installing it.

Hello Adrian,

Yeah, I got caught up in that infectious Kaplan-Moss enthusiasm! : )
Now that I've poked around, I see the optionality of it. "Fix" was
definitely not the right word. My apologies. I got the impression from
Jacob's talk comments came installed and all that was needed was
template tags.

And it's not like there's all that much to it; adding the
INSTALLED_APPS line and doing a syncdb and then figuring out the
appname.model and the object.id for the {% get_free_comment_list ... %}

John


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



load comments

2006-05-03 Thread JHeasly

I watched Jacob's great Bay Area Google video and had never seen any of
that nifty {{ load comments }} stuff before. Eager to give it a try, I
was sad when I added it to polls app tutorial results.html template and
it broke.

I fixed it by adding

'django.contrib.comments',

to the INSTALLED_APPS of my settings.py.

So, 1.) is this the right-and-proper fix? And 2.) if so, when you make
a generate a new project with the current (0.95 post-magic-removal,
rev. 2825) django-admin.py, it's not included in the default/base set
of INSTALLED_APPS. Is it deliberately left up to the user to add this
to the INSTALLED_APPS?

John


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: How to get vote total in poll tutorial

2006-03-31 Thread JHeasly

Ah! You're correct. I get it now. Thanks!


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: How to get vote total in poll tutorial

2006-03-29 Thread JHeasly

>
> Then you probably want it to read:
>  choices.get_values(fields=['poll', 'votes'], poll_id__exact=1)
>
> i.e.   your "field" is "poll_id" and the lookuptype is "exact"
> which translates to "poll_id__exact", and THEN the equals sign
> and what value you are asking it to match.
>
> --
> Glenn

Figured it out; poll_id maps from polls_choices to the polls_polls
primary key, so I tried using the Django primary-key shortcut (see
below) and now it works.

choices.get_values(fields=['poll', 'votes'], poll_id__exact=1)

as suggested above, doesn't work: (TypeError: got unexpected keyword
argument 'poll_id__exact'), but ...

choices.get_values(fields=['poll', 'votes'], poll__pk=1)

 ... does! Not sure why though.

Just as an "exercise left to the reader" sort of thing, I was trying to
figure out how to make the lookup work without the pk shortcut, i.e.:

choices.get_values(fields=['poll', 'votes'], poll__poll_id__exact=1)

but it fails: TypeError: got unexpected keyword argument
'polls__poll_id__exact'

I'm stumped!

John


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---