This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fdgdsfg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file = models.FileField(upload_to=settings.FILES_RESUME + "/%Y/%m/%d", max_length=255) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Class TehModel(models.Models): | |
file = models.FileField(upload_to=self.sort_files_by_extension, max_length=255) | |
def sort_files_by_extension(self, filename): | |
ext = os.path.splitext(filename)[1] | |
ext = ext.lower() | |
return "formats/%s" % ext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
class TheModel(models.Models): | |
file = models.FileField(upload_to=self.sort_files_by_extension, max_length=255) | |
def sort_files_by_extension(self, filename): | |
ext = os.path.splitext(filename)[1] | |
ext = ext.lower() | |
return "formats/%s" % ext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Face(models.Model): | |
photo = models.ImageField(upload_to=settings.MEDIA_ROOT) | |
frequency = models.IntegerField() | |
date_added = models.DateTimeField() | |
def __unicode__(self): | |
return self.photo.name | |
class FaceForm(ModelForm): | |
class Meta: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from face_grabber.models import Face, FaceForm | |
from django.views.generic.edit import CreateView | |
from django.http import HttpResponse | |
import json | |
class FaceUploadAjax(CreateView): | |
template_name = "index.html" | |
form_class = FaceForm | |
model = Face | |
success_url = '/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('input[type="file"]').each(function() { | |
var $file = $(this), $form = $file.closest('.upload-form'); | |
$file.ajaxSubmitInput({ | |
url: '/', //URL where you want to post the form | |
beforeSubmit: function($input) { | |
//manipulate the form before posting | |
}, | |
onComplete: function($input, iframeContent, options) { | |
if (iframeContent) { | |
$input.closest('form')[0].reset(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendRequestToRecipients() { | |
FB.ui({method: 'apprequests', | |
message: 'wants you to check out something AMAZING in', | |
to: '499802820' | |
}, requestCallback); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendRequestToRecipients() { | |
FB.ui({method: 'apprequests', | |
new_style_message: true, | |
message: 'wants you to check out something AMAZING in', | |
to: '499802820' | |
}, requestCallback); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="linkbait"> | |
<h2>Add a badge to your website</h2> | |
<p>Copy and paste HTML code below and paste it into your website editor.</p> | |
<textarea id="html-code" rows="4" cols="60"> </textarea> | |
<p><strong>Preview:</strong></p> | |
<div id="preview"> | |
</div> | |
<p> | |
<input type="button" onclick="build_seo_badge();" value="Get New Badge Code"> |
OlderNewer