This file contains 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 myFunction() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var range = sheet.getDataRange(); | |
var cells = range.getValues(); | |
var latitudes = []; | |
var longitudes = []; | |
for (var i = 0; i < cells.length; i++) { |
This file contains 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 django.http import HttpResponse | |
from .models import FirstModel | |
# this view will make crazy use of the RAM ;) | |
def my_view(request): | |
# this queryset contains about 100k records | |
# each of them has many ForeignKeys to other models | |
huge_queryset = FirstModel.objects.all() | |
This file contains 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 django.http import HttpResponse | |
from .models import FirstModel | |
def my_view(request): | |
# this queryset contains about 100k records | |
# each of them has many ForeignKeys to other models | |
huge_queryset = FirstModel.objects.all().iterator() | |
f = open('dumb.dump', 'w') |
This file contains 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 objgraph | |
import sys | |
import logging | |
from django.http import HttpResponse | |
from .models import FirstModel | |
logger = logging.getLogger(__name__) |
This file contains 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 django import forms | |
from django.contrib.auth.models import User, Group | |
class UserProfileForm(forms.ModelForm): | |
group = forms.ModelChoiceField(queryset=Group.objects.all(), | |
required=True) | |
class Meta: | |
model = User | |
fields = ['first_name', 'last_name', 'email', 'group'] |
NewerOlder