Re: django and unicode

2011-10-11 Thread Elim Qiu
Elim Qiu wrote: >> I just start try django 1.3.1, still in the step I of the tutorial, >> but noticed that the tables created is in latin1 encoding while I >> prefer utf8 for the entire app. > > This https://docs.djangoproject.com/en/dev/ref/unicode/ > > would suggest that making the table UTF8 s

Re: django and unicode

2011-10-11 Thread Lachlan Musicman
On Wed, Oct 12, 2011 at 15:13, Elim Qiu wrote: > I just start try django 1.3.1, still in the step I of the tutorial, > but noticed that the tables created is in latin1 encoding while I > prefer utf8 for the entire app. This https://docs.djangoproject.com/en/dev/ref/unicode/ would suggest that ma

django and unicode

2011-10-11 Thread Elim Qiu
I just start try django 1.3.1, still in the step I of the tutorial, but noticed that the tables created is in latin1 encoding while I prefer utf8 for the entire app. I don't want to set the database default char encoding to be utf8 since I have other non-django apps. What is the proper way of set

Re: Sample Custom Decorator

2011-10-11 Thread Kurtis Mullins
Thank you so much for the awesome clarification. It makes a lot more sense. I'm going to read those docs and play around with the code just to feel comfortable. I appreciate the great answer! On Tue, Oct 11, 2011 at 8:11 PM, Steven Cummings wrote: > The wrapper that you typically see is the new

Re: Sample Custom Decorator

