|
Maluco Marinero posted:Looking forward to straightforward positional and keyword arguments in template tags. Will make it much more appetising to use. M-V-C dude. Know it + live it. All the "rails" type frameworks, Rails, Django, Cake, etc use it. poo poo, the only one that I know of that doesnt is seaside, but thats because its a crazy smalltalk framework for total berks
|
# ? Jan 23, 2012 05:49 |
|
|
# ? May 16, 2024 23:58 |
|
You can also look at http://www.pylonsproject.org/, which looks quite neat.
|
# ? Jan 23, 2012 15:31 |
|
I've been using Django for a project I'm working on for the last few months, and I've gotta admit, using any other language/framework is just painful now (well, other than something similar like Ruby). I can't loving stand PHP now.
|
# ? Jan 24, 2012 02:51 |
|
Fangs404 posted:I've been using Django for a project I'm working on for the last few months, and I've gotta admit, using any other language/framework is just painful now (well, other than something similar like Ruby). I can't loving stand PHP now. Wait till you get to the edge cases where you want it to do something slightly unusual! Django's awesome, but sometimes I feel like its a giant spiders nest just luuuuuring you in before you get raped by Ungoliant.
|
# ? Jan 24, 2012 05:52 |
|
That's where I feel I'm at now. Django was absolutely excellent for finding my feet in Python and building my initial proof of concept, but having read around about people's experiences with it as they've grown their applications, you start to hit roadblocks where grappling with the hidden magic in Django starts to become more and more time consuming. I'm having a bit of a play around with sqlalchemy and flask at the moment. Some elements of it are really cool, but there's no way I would've understood what I was doing before my time with Django.
|
# ? Jan 24, 2012 06:08 |
|
Maluco Marinero posted:That's where I feel I'm at now. Django was absolutely excellent for finding my feet in Python and building my initial proof of concept, but having read around about people's experiences with it as they've grown their applications, you start to hit roadblocks where grappling with the hidden magic in Django starts to become more and more time consuming. I dont want to disuede anyone. The database layer is awesome and it CAN be used very flexibly if your smart. We built a controller system for a VOIP provider right down to real time interrogation of call logs and everything. But there are some edges where sometimes its better to just treat it like PHP w/t Smarty and roll it all top to bottom and try and ignore the magic.
|
# ? Jan 24, 2012 13:04 |
|
I just went from Userena to django-registration, because I get the impression that the userena guys don't want to maintain the code, but holy crap, is django-registration really as bare-bones as my impression is, or do I just need to dig into the documentation to expand it? It doesn't even have a "Remember Me" box when logging in - since it's using the admin log-in screen, obviously. It, too, doesn't seem to understand Gmail's + filters, which means that you can make an infinite amount of accounts when signing up with the same e-mail address, as long as you use a different filter every time. I hope his BitBucket takes pull requests ... ufarn fucked around with this message at 14:51 on Jan 24, 2012 |
# ? Jan 24, 2012 14:47 |
|
ufarn posted:I just went from Userena to django-registration, because I get the impression that the userena guys don't want to maintain the code, but holy crap, is django-registration really as bare-bones as my impression is, or do I just need to dig into the documentation to expand it? Depending on your application this isn't necessarily a bad thing. It sure as hell made my testing process easier.
|
# ? Jan 24, 2012 16:00 |
|
ufarn posted:It, too, doesn't seem to understand Gmail's + filters, which means that you can make an infinite amount of accounts when signing up with the same e-mail address, as long as you use a different filter every time. Just to nitpick; using + for subaddressing predates gmail and it's been an RFC proposal since around '03.
|
# ? Jan 24, 2012 16:45 |
|
ufarn posted:It, too, doesn't seem to understand Gmail's + filters, which means that you can make an infinite amount of accounts when signing up with the same e-mail address, as long as you use a different filter every time. Why do you care about this? If someone really wants to make throwaway accounts they'll do it using mailinator or something else.
|
# ? Jan 24, 2012 16:53 |
|
yaoi prophet posted:Why do you care about this? If someone really wants to make throwaway accounts they'll do it using mailinator or something else.
|
# ? Jan 24, 2012 17:02 |
|
ufarn posted:I just went from Userena to django-registration, because I get the impression that the userena guys don't want to maintain the code, but holy crap, is django-registration really as bare-bones as my impression is, or do I just need to dig into the documentation to expand it? It's pretty easy to create your own backend in registration to do stuff like 'Remember Me'. I seem to recall that's he's being pretty nazi about accepting pull requests though, so good luck with that. I'm currently doing a project that uses django-registration and django-registration-defaults which takes care of the templates.
|
# ? Jan 24, 2012 19:42 |
|
Mulozon Empuri posted:It's pretty easy to create your own backend in registration to do stuff like 'Remember Me'. I seem to recall that's he's being pretty nazi about accepting pull requests though, so good luck with that. I think a lot of this is just feature creep on my side, especially since I am fairly new to programming and Django and just can't wait to fledge out all my project ideas. On another note, does anyone have any idea why my deployed app would switch to my front page, whenever I don't include a trailing slash in the URLs? It works perfectly fine locally.
|
# ? Jan 24, 2012 20:19 |
|
Fwiw Pinax is pretty great to use w/ Django. I prefer it over userna/django-registration.
|
# ? Jan 27, 2012 12:06 |
|
If you do stick with django-registration, like I am doing right now, someone just released django-twostepauth, which, despite its abysmal name, is a great app that has some tremendous documentation and even comes with an example app. I found this just as I was looking for a way to implement two-factor authentication, and I am this close to implementing it properly. Having to write "twostepauth" in my code drives me mental, though.
|
# ? Jan 27, 2012 13:58 |
|
Heh yeah, I think it's worth naming things you're gonna use alot with a little personality, that's easy to read in full pages of code. That's why all of my reusable little applications are japanese occupations, cause there's no mistaking what and where they are in me code. Meanwhile, had a good bit of fun with Flask and SQLAlchemy, but I think I'm just a bit too dumb to really build a full size application out of them at present, I don't understand enough about how contexts pass around and some other bits and pieces even though I love the power and speed of it. I'm gonna do a small side project with that when I have some time and just focus on getting the best out of django I can with my current work.</e/n>
|
# ? Jan 27, 2012 14:51 |
|
ufarn posted:If you do stick with django-registration, like I am doing right now, someone just released django-twostepauth, which, despite its abysmal name, is a great app that has some tremendous documentation and even comes with an example app. I found this just as I was looking for a way to implement two-factor authentication, and I am this close to implementing it properly. I dunno. Seems pretty descriptive to me. At leasts not called something like "django-flungo" or some brain-damaged rails drone type thing.
|
# ? Jan 27, 2012 14:54 |
|
duck monster posted:I dunno. Seems pretty descriptive to me. At leasts not called something like "django-flungo" or some brain-damaged rails drone type thing.
|
# ? Jan 27, 2012 14:56 |
|
More reasons it would be neat if python had macros!
|
# ? Jan 27, 2012 14:59 |
|
Speaking of which, it's been ages since I got a very basic Django error, and in trying to implement django-twostepauth, I get a 404 - Page not found, and eff me if I can remember what that even means. This is not an urlconf error, as it would tell me tell me so explicitly, nor is it a view nor template error, but what is it then? I simply get a 404 page with nothing else - just a blank debug 404 page with no traceback nor anything else. What does this error message even mean? It's a @login_required() view, because I have to log in before using the view, but after that, I just get the infamous 404.
|
# ? Jan 27, 2012 15:25 |
|
That's weird. If it's demanding a login at the exact same url, then it must be a 404 raised somewhere inside that view. If it's not that then the problem would be in whatever middleware gets in before the request yeah?
|
# ? Jan 27, 2012 15:28 |
|
I just had a look at the source, and it looks like it raises its own 404 : https://bitbucket.org/cogni/django-twostepauth/src/79bbf0ce3af0/twostepauth/views.py#cl-39. I am on my phone right now, and will check it out when I get home. EDIT: I found out what code caused the error, but I don't know how to fix it. This is what my models.py looks like: (...) EDIT2: I managed to find out what was missing by comparing files with the example project, and it turned out that the documentation left out some key pieces of information necessary to create the relevant profile object. To those interested in using the app, the author had placed the post_save signals in its own signals.py and initiated it in __init__.py instead of putting the code in models.py, as the Django documentation recommends. Really weird. ufarn fucked around with this message at 14:13 on Jan 28, 2012 |
# ? Jan 27, 2012 17:23 |
|
I've got a model that has a FileField, and I'm wondering how I can access the upload_to value for that field. I'm overriding the save_model function in the admin model to perform some extra operations, and I need to access the directory where the file is going to be saved. I'd rather not hard code it for 2 reasons: (1) in case it changes in the future in the model and (2) because the upload_to value contains %Y.
|
# ? Feb 2, 2012 20:28 |
|
Fangs404 posted:I've got a model that has a FileField, and I'm wondering how I can access the upload_to value for that field. I'm overriding the save_model function in the admin model to perform some extra operations, and I need to access the directory where the file is going to be saved. I'd rather not hard code it for 2 reasons: (1) in case it changes in the future in the model and (2) because the upload_to value contains %Y. Say your field is "avatar" in a "Profile" class: code:
I use it to get my max_length values in my view for error messages.
|
# ? Feb 2, 2012 20:36 |
|
Is there a way to override Django's default widgets? I want all textareas in my site to be three rows high. I know I can use field.widget.attrs.update to modify form widgets, but it would be better if I could do just set this once. If not, does anyone know why, when I create an inlineformset_factory and pass a Form class, it ignores the formfield_callback? for example: model: code:
code:
|
# ? Feb 3, 2012 18:20 |
|
Managed to get some work done this past weekend and got Django-nonrel, MongoDB and fanout support working. Works really well, especially for local testing or smaller deployments.
|
# ? Feb 7, 2012 03:21 |
|
So I think I'm missing something logically about how custom template tags work. I have the following, random_quote.py, inside my templatetags folder. code:
pre:{{ quote }} My problem is that it's always blank no matter what I do. My base.html is able to render any random crap that I put in testimonial.html so the template is loading fine, and running the query in the shell gives me the expected info from the database, but it won't display any quotes when I call the template tag. vvv Herp derp, that fixed it. Thanks. DICTATOR OF FUNK fucked around with this message at 07:47 on Feb 7, 2012 |
# ? Feb 7, 2012 05:00 |
|
Haven't done much with inclusion tags, but if that's your code you're not actually returning a dictionary that can be used as a context. End with:pre:return { 'quote': quote } Maluco Marinero fucked around with this message at 05:23 on Feb 7, 2012 |
# ? Feb 7, 2012 05:17 |
|
So, I'm using django-cms to roll my own website. (Which is a bit of work, but I'm porting the site from Plone, and I had some embedded apps and assorted content types which means I need and want something more than Wordpress. And djnago-cms seemed a good steppingoff point.) I'm new to django-cms but not djago itself although I've been out of the loop for about a year. Anyways, there's a few things I'd like to do, but I'm not sure about the _best_ way to do them. (Note: posted this to the django-cms mailing list and the only reply was for me to read the template documentation. ) I'd like certain sets of pages to share the same structure. For example, each page has a title, description/abstract, main body, attachments, references and pointers to elsewhere in the site. This _seems_ to me to be something that should be done through using a common template with placeholders for the different parts, e.g. code:
code:
code:
Second is a more general question: am I using placeholders and templates in the right way? Is this the neatest solution to produce structured content?
|
# ? Feb 10, 2012 12:43 |
|
The simplest solution I can think of (as someone who spends significant time working with django CMS) to do what you're asking - display a placeholder with a heading if there's content, nothing if none - is by using the plugin context processors, but there's diminishing returns to the method, because you'll have to do it for each plugin: Your plugin template: code:
I have no idea what the FileBrowseInput bits signify, as I've literally never seen that syntax. (Addendum: in my opinon, you're better off asking questions on IRC, if you have the patience to maybe idle.) (Additional addendum: If you can stand the efficacy of it, the better solution would be to have one placeholder, and create a plugin for setting headings. This nets you a bunch of query optimisations, because you're not doing a lookup per placeholder, a lookup to get a list of plugins, and then (I think) N queries to sidecast to the actual concrete plugin instance) Yay fucked around with this message at 21:07 on Feb 10, 2012 |
# ? Feb 10, 2012 20:47 |
|
Hi, I'm dumb. I just installed Django for the first time and I'm trying to learn Python. I installed Django, successfully edited my "settings.py" file (added sqlLite3, uncommented the admin app), uncommented the admin area in the urls.py file, and everything was working fine when I synced my db file and went to 127.0.0.1:8000. However, now, when I go back to that same URL, it doesn't load. When I try to restart the server (python manage.py runserver), I get this: pre:Validating models... 0 errors found Django version 1.3.1, using settings 'site_auth.settings' Development server is running at http://127.0.0.1:8000/ Quit the server with CONTROL-C. Error: [Errno 48] Address already in use
|
# ? Feb 16, 2012 23:00 |
|
Sounds like you already have the server running in another console window...
|
# ? Feb 16, 2012 23:06 |
|
M.C. McMic posted:Hi, I'm dumb. I just installed Django for the first time and I'm trying to learn Python. Are you sure you aren't running the server in another tab? Because I do that at least once a day. If not check netstat or your OSes variant to see if there's a hung process that's claimed that port.
|
# ? Feb 16, 2012 23:09 |
|
Kim Jong III posted:Are you sure you aren't running the server in another tab? Because I do that at least once a day. Yep, I'm dumb. Now I need to get admin working. Apparently I configured that incorrectly.
|
# ? Feb 16, 2012 23:25 |
|
I get a weird database error, but only when I run a postgreSQL database, be it locally or on my DotCloud server. Everything works fine when I run it locally on MySQL. The error happens on a fresh installation, when no thread objects have been submitted. After that, I believe it works fine. This is a project that has worked perfectly fine until recently when this happened. The error happens in the following view: http://dpaste.com/705363/ And this is the error: http://dpaste.com/705361/ I can't really surmise what the problem is when I try to read the error.
|
# ? Feb 19, 2012 22:49 |
|
ufarn posted:I get a weird database error, but only when I run a postgreSQL database, be it locally or on my DotCloud server. Everything works fine when I run it locally on MySQL. Can you paste your Thread model as well?
|
# ? Feb 20, 2012 16:34 |
|
ufarn posted:Sounds like you need get_field. Sorry for not responding sooner, but that worked! Thanks a lot. Now, to figure out how to get it to change %Y into the year.... [edit] That was easy. date.today().strftime(Publication._meta.get_field('paper').upload_to) did the trick! The upload_to field for the FileField in the model Publication is defined as upload_to='publications/papers/%Y/', and using strftime() as shown correctly replaces %Y with today's year. Fangs404 fucked around with this message at 18:01 on Feb 20, 2012 |
# ? Feb 20, 2012 17:35 |
|
avidal posted:Can you paste your Thread model as well?
|
# ? Feb 20, 2012 17:46 |
|
ufarn posted:DB Error. Have you ran syncdb and any relevant migrations? What happens if you run that SQL by hand? You can use django debug toolbar to dump the SQL, if the default traceback doesn't give it all to you, the other option is to turn on query logging on your DB server.
|
# ? Feb 21, 2012 01:21 |
|
|
# ? May 16, 2024 23:58 |
|
Hey y'all, what do your fabric scripts for deploying look like? This is mine, and it seems awfully simple, is there something that I'm missing or is this OK as far as deployment goes? We still don't have tests so there's no testing, but I'll add those as well.code:
|
# ? Feb 21, 2012 02:16 |