All Entries Filtered By Date: 2006-08-01
August 25, 2006
[Daniel] Copying A Model Object In Django
Since I found no resources online about this, I thought I ought to post. My situation is that I have an model object in Django and I would like to create a copy of the object so the user can easily duplicate an existing item. This was my solution:
# In views.py...
def copy_object(request, crazy_object_id):
crazy_object_to_copy = get_object_or_404(Crazyobject, pk=crazy_object_id)
new_object = Crazyobject()
new_object.__dict__ = crazy_object_to_copy.__dict__
new_object.id = None
new_object.save()
return HttpResponseRedirect("/crazyobjects/edit/%s" % (new_object.id))
This loads up the old object, creates a new (blank) object and copies over the underlying dictionary. Once this is complete, the "new_object" exactly duplicates the original. Set the id to "None" so it doesn't overwrite the original then save your new object. Finally, reuse your existing edit code via the Redirect.
It feels a little sloppy to me in practice but I'm not sure if there is a better way and it does work, which is good enough for me for the time being.
Permalink
|
Comments (3)
August 23, 2006
[Daniel] Pregnancy Photos!
We've got a couple more pregnancy photos for everyone. Here's two samples to get you going. The rest are in the Baby section. Enjoy!
32 Weeks
Another Face Pic
August 21, 2006
[Moriah] Wisconsin Vacation
We just got back from a two-week vacation, August 4th-20th, up in da nort'woods, ya. It definitely wasn't as relaxing as our mini vacation to San Antonio the weekend before, but it was very nice to see family and friends that we haven't seen for over a year.Due to the extensive drive (24 hours from Austin to Wausau), the fact that we brought Bear along with us, and the fact that I was 31 weeks pregnant at the outset, we decided to break the trip up a bit by staying overnight with my friend, Sarah, and her husband, Trent, in Urbana, IL. It was great to see them again, as we hadn't seen Trent in over two years and hadn't seen Sarah much over the past two years either. It was also interesting bringing Bear into their apartment because they have four ferrets, an animal Bear had never seen before. He did very well around them.
Once we got to Wisconsin, the first week was spent with Daniel's mom's side of the family in Wausau, along with visiting the Fox Valley twice, visiting La Crosse once and seeing our band teacher from high school and his wife.
During the first visit to the Fox Valley, we took my flute in to be cleaned and tuned, and stopped by The Free Market to visit former co-workers and pick up some much-needed vegan goodies. During the second trip to the Fox Valley later that week, we picked up my flute, restocked on some more food, visited a friend in Neenah, and went out to lunch with my aunt and cousin at Vitale's Restaurant in Oshkosh.
Unfortunately, we had another bad restaurant experience. We used to frequent Vitale's while we lived in Oshkosh, but we will never go back again after what happened this last time. First of all, the waiter was less than hospitable. They used to have awesome customer service, but apparently something happened between the time we lived there and now. We both ordered our usual meal: the Gnocchi Primavera with marinara instead of alfredo sauce and no chicken. However, when our meal came, it was packed with pieces of chicken! Daniel accidentally discovered this after biting into a piece and nearly losing the rest of his lunch. We told the waiter, who took it back to the kitchen. However, not even five minutes later, our plates came back...with about a quarter of the food left on it. All they had done was dump off whatever chicken they could find and reheat it. Daniel's plate still had chicken on it! We were disgusted with their service. It was very nice to visit with my aunt and cousin, but we will never do it at that restaurant again.
Our visit to La Crosse was very nice. We saw Eric, a good friend from high school, and caught up with him for a while as we took a drive up to Grandad's Bluff, which overlooks La Crosse, part of Iowa and part of Minnesota. That was really cool to see. Then we visited with Daniel's brother, Patrick, and Patrick's girlfriend, Stephanie. It was nice to catch up with all of them.
The rest of that week was spent going back and forth between visiting Daniel's mom and his grandparents on her side. We even went to a water aerobics class with his mom, which was a lot of fun, even though it was in an outside pool and the water was really cold.
That weekend, we celebrated Daniel's grandparents' 50th wedding anniversary by going to the Wisconsin Dells and taking an Upper Dells Boat Tour. It was fun to see the area. We had beautiful weather and got lots of nice pictures. There was a baby sitting in front of us on the boat that Daniel and Patrick were entertaining with lots of funny faces and noises. She was quite intrigued by them and made lots of noises and laughed back at them. Seeing the way they interacted made me very excited for when our baby is born. I just know Daniel will be an awesome dad and Patrick will be a great uncle! We also went out to dinner that night to celebrate the anniversary. The next morning, we went to the grandparents' church at their request before having a nice luncheon at 2510 in Wausau.
The second week of our vacation was spent with Daniel's dad and his grandmother on that side, along with a trip to Minocqua to visit my grandparents, and time with a few friends in the Wausau area. We spent one relaxing morning going to Marathon Park in Wausau. The weather that day was just beautiful, and it was so nice to get out and do something quiet on the trip with just the two of us and Bear.
We had a nice dinner with Grandma Lindsley and Daniel's dad Monday evening and then had a big get-together with lots of extended family from the Lindsley side on Wednesday. Our visit to Minocqua was wonderful. We went out to lunch with my grandparents and had a great afternoon with them at their house on the lake. And it was nice to see a good friend of mine from high school that week as well.
The drive back down to Austin was long and tedious, but we broke it up by stopping overnight in Urbana again. This time we went out to dinner with Sarah and Trent at an awesome natural health food store called Strawberry Fields. We had a fantastic dinner there and then picked up a few things for the way back home.
It was a long, busy vacation. We didn't get much sleep and we were constantly running around to visit people. It was nice to catch up and see family and friends. Next time, though, I think we're going to stay put in Wausau and if friends want to visit, they can come to us... :)
[Moriah] San Antonio Vacation
We took a fun little vacation a few weekends ago as Daniel's combination birthday/anniversary gift to me. We went down to San Antonio to see the Alamo and visit the Riverwalk from July 28th to the 30th. We stayed at a cute Hill Country Inn & Suites just a few minutes from downtown. We got a poolside room that even had a little private patio in front.After driving down Friday evening and spending a relaxing night at the hotel, we got up early Saturday morning, my birthday, to head downtown. We went right to the Alamo and spent quite a while there. It was very interesting to see, even though I'm not much of a history buff.
Next, we spent a while cooling off and looking around in the Guinness Book of World Records Museum right across the street from the Alamo. I must say, while it was kind of neat to see some of the records, the cover charge to get in was way too expensive to justify ever going again.
After looking around the museum, we decided to beat the heat (over 104°F that day) by taking a Riverboat Cruise around the Riverwalk. That was one of the most worthwhile activities we did all day. Our tour guide on the boat was hilarious. He was a local college student with a great sarcastic sense of humor and excellent people skills. He told us about the history of the Riverwalk as we cruised through the 3-foot-deep water on the boat, and he easily cracked many jokes to make us laugh.
After the Riverboat Cruise, we spent a short time in the Rivercenter Mall but didn't see anything we wanted to do there. So we ended up taking a long walk down Commerce Street to the Mexican Market Square. That was another fun experience. Even though we were dying of heat, we strolled around the market looking at some of the booths. There were tons of things to see! Arts, crafts, knick-knacks, food, music and more. It would be a neat place in which to spend lots of time during a cooler season.
After the long trek back to the car, we drove to the hotel and decided to cool off with a dip in the pool. We had a lot of fun taking an easy swim and simply enjoying the afternoon.
Sunday, we slept in a little and checked out of the hotel. We decided to go back downtown once more to find a restaurant on the Riverwalk for lunch. We had read online that Mad Dogs British Pub offered vegan-friendly items on their menu, so we were psyched to go there. We took a leisurely stroll down Houston Street this time, catching some interesting pictures along the way, until we reached Mad Dogs. However, we were quite disappointed with their options once we sat down. We ended up having a vegan burger on a bun (who knows if the bun really was vegan or not, even though I asked). And, since the fries that usually come with the burger were not vegan, we specially-ordered sauteed mushrooms in olive oil since they usually make them with butter. Needless to say, we weren't very happy. It's surprising and frustrating how non-vegan-friendly restaurants really are.
Overall, we had a really good time. It was so nice to get away together, for even a short weekend, without the responsibility of Bear or anyone else but the two of us. We would definitely like to go back to the Riverwalk, but next time we'll go when the weather is cooler. You can check out our pictures of the trip in our photo gallery under the San Antonio 2006 album.
August 1, 2006
[Daniel] Chickadee Catastrophe
The first thing Moriah said to me after we greeted each other this evening is that we had a bit of a predicament. A small bird had flown into our dryer's exhaust vent on the apartment and gotten stuck in the flexible hose leading to our dryer, within the apartment. We quickly ate supper and I decided I was determined to get the bird out instead of relying on our apartment complex's rather brutal maintenance.First, I pulled the dryer out slightly and disconnected the hose. I heard a flapping and chriping so I covered the end of the hose to keep the bird in it. I then worked the dryer slowly out of the closet it and the washer are in. We grabbed a paper bag and put it on the end of the hose. I then rattled the hose, trying to knock the bird into the bag. I went through the entire hose, from wall to end, and in the bag...
...was nothing. I blinked at it, rattled the hose again and looked at Moriah. "Perhaps it got back out the way it came?" was the first thought that came to mind. But just to be sure, I asked Moriah to grab a flashlight and looked into the dryer itself.
Two little black beady eyes greeted me as the little brown (female?) chickadee blinked back at the bright light. I was surprised, to say the least, especially given that I hadn't covered the dryer vent as I was messing with the hose. I turned the bag toward the dryer and for several minutes, Moriah and I tried banging on the side of the dryer, hoping it would scare the chickadee out into the bag so we could let it back outside. But when I checked the bag again, again there was nothing in the bag. And upon looking back in the dryer vent, the chickadee had gotten frightened and lodged itself much further down the vent, around a 90* angle so only the ends of its tail feathers were visible.
The short version of the rest of this is that the chickadee had lodged itself so deep that it was practically in the exhaust fan at the front of the dryer. We disassembled the dryer in about 30 minutes, taped off the dryer vent the chickadee had come in through, tipped, pounded, shuffled and carried the dryer outside onto the patio. I was about to remove the cover on the fan but decided to tip the dryer one more time. With Moriah peering in, me holding up and tipping the dryer and apparently the smell/sound of fresh air motivating it, the chickadee fell out of the dryer vent it had come in through onto the patio and quickly flew away.
I then carried the dryer back in, spent 15 minutes cleaning the bird poop out of the vent, an hour reassembling it (no leftover screws!) and another 30 minutes cleaning up the remaining mess.
Executive summary: 1 chickadee lodged in our dryer, 1 confused corgi, 2 young adults struggling against a resistant Maytag, 3 hours spent extracting the bird and 0 grumpy, nasty maintenance persons involved. Oh, and 6 pictures to prove I can disassemble and reassemble a dryer.

