<commit_before>from .utils import slugify
from datetime import datetime
from django.contrib.auth.models import User
from django.db import models
from django.db.models import permalink
from minicms.models import BaseContent
import re

FEEDBURNER_ID = re.compile(r'^http://feeds.feedburner.com/([^/]+)/?$')

class Blog(models.Model):
    base_url = models.CharField('Base URL', primary_key=True, max_length=200,
        help_text='Example: With base URL "personal" your blog posts would '
                  'be below /blog/personal/...<br />'
                  'Slashes ("/") are not allowed in this field.<br />'
                  "<strong>You can't change this value afterwards.</strong>")
    title = models.CharField(max_length=200,
        help_text='This will also be your feed title')
    description = models.CharField(max_length=500, blank=True,
        help_text='This will also be your feed description')
    feed_redirect_url = models.URLField('Feed redirect URL',
        verify_exists=False, blank=True,
        help_text='Optional (use this to publish feeds via FeedBurner)<br />'
                  'Example: http://feeds.feedburner.com/YourFeedBurnerID<br />'
                  'If you use FeedBurner this will also enable FeedFlares.')

    def __unicode__(self):
        return self.title

    def feedburner_id(self):
        # Detect FeedBurner ID from feed redirect URL
        match = FEEDBURNER_ID.match(self.feed_redirect_url)
        if match:
            return match.group(1)
        return None

    @permalink
    def get_feed_url(self):
        return ('blog.views.latest_entries_feed', (),
                {'blog_url': self.base_url})

def default_blog():
    try:
        return Blog.objects.get()
    except Blog.DoesNotExist:
        return None

class Post(BaseContent):<commit_msg>fixed default blog when you have multiple blogs<commit_after>from .utils import slugify
from datetime import datetime
from django.contrib.auth.models import User
from django.db import models
from django.db.models import permalink
from minicms.models import BaseContent
import re

FEEDBURNER_ID = re.compile(r'^http://feeds.feedburner.com/([^/]+)/?$')

class Blog(models.Model):
    base_url = models.CharField('Base URL', primary_key=True, max_length=200,
        help_text='Example: With base URL "personal" your blog posts would '
                  'be below /blog/personal/...<br />'
                  'Slashes ("/") are not allowed in this field.<br />'
                  "<strong>You can't change this value afterwards.</strong>")
    title = models.CharField(max_length=200,
        help_text='This will also be your feed title')
    description = models.CharField(max_length=500, blank=True,
        help_text='This will also be your feed description')
    feed_redirect_url = models.URLField('Feed redirect URL',
        verify_exists=False, blank=True,
        help_text='Optional (use this to publish feeds via FeedBurner)<br />'
                  'Example: http://feeds.feedburner.com/YourFeedBurnerID<br />'
                  'If you use FeedBurner this will also enable FeedFlares.')

    def __unicode__(self):
        return self.title

    def feedburner_id(self):
        # Detect FeedBurner ID from feed redirect URL
        match = FEEDBURNER_ID.match(self.feed_redirect_url)
        if match:
            return match.group(1)
        return None

    @permalink
    def get_feed_url(self):
        return ('blog.views.latest_entries_feed', (),
                {'blog_url': self.base_url})

def default_blog():
    blogs = Blog.objects.all()[:1]
    if blogs:
        return blogs[0]
    return None

class Post(BaseContent):
{'fraction_non_alphanumeric': 0.10491803278688525, 'fraction_numerical': 0.006010928961748634, 'mean_word_length': 2.825496342737722, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4892080', 'n_tokens_mistral': 1106, 'n_tokens_neox': 1043, 'n_words': 293}