2011-10-11 Thread Steven Cummings
The wrapper that you typically see is the new function that is returned. This usually invokes the original, given function in addition to some extra ("decorating") logic around that call. Based on that question it sounds like you might want to check out some introductory material on decorators [1][

Re: Django - how to create a private subpage?

2011-10-11 Thread Matt Schinckel
That line (p = ...) is in a view, right? It will probably want to be: p = Publisher.objects.filter(status='p', pub_type='private_gallery', user_gallery=request.user).order_by('-id') Matt. -- You received this message because you are subscribed to the Google Groups "Django users" group. T

Re: Storing data from frequently changing forms

2011-10-11 Thread Kurtis Mullins
I don't know how to go about integrating Django with an RDF Store, but from my academic experience RDF Stores were pretty popular to use when you have constantly changing data. I'd be interested in a RDF Store project for Django if you end up going that route. On Tue, Oct 11, 2011 at 5:53 PM, Mich

Re: Sample Custom Decorator

2011-10-11 Thread Kurtis Mullins
Thanks Fred! I tried to look through your code and understand what's going on -- but I'm still at a loss. I'm guessing I need to look at the Django source to see what should be returned when you hit a URL and what is passed. The wrapper is confusing me and I've seen that in Django code as well. I'm

Storing data from frequently changing forms

2011-10-11 Thread Michael Wayne Goodman
Hi all, I'm new to this and could use some help, I'm implementing a large-ish form-based application for an ongoing academic project. As students come and go, the form fields change frequently, so I'm wary to have form fields map to database entries. Does anyone have a good idea of how to store th

Re: Alternative to the .using() method

2011-10-11 Thread Jacob Kaplan-Moss
On Tue, Oct 11, 2011 at 3:47 PM, Sells, Fred wrote: > I'm using a MySQL database and one table resides in a separate database > than all the others.  It's a generic logging table. > > I understand the use of the .using() method, but I wonder if there is a > way to specify the alternative model in

Re: Django - how to create a private subpage?

2011-10-11 Thread Victor Hooi
heya, I might be misunderstanding your requriements, but could you use the @user_passes_test decorator with a has_perm check? @user_passes_test(lambda u: u.has_perm('private_pages.foo')) https://docs.djangoproject.com/en/dev/topics/auth/ You can probably make the lambda a bit smarter, instead

Re: Django - how to create a private subpage?

2011-10-11 Thread Kurtis Mullins
Check out this page: https://docs.djangoproject.com/en/dev/topics/auth/#handling-object-permissions Also, you may want to check out decorators if the user only has to be logged in. Another method you could use are groups. On Tue, Oct 11, 2011 at 1:56 PM, Petey wrote: > I am trying to do a privat

Alternative to the .using() method

2011-10-11 Thread Sells, Fred
I'm using a MySQL database and one table resides in a separate database than all the others. It's a generic logging table. I understand the use of the .using() method, but I wonder if there is a way to specify the alternative model in the model definition so I don't have to depend on remembering

RE: Sample Custom Decorator

2011-10-11 Thread Sells, Fred
I'm no expert but this is what I built to log all user actions -- warts and all def decorate(func): ##print 'Decorating %s...' % func.__name__ def wrapped( *args, **kwargs): request = args[0] if len(args)>1: command=str(args[1]) else: command = ''

Re: Still getting IntegrityError in test fixture using dumpdata --natural

2011-10-11 Thread bobhaugen
Replying to myself: temporary fix for dumpdata: --exclude contenttypes --exclude auth.permission The result now works as a test fixture. Not sure what to conclude: * the fix for issue #7052 does not work? * --natural does not fix the IntegrityErrors with contenttypes in test fixtures? * contentt

Django - how to create a private subpage?

2011-10-11 Thread Petey
I am trying to do a private subpage for every user which will be accessed trough url: url(r'^galeria/$', 'publisher.views.private_gallery'), I was trying to create a query set for private gallery by using a signal: user_logged_in p = Publisher.objects.filter(status='p', pub_type='private_ga

Re: Help with implementing dynamic views/models

2011-10-11 Thread Laura C.
BEAUTIFUL! It's printing the HTML as a string, though, but that I can putz around with, at least I have output! Thank you *so* much, Brett!! On Tue, Oct 11, 2011 at 12:49 PM, Brett Epps wrote: > The reason for that output is that page is a list, not a single object. > If you want a specific pag

Still getting IntegrityError in test fixture using dumpdata --natural

2011-10-11 Thread bobhaugen
Still getting "IntegrityError: columns app_label, model are not unique" when loading a test fixture created by dumpdata using the keyword --natural. I am probably missing something, but I understood the resolution to https://code.djangoproject.com/ticket/7052 to be to use the new -- natural keywor

Re: Trivial view sometimes fails in Chrome

2011-10-11 Thread Javier Guerra Giraldez
On Tue, Oct 11, 2011 at 11:39 AM, Pigletto wrote: > I've just noticed that switching off 'keep-alive' at Cherokee solves this > problem, so issue might be related to Cherokee... though I'm not sure - why > it works after placing call to request.POST in my view? sounds like Cherokee needs that the

Paginator has many Pages, but all are empty?

2011-10-11 Thread ch3ka
I have a problem with django.core.paginator. I have a Page object who's .object_list is [], but at the same time it's repr() states "Page 1 of 11". How is that even possible? Same with page 2, page 3 ,... -- You received this message because you are subscribed to the Google Groups "Django use

Re: urls.py matching

2011-10-11 Thread django-mike1
flavia, I was wrong that is working, thanks. On Oct 11, 11:07 am, Flavia Missi wrote: > Hi, > > You just need to add a "-" in your regex, like this: > > [.\w-]+ > > Use this site to try your regex:http://regexpal.com/ > > []'s > > On Tue, Oct 11, 2011 at 12:51 PM, django-mike1 > wrote: > > > > >

Re: Help with implementing dynamic views/models

2011-10-11 Thread Brett Epps
The reason for that output is that page is a list, not a single object. If you want a specific page, use Page.objects.get instead of Page.objects.filter. Brett On 10/11/11 11:30 AM, "Laura C." wrote: >that at least gave me an output, but the output is: [] > >I have a potential to need 3 attrib

Re: Trivial view sometimes fails in Chrome

2011-10-11 Thread Pigletto
> > Honestly I don't have any experience with Django and AJAX Yet. Just in > case you haven't checked it out yet -- I've read you've got to submit > the CSRF with your calls though. Not sure if that helps at all. Good > luck! Thanks for the tip but I've switched CSRF off. I've just noticed

Min/Max value on FloatField

2011-10-11 Thread Craig Blaszczyk
Hi, I'm wondering if there's a recommended solution for a FloatField which requires a minimum value? IMHO the best solution would be a ModelField implementation which provides this functionality. Can anybody recommend one, as I prefer not to implement it myself? Cheers, --Craig Blaszczyk --

Re: Help with implementing dynamic views/models

2011-10-11 Thread Laura C.
that at least gave me an output, but the output is: [] I have a potential to need 3 attributes from each object in each template, so the mapping may not be what I need. If I pass in a context object, I thought that I should have handles for object.attribute ?  Or maybe I need to map the dict befor

Re: urls.py matching

2011-10-11 Thread django-mike1
Thanks for the reply, but that's not working , I also noticed my regex is not catching domains with a '-' i.e. domain-new.com On Oct 11, 11:07 am, Flavia Missi wrote: > Hi, > > You just need to add a "-" in your regex, like this: > > [.\w-]+ > > Use this site to try your regex:http://regexpal.

Freelance Django Developer needed!

2011-10-11 Thread Anton Pirker
Hi! (First to everyone not searching for a job: sorry for the shameless job advertisement!) We are searching for a Freelance Django developer to help us out! We are: - creativesociety.com - based in Vienna, Austria - small team of 4 - pretty cool What you should have: - passion for writing be

Re: urls.py matching

2011-10-11 Thread Flavia Missi
Hi, You just need to add a "-" in your regex, like this: [.\w-]+ Use this site to try your regex: http://regexpal.com/ []'s On Tue, Oct 11, 2011 at 12:51 PM, django-mike1 wrote: > I am creating a Django Front end for a PDNS Server and having a > problem with my urls.py url matching. > > This

Re: Trivial view sometimes fails in Chrome

2011-10-11 Thread Kurtis
Honestly I don't have any experience with Django and AJAX Yet. Just in case you haven't checked it out yet -- I've read you've got to submit the CSRF with your calls though. Not sure if that helps at all. Good luck! On Oct 11, 6:07 am, Pigletto wrote: > Simple view, shown below, sometimes fail in

Re: Add to database

2011-10-11 Thread Brett Epps
I think you need to look up a specific Proyecto object before trying to add users to it. So: proyecto = Proyecto.objects.get(...) for i in request.POST.getlist('usuarios'): usuario = User.objects.get(id=i) proyecto.usuarios.add(usuario) Hope that helps, Brett On 10/11/11 4:15 AM, "jose

Sample Custom Decorator

2011-10-11 Thread Kurtis
Hey Guys, Would anyone be willing to show me an example of a very simple and dumb decorator for views? I've been trying to read the existing decorators and play with a couple of snippets but I'm having a lot of trouble with two aspects -- grabbing the User Instance and Redirecting somewhere beside

Re: Help with implementing dynamic views/models

2011-10-11 Thread Brett Epps
Try it with {'page': page} as your extra_context. The keys in a context dict should always be strings. Brett On 10/11/11 8:29 AM, "xenses" wrote: >I thank you for your help and apologize for my naivete, however I >still am not seeing that tag populate in the template. Here is my view >function

urls.py matching

2011-10-11 Thread django-mike1
I am creating a Django Front end for a PDNS Server and having a problem with my urls.py url matching. This line (r'^zones/(?P[.\w]+)/$', zones) will match any url like /domain.com/ /domain.net/ domain.org/ etc. just fine what changes would I need to make to this line to also match domains such

Re: Installing Django

2011-10-11 Thread Cal Leeming [Simplicity Media Ltd]
Nice :) Karen, do you think it's worth updating the Django windows documentation to mention this? On Tue, Oct 11, 2011 at 2:52 PM, Bob Peene wrote: > FYI you were right. Wiping and reinstalling did the trick. I'm back > in the tutorial. Thank you very much! > > > > On Oct 10, 10:16 am, Bob P

RE: Need advice on ForeignKey query problem.

2011-10-11 Thread Sells, Fred
Thanks Kevin, you got me on the right track. I was able to implement the following solution: records = models.Facility.objects.filter(...) for x in records: schedule = x.schedule_set.all() But I could not find a way to do it all at once like records = model

Re: Iteration over queryset in a model

2011-10-11 Thread eyscooby
slowly getting there thanks to your help. I am actually trying to accomplish this in the Admin interface, so I am not sure how to use the template tag {{ ticket.days_old }} in that situation. the other part I left off yesterday under my model I then had.. (trying to get code formatting correct but

Re: Installing Django

2011-10-11 Thread Bob Peene
FYI you were right. Wiping and reinstalling did the trick. I'm back in the tutorial. Thank you very much! On Oct 10, 10:16 am, Bob Peene wrote: > Kejun/Cal/Karen: Thank you very much for the info!! > > I did rerun setup.py, but given this info, it probably didn't improve > anything.  I'll wi

Re: Alternative to Decorators for Class-Based View

2011-10-11 Thread Kurtis Mullins
Sorry for the late reply. This is perfect. Thanks! On Wed, Oct 5, 2011 at 2:01 PM, Dan Gentry wrote: > In the docs there a paragraph or two about this. Basically, one must > decorate the dispatch method instead. See this link for the details. > > > https://docs.djangoproject.com/en/dev/topics/

Re: Help with implementing dynamic views/models

2011-10-11 Thread xenses
I thank you for your help and apologize for my naivete, however I still am not seeing that tag populate in the template. Here is my view function in its entirety: def test(request, testn): try: testn = str(testn) page = Page.objects.filter(name = "test%s" % testn) retu

Re: Need advice on ForeignKey query problem.

2011-10-11 Thread Kevin
What your looking for is here in the documentation: https://docs.djangoproject.com/en/1.3/topics/db/queries/#related-objects records = models.Facility.objects.get(pk=62).schedule_set.all() On Oct 10, 8:19 pm, "Sells, Fred" wrote: > I've got these two tables defined where a Facility can have mult

noob struggling with inlineformset_factory

2011-10-11 Thread trubliphone
Hello, I am new to Python and Django and struggling with the concept of inlineformset_factories. I am trying to have a view that nests one form inside another. Consider these models: class PersonModel(models.Model): name = models.CharField(max_length=255) job = models.ForeignKey(Jo

Add to database

2011-10-11 Thread jose osuna perez
I have reviewed the document https://docs.djangoproject.com/en/dev/topics/db/queries/ but I can not insert the field users, the models.py table, I try as follows, is this what was spinning in the other issue, not the complete code, thanks: for i in request.POST.getlist('usuarios'): usuario=Use

Trivial view sometimes fails in Chrome

2011-10-11 Thread Pigletto
Simple view, shown below, sometimes fail in Chrome browser (request is shown as Pending or doesn't return any content): def exposer(request): return HttpResponse('Response from AJAX exposer') That is called by AJAX, eg: $.post('{% url exposer %}', {'bb':'aa'}, callback); Suprisingly if I ch