nano ~/Library/LaunchAgents/com.user.loginscript.automount.plist
launchctl load ~/Library/LaunchAgents/com.user.loginscript.automount.plist
nano ~/Library/LaunchAgents/com.user.loginscript.automount.plist
launchctl load ~/Library/LaunchAgents/com.user.loginscript.automount.plist
from django.forms import MultipleChoiceField | |
class MultipleChoiceAnyField(MultipleChoiceField): | |
"""A MultipleChoiceField with no validation.""" | |
def valid_value(self, *args, **kwargs): | |
return True |
<ul class="nav navbar-nav"> | |
<li{% if app_name == 'pages' %} class="active"{% endif %}> | |
<a href="{% url "page_list" %}">{% trans "Pages" %}</a> | |
</li> | |
</ul> |
obj = News(is_short=form.cleaned_data['is_short']) | |
obj.save() | |
post_type = form.save(commit=False) | |
post_type.content_object = obj | |
post_type.ip = request.META['REMOTE_ADDR'] | |
post_type.save() | |
version = Version(news=obj, author=request.user, ip=request.META['REMOTE_ADDR'], \ | |
content=form.cleaned_data['content_news'], is_minor=form.cleaned_data['is_minor'], \ |
<?php | |
function truncate_paragraphs($text, $limit) { | |
preg_match_all('/<p>(.*)<\/p>/', $text, $matches); | |
$paragraphs = $matches[0]; | |
if (count($paragraphs) > $limit) { | |
$paragraphs = array_slice($paragraphs, 0, $limit); | |
return implode("\n", $paragraphs); | |
} else { | |
return $text; | |
} |