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
""" | |
An example form using AddAnotherWidgetWrapper. | |
""" | |
from django import forms | |
from .models import Owner | |
from .widgets import AddAnotherWidgetWrapper | |
class PickOwnerForm(forms.Form): |
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
L.extend(L.LatLngBounds.prototype, { | |
toGeoJson: function() { | |
return { | |
'type': 'Polygon', | |
'coordinates': [[ | |
[this.getSouthWest().lng, this.getSouthWest().lat], | |
[this.getNorthWest().lng, this.getNorthWest().lat], | |
[this.getNorthEast().lng, this.getNorthEast().lat], | |
[this.getSouthEast().lng, this.getSouthEast().lat], |
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.utils.importlib import import_module | |
from reversion import default_revision_manager | |
class InitialRevisionManagerMixin(object): | |
def _save_initial_revision(self, obj): | |
# try to load admin | |
try: |
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.db import connection, DEFAULT_DB_ALIAS | |
num_clusters = 6 | |
queryset = model.objects.filter() # Your filters here | |
queryset = queryset.filter(centroid__isnull=False).only('centroid') | |
# Get the query for | |
sql_model_query, params = queryset.query.get_compiler(DEFAULT_DB_ALIAS).as_sql() |
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
UPDATE graffiti_locations | |
SET the_geom = ST_Transform( | |
ST_SetSRID( | |
ST_MakePoint(x * 0.3048006096012192, y * 0.3048006096012192), | |
32118), | |
4326 | |
) |
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
@occurrences0inner: #5EF2F4; | |
@occurrences0outer: #272BB3; | |
@occurrences1inner: #FAFEFE; | |
@occurrences1outer: #07A40B; | |
@occurrences2inner: #FFE721; | |
@occurrences2outer: #95521E; | |
@occurrences3inner: #EFFC40; |
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
UPDATE sign_application_filings s1 | |
SET text_occurrences = ( | |
SELECT COUNT(DISTINCT(s2.house, s2.street_name)) | |
FROM sign_application_filings s2 | |
WHERE s2.text_on_sign = s1.text_on_sign | |
) | |
WHERE text_on_sign != '' |
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
SELECT | |
house, | |
street_name, | |
MIN(cartodb_id) AS cartodb_id, | |
MIN(the_geom) AS the_geom, | |
MIN(the_geom_webmercator) AS the_geom_webmercator, | |
MIN(text_on_sign) AS text_on_sign, | |
MIN(text_occurrences) AS text_occurrences, | |
MIN(rotation) AS rotation | |
FROM sign_application_filings |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
<!doctype html> | |
<html> | |
<body> | |
<iframe width='100%' height='500px' frameBorder='0' src='https://a.tiles.mapbox.com/v3/ebrelsford.gghlfpek/mm/zoompan,zoomwheel.html?secure=1#12/30.0273/-90.0156'></iframe> | |
</body> | |
</html> |
OlderNewer