Archive for June, 2008

-image-Decorating.

So now we have moved in the decorating is in full swing. There has been lots that we have done, but much still to do. K and I have been talking about building a floating wall for the living room, I think that needs some more thought but first off its the easy things like curtains. So last night we went to Marimekko and chose a design by Erja Hirvi called Lumimarja.

lumimarja_620_big.jpg

There are plenty of other really nice fabrics and designs in there, but this will probably go really well with the Sofa, floor and the colour we are thinking of having in the room.


-image-Fat Bastard redesign

Is this the greatest wine bottle design ever? (from thedieline.com).

Fat Bastard redesign: “

Fatbastard_3

A redesign by Turner Duckworth for Fat Bastard wines. I love that they integrated the name and visuals in a witty and sophisticated solution for a wine that is affordable yet has a lot of weight behind it.

(Via TheDieline.com: The Leading Package Design Blog.)


-image-django one form, two models

This post is a work in progress is now working I am glad to say. I have been working on a django site which needs two models updated for one post. It is actually using models very close to that on django-forums and I have created a forms.py file:

class ThreadForm(forms.ModelForm):
    class Meta:
        model = Thread
        exclude = ('forum', 'sticky', 'closed', 'posts', 'views', 'latest_post_time')
     
    def clean_title(self):
        title = self.cleaned_data['title']
        if not alnum_re.search(title):
            raise forms.ValidationError(ugettext("Titles can only contain letters, numbers and underscores"))

        if len(title) < 1:
            raise forms.ValidationError(ugettext("Please enter a title"))
        return title

       
class PostForm(forms.ModelForm):
    class Meta:
        model = Post
        exclude = ('thread', 'author', 'time', 'related_item')
       
    def clean_body(self):
        body = self.cleaned_data['body']
        if len(body) < 1:
            raise forms.ValidationError(ugettext("Please enter some body text"))
        return body

And then in my views (after importing in the correct models):

@login_required
def groupnewthread(request, slug):
    thegroup = get_object_or_404(GroupsOfUser, slug=slug)
    if request.method == 'POST':
        f = request.POST.copy()
        tdata = {
            'title': f['title'],
        }
        pdata = {
            'body': f['body'],
        }
        t = ThreadForm(tdata)
        p = PostForm(pdata)
        if t.is_valid():
            newthread = t.save(commit=False)
            newthread.forum = thegroup
           
           
            if p.is_valid():
                newthread.save()
                newpost = p.save(commit=False)
                newpost.thread = newthread
                newpost.author = request.user
                newpost.save()
         
                strmessage = 'has created a thread <a href="%s">%s</a>' % (newthread.get_absolute_url(), newthread.title)
                usm = UserStatus(user = newpost.author, message = strmessage)
                usm.save()
         
                return HttpResponseRedirect(reverse('groupdetail', args=[thegroup.slug]))
       
    else:

        t = ThreadForm()
        p = PostForm()
       
    objContext = RequestContext(request, {'threadform': t, 'postform': p})
    return render_to_response('groups/group_thread_add.html', objContext)

Now the bit that is in progress is the returning part of dealing with the form data being bound, but I am going to write a custom handler. This is obviously going to be much easier to handle than an update, which I will have to deal with at a point.

The form HTML looks like this btw:

{% extends "base.html" %}
{% load i18n %}
{% block title %}
    {% trans 'Add a new group thread' %}
{% endblock %}
{% block body %}
    <h1>{% trans 'Create a new group thread' %}</h1>
<div class="column span-14">
    {% if t.errors %}
    <h3>{% blocktrans count t.errors|length as count %}Please correct the following error:{% plural %}Please correct the following errors:{% endblocktrans %}</h3>
    {% endif %}
    {% if p.errors %}
    <h3>{% blocktrans count p.errors|length as count %}Please correct the following error:{% plural %}Please correct the following errors:{% endblocktrans %}</h3>
    {% endif %}
    <table>
    <form method="post" action=".">
        {{ threadform.as_table }}
        {{ postform.as_table }}
    <tr><td></td><td><input type="submit" value="{% trans "Update" %}"/></td></tr>
    </form>
    </table>
</div>
{% endblock %}

-image-Another week

Time seems to be flying by as I get even closer to my next birthday, with the minutes rolling into hours, the hours in to days and so forth.

Last night we had a friend over and I cooked a meal, of recipe for which is conveniently on the internet: Roast Pork with Rosemary and Caramelised Apples. I added some peas and some Roast Potatoes for good measure. Was quite good, though probably not the best thing that I have cooked.

Nina after a meal

And of course I was playing with my latest purchase a Nikon SB-600 flash with my camera. I used a unnatural whitebalance setting and a really old lense (which might or might no be a Nikon) from Kristin’s old Nikon film camera and it gave this kinda hazy shot. Well I like it.

The eating out continues, this time with friends on a Friday night at Helenes Krog, St Eriksgatan. The main thing that impressed everyone was the portion size, its apparently “their thing”. Well not quite sure that I agree with the concept but it wasn’t bad.


-image-Värmland



Värmland, originally uploaded by timc3.

Went to Värmland this weekend, and it was beautifully sunny and green so we spent quite a bit of time outside and relaxing..