|
If you feel like you can afford it, Djangocon US has extended their CFP to June 25th. I still think the price is ridiculous.
|
# ? Jun 20, 2013 16:25 |
|
|
# ? Jun 3, 2024 21:42 |
|
MonkeyMaker posted:If you feel like you can afford it, Djangocon US has extended their CFP to June 25th. I was recently thinking I should start engaging with the programming community IRL more (at all) and a con seems like a good way to do that, and since I've been doing a lot of Django recently, Djangocon seems like a good way to start. Oh wait, 900 dollars.
|
# ? Jun 20, 2013 17:42 |
|
Thermopyle posted:I was recently thinking I should start engaging with the programming community IRL more (at all) and a con seems like a good way to do that, and since I've been doing a lot of Django recently, Djangocon seems like a good way to start. The community is great. And it's a good conf, but it's not $900 worth of conf. Go to PyCon. You won't be disappointed.
|
# ? Jun 20, 2013 18:57 |
|
Thermopyle posted:I was recently thinking I should start engaging with the programming community IRL more (at all) and a con seems like a good way to do that, and since I've been doing a lot of Django recently, Djangocon seems like a good way to start. Do you have any community projects or whatever your heavily involved with. A lot of these cons you can get sponsored to visit , sometimes even including plane fares if you sit on a panel or whatever. A mate of mines a Debian maintainer and hes been to every debian conference the past decade, and had it paid for every single time. Plus the various LUG and other conferences, all paid for. Heck, just contact them and say you can't afford it and offer to help out, like sit on a door for an afternoon or something. Usually these conferences are loving hard work and they'll take *ANY* help they can get. Conferences are a great excuse to get lots of travel in. I used to conference hop doing environmentalist conferences (I was pretty involved in forest rescue activism in the 90s) and it was really one of the few things that got me genuinely travelling, plus since I'd always meet people in the target city, I'd always have a set of new friends to show me around and let me camp at their house. duck monster fucked around with this message at 00:12 on Jun 21, 2013 |
# ? Jun 21, 2013 00:10 |
|
duck monster posted:Do you have any community projects or whatever your heavily involved with. A lot of these cons you can get sponsored to visit , sometimes even including plane fares if you sit on a panel or whatever. A mate of mines a Debian maintainer and hes been to every debian conference the past decade, and had it paid for every single time. Plus the various LUG and other conferences, all paid for. Yeah...PyCon is that way. DjangoCon US really isn't.
|
# ? Jun 21, 2013 00:21 |
|
MonkeyMaker posted:Yeah...PyCon is that way. DjangoCon US really isn't. Bummer edit: There is a delegate sponsorship program, but it looks like theres only $10K available all up for it which probably is for people doing talks or something. edit2: It might not be so bad: http://www.djangocon.us/faqs/ The cheapest tickets are $760 for individual tickets and it might be possible to wrangle a few hundred in sponsorship to bring it down to a sane price, but I imagine you'd need to be involved pretty heavily in one of the notable community projects or something. They really need to go to Google or something and get them to throw some googlebux at making this poo poo cheaper since Google push django pretty heavily for its app engine thingo. duck monster fucked around with this message at 02:22 on Jun 21, 2013 |
# ? Jun 21, 2013 02:14 |
|
Apparently, I don't get how models work in django. I'm trying to learn django, and to do so I'm making a simple CRUD app that gives me the ability to enter in beers that I've drunk and rated. When I get data from a model, one of the foreign keys I'm using is being returned as a model instead of a string that I can render to HTML. Here are my models: code:
The error is "TypeError at /beerratings/detail/1/ coercing to Unicode: need string or buffer, NoneType found" code:
code:
Second - Is this even the best way to go about writing this kind of thing?
|
# ? Jun 26, 2013 03:51 |
|
What's the contents of your beerdetail.html template?
|
# ? Jun 26, 2013 09:34 |
|
Chron posted:Apparently, I don't get how models work in django. I'm trying to learn django, and to do so I'm making a simple CRUD app that gives me the ability to enter in beers that I've drunk and rated. When I get data from a model, one of the foreign keys I'm using is being returned as a model instead of a string that I can render to HTML. The first way you had it was right. In your template you can access the data using the same .'s that you did in your not so right workaround. {{ beer.brewery.name }} for example will put the beers name in your rendered HTML
|
# ? Jun 26, 2013 14:52 |
|
Chron posted:Second - Is this even the best way to go about writing this kind of thing? Unless there's a compelling reason not to, you should probably be using Class Based Views for this. I *think* (I'm still somewhat of a newbie to Django, so don't trust my code verbatim) you would jsut do this: Python code:
|
# ? Jun 26, 2013 15:36 |
|
Chron posted:Apparently, I don't get how models work in django. I'm trying to learn django, and to do so I'm making a simple CRUD app that gives me the ability to enter in beers that I've drunk and rated. When I get data from a model, one of the foreign keys I'm using is being returned as a model instead of a string that I can render to HTML. I believe the nature of your problem is that the beer you are rendering has a brewery which does not have a name. So, when Django is rendering the template, it's getting the unicode representation of the `Brewery` object, which calls Brewery.__unicode__, which returns self.name, however if self.name is None, then you can get that exception (iirc). As other's have said, your original approach is the correct way (don't turn it into a dict yourself); the problem is in your data.
|
# ? Jun 26, 2013 15:55 |
|
Chron posted:
First off, methods should generally `return` things, not `print` them. That'll let you do `{{ beer.brewery }}` and it'll just print out the brewery's name. As for doing it as a class-based view: code:
code:
|
# ? Jun 26, 2013 18:51 |
|
You all rock. Adding beer.brewery.name didn't, at first, work, because I was printing the string to the command line, but not returning it. Changing the print to a return, as per MonkeyMoney, fixed everything. Thanks.
|
# ? Jun 29, 2013 00:46 |
|
I'm making a little web game in Django and I've hit a small snag, looking for some advice. The problem is that, as I have it currently built up, the /fight url loads up the Fight view and lets you pick a monster to fight. When you submit that form, it sends a post request to /fight and the Fight view recognizes that, does some math, and stores stuff like "You hit a dragon for 1,452 damage!" in some variables and passes them on as context using render_to_response. The /fight template then pulls those out of the context and displays them on that same page. The issue with this method is that refreshing the page resubmits the form, which kinda donks some stuff up. From what I've been able to figure out from google, passing the data around in the user's session and just redirecting to the /fight view after the form posts using httpresponseredirect is an option. Are there other/better options here? Also, are there any potential pitfalls with using sessions for this?
|
# ? Jun 30, 2013 22:56 |
|
From what you've described, it sounds like you need to implement the time-honoured POST/Redirect/GET. Essentially, on a successful form submission, perform a redirect (301/302), back to the same URL in this case. This mitigates the refresh=resubmit issue, but not the potential for double-submits, for which you'll probably want to employ some JavaScript.
|
# ? Jul 1, 2013 07:39 |
|
Yay posted:From what you've described, it sounds like you need to implement the time-honoured POST/Redirect/GET. Essentially, on a successful form submission, perform a redirect (301/302), back to the same URL in this case. This mitigates the refresh=resubmit issue, but not the potential for double-submits, for which you'll probably want to employ some JavaScript. POSTs should almost never render anything. They should, 99.99999% of the time, return a redirect, as Yay said. This is true in most places, not just Django.
|
# ? Jul 1, 2013 17:57 |
|
MonkeyMaker posted:POSTs should almost never render anything. They should, 99.99999% of the time, return a redirect, as Yay said. This is true in most places, not just Django. Right, I'm just now discovering this. So what is the method for this in Django assuming I want to maintain state here? I can post the code handling things once I get home later tonight if that would help, but my understanding is using an HttpResponseRedirect will shoot dudes through after the form submit, but then I will have to resort to storing information in the user session to display the result of the form submit (the log of combat etc.,) right? Or am I missing something here.
|
# ? Jul 1, 2013 18:30 |
|
The March Hare posted:Right, I'm just now discovering this. So what is the method for this in Django assuming I want to maintain state here? I can post the code handling things once I get home later tonight if that would help, but my understanding is using an HttpResponseRedirect will shoot dudes through after the form submit, but then I will have to resort to storing information in the user session to display the result of the form submit (the log of combat etc.,) right? Or am I missing something here. That's right. You'll need to store the log/combat message elsewhere. There are a few ideas, you could use django's messaging framework to have standard messages, or (since your combat messages might not fit that mold), you can have a model that represents activity, and show the user the last message from the activity log on the page.
|
# ? Jul 1, 2013 18:47 |
|
The March Hare posted:Right, I'm just now discovering this. So what is the method for this in Django assuming I want to maintain state here? I can post the code handling things once I get home later tonight if that would help, but my understanding is using an HttpResponseRedirect will shoot dudes through after the form submit, but then I will have to resort to storing information in the user session to display the result of the form submit (the log of combat etc.,) right? Or am I missing something here. Depends on how you want to have the information. If you need a battle log, I'd create a new model instance for who did how much damage to who (<player_instance> hit <enemy_instance> for <hit_points_value>) and then you can just fetch that out of the database for the new page and show it. If you don't need the battle log, Django provides django.contrib.messages which should be fine. It works like flash messages in Rails, where the data only persists for one more page load.
|
# ? Jul 1, 2013 23:11 |
|
I find myself in an odd position, I've been working with Django for a year but still know very little about setting up web servers. I recently got a new job and am the sole developer on an existing website, and am feeling a little apprehensive because there is no-one for me to learn from to fill in the gaps in my knowledge. Is there a definitive (or at least widely accepted) "Start Here" place for getting more familiar with setting up and deploying to web servers? To clarify, the previous developer left before I joined, so I didn't get the opportunity to talk to him about the site's setup. He left notes, though they are not really extensive. I guess I'm looking for a way to familiarise myself with everything as quickly as possible. NtotheTC fucked around with this message at 22:34 on Jul 2, 2013 |
# ? Jul 2, 2013 22:28 |
|
NtotheTC posted:I find myself in an odd position, I've been working with Django for a year but still know very little about setting up web servers. I recently got a new job and am the sole developer on an existing website, and am feeling a little apprehensive because there is no-one for me to learn from to fill in the gaps in my knowledge. Is there a definitive (or at least widely accepted) "Start Here" place for getting more familiar with setting up and deploying to web servers? Get a debian (or red-hat/centos I guess) linux box and learn the gently caress out of the command line via books. Seriously. It'll make you a better IT person in every conceivable way. Like, just set it up as XBMC thing for your TV set to keep it girlfriend justifiable and use it to learn how to set up apache, mysql, postgres, memchache/redis/whateer, and a mail server, samba (for inhouse machines only!) and various business useful web-apps. Know how to deploy java and java apps even if you sanely never intend to. Its handy to know how to work crontab, and its handy to know how to script up poo poo using pythonor perl if your a oval office. duck monster fucked around with this message at 04:03 on Jul 4, 2013 |
# ? Jul 4, 2013 03:57 |
|
NtotheTC posted:I find myself in an odd position, I've been working with Django for a year but still know very little about setting up web servers. I recently got a new job and am the sole developer on an existing website, and am feeling a little apprehensive because there is no-one for me to learn from to fill in the gaps in my knowledge. Is there a definitive (or at least widely accepted) "Start Here" place for getting more familiar with setting up and deploying to web servers? That's kind of a broad question/topic, but if you know the stack being used it will be much easier to learn about and you can practice deploying your own dummy apps with the same stack. Other than that, duck monster is pretty on target in that you'll have to know a lot of generalities about *nix platforms if you want to be effective at troubleshooting, etc.
|
# ? Jul 11, 2013 04:22 |
|
If you wanna familiarise yourself with setups, practice replicating them on a Virtual Environment, using something like vagrantup.com makes it dead simple to set up and tear down, and is an excellent test bed for scripts and config management too so you can get the hang of automating the boring bits (nearly all of it).
|
# ? Jul 11, 2013 06:26 |
|
All you *really* need to know how to set up is: postgresql, nginx, and either uWSGI or gunicorn. Then learn how to harden the server enough for 99% of cases and you're good enough.
|
# ? Jul 11, 2013 18:14 |
|
Deploying a django webapp on Dreamhost. Good idea, or bad idea? I'm confronted with a deployment coming up soon, and I can pussyfoot around it all I want but eventually I need to either poo poo or get off the pot on the free Dreamhosting/paid Heroku decision.
|
# ? Jul 15, 2013 21:08 |
|
Cheekio posted:Deploying a django webapp on Dreamhost. Good idea, or bad idea? Bad idea. Heroku is free for single processes.
|
# ? Jul 15, 2013 23:01 |
|
Cheekio posted:Deploying a django webapp on Dreamhost. Good idea, or bad idea? If it's a toy "just for me I don't care if its slow as poo poo" and you already host there, not a terrible idea. But yeah, if its a site that others will look at, no Dreamhost for Django.
|
# ? Jul 16, 2013 00:03 |
|
MonkeyMaker posted:Bad idea. Heroku is free for single processes. Also, if you need a second process that doesn't run too often, this works on the free tier: In Procfile: code:
code:
|
# ? Jul 16, 2013 22:40 |
|
Has anyone had a chance to look through Test Driven Web Development with Python and have any thoughts on it? I've been meaning to check it out but I just haven't had the time.
|
# ? Jul 22, 2013 17:30 |
|
Kumquat posted:Has anyone had a chance to look through Test Driven Web Development with Python and have any thoughts on it? I've been meaning to check it out but I just haven't had the time. I'm reading throught it right now since you mention it. My only issue with it so far is that it calls Dive into Python excellent.
|
# ? Jul 22, 2013 19:27 |
|
Thermopyle posted:I'm reading throught it right now since you mention it. My only issue with it so far is that it calls Dive into Python excellent. "Dive Into Python" was good for the time. It just fell out of date really quickly.
|
# ? Jul 23, 2013 00:35 |
I'm attempting to add the django-rest-framework SearchFilter with an existing Django project. settings.py: code:
code:
quote:FieldError at /api/employees/
|
|
# ? Aug 13, 2013 00:39 |
Finally got PyCharm setup so I could step through it. It didn't like search_fields being a str...I added a trailing comma to make it a tuple and now it works. Hooray!code:
|
|
# ? Aug 13, 2013 00:49 |
|
Implementing Ajax in Django- are there pitfalls or huge security holes I need to watch out for? The data isn't sensitive going in either direction, but I figure it's always safe to ask.
|
# ? Aug 14, 2013 18:33 |
|
Cheekio posted:Implementing Ajax in Django- are there pitfalls or huge security holes I need to watch out for? The data isn't sensitive going in either direction, but I figure it's always safe to ask. There's nothing specific about Django that would make Ajax more or less safe.
|
# ? Aug 14, 2013 21:10 |
Any of you guys used django-pipeline before? I tried to follow these instructions but I can't seem to get it to work right. Installed the css & js compressor in my virtualenv: code:
code:
code:
code:
code:
code:
code:
|
|
# ? Aug 20, 2013 19:17 |
Bah! Finally figured it out! I needed to have the source_filenames start with myapp/ like this:code:
|
|
# ? Aug 20, 2013 23:22 |
|
Pydanny just tweeted this and I thought I'd share with you guys, it's a pretty great resource for CBVs.
|
# ? Aug 21, 2013 17:03 |
|
deimos posted:Pydanny just tweeted this and I thought I'd share with you guys, it's a pretty great resource for CBVs. Yeah, I've been using this ever since I decided to wrap my mind around CBV's and it makes dealing with them so much easier.
|
# ? Aug 21, 2013 17:27 |
|
|
# ? Jun 3, 2024 21:42 |
|
I'd quite like to do some open-source contributing centered around Django. Is there some sort of list or resource to find a project that is looking for contributors?
|
# ? Aug 21, 2013 22:09 |