Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/digi604/django-cms-2.0
Browse files Browse the repository at this point in the history
Conflicts:
	cms/models/pagemodel.py
  • Loading branch information
acdha committed Sep 24, 2009
2 parents 7f9c439 + d4e6652 commit 279c990
Show file tree
Hide file tree
Showing 14 changed files with 229 additions and 18 deletions.
Binary file modified cms/media/cms/swf/player.swf
Binary file not shown.
Binary file added cms/media/cms/swf/player.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion cms/models/pagemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def get_languages(self):
from cms.models.titlemodels import Title

if not hasattr(self, "languages_cache"):
self.languages_cache = list(Title.objects.filter(page=self).values_list("language").distinct())
self.languages_cache = Title.objects.filter(page=self).values_list("language", flat=True).distinct()

return self.languages_cache

Expand Down
1 change: 0 additions & 1 deletion cms/plugins/file/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from django.utils.translation import ugettext_lazy as _
from cms.models import CMSPlugin
from posixpath import join, basename, splitext, exists
from django.db.models import Q
from cms import settings as cms_settings
from django.conf import settings

Expand Down
129 changes: 129 additions & 0 deletions cms/plugins/googlemap/migrations/0007_latlng.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@

from south.db import db
from django.db import models
from cms.plugins.googlemap.models import *

class Migration:

def forwards(self, orm):

# Adding field 'GoogleMap.lng'
db.add_column('cmsplugin_googlemap', 'lng', orm['googlemap.googlemap:lng'])

# Adding field 'GoogleMap.lat'
db.add_column('cmsplugin_googlemap', 'lat', orm['googlemap.googlemap:lat'])



def backwards(self, orm):

# Deleting field 'GoogleMap.lng'
db.delete_column('cmsplugin_googlemap', 'lng')

# Deleting field 'GoogleMap.lat'
db.delete_column('cmsplugin_googlemap', 'lat')


models = {
'cms.cmsplugin': {
'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '5', 'db_index': 'True'}),
'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
'page': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Page']"}),
'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.CMSPlugin']", 'null': 'True', 'blank': 'True'}),
'placeholder': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}),
'plugin_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}),
'position': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
'publisher_is_draft': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True', 'blank': 'True'}),
'publisher_public': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'publisher_draft'", 'unique': 'True', 'null': 'True', 'to': "orm['cms.CMSPlugin']"}),
'publisher_state': ('django.db.models.fields.SmallIntegerField', [], {'default': '0', 'db_index': 'True'}),
'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})
},
'cms.cmspluginpublic': {
'creation_date': ('models.DateTimeField', [], {'default': 'datetime.datetime(2009, 7, 14, 7, 37, 26, 118649)'}),
'id': ('models.AutoField', [], {'primary_key': 'True'}),
'language': ('models.CharField', [], {'max_length': '5', 'db_index': 'True'}),
'level': ('models.PositiveIntegerField', [], {'db_index': 'True'}),
'lft': ('models.PositiveIntegerField', [], {'db_index': 'True'}),
'mark_delete': ('models.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'page': ('models.ForeignKey', [], {'to': "orm['cms.PagePublic']"}),
'parent': ('models.ForeignKey', [], {'to': "orm['cms.CMSPluginPublic']", 'null': 'True', 'blank': 'True'}),
'placeholder': ('models.CharField', [], {'max_length': '50', 'db_index': 'True'}),
'plugin_type': ('models.CharField', [], {'max_length': '50', 'db_index': 'True'}),
'position': ('models.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
'rght': ('models.PositiveIntegerField', [], {'db_index': 'True'}),
'tree_id': ('models.PositiveIntegerField', [], {'db_index': 'True'})
},
'cms.page': {
'changed_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}),
'created_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'in_navigation': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True', 'blank': 'True'}),
'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
'login_required': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'menu_login_required': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'moderator_state': ('django.db.models.fields.SmallIntegerField', [], {'default': '1', 'blank': 'True'}),
'navigation_extenders': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '80', 'null': 'True', 'blank': 'True'}),
'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'children'", 'blank': 'True', 'null': 'True', 'to': "orm['cms.Page']"}),
'publication_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'publication_end_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'published': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'publisher_is_draft': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True', 'blank': 'True'}),
'publisher_public': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'publisher_draft'", 'unique': 'True', 'null': 'True', 'to': "orm['cms.Page']"}),
'publisher_state': ('django.db.models.fields.SmallIntegerField', [], {'default': '0', 'db_index': 'True'}),
'reverse_id': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '40', 'null': 'True', 'blank': 'True'}),
'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
'soft_root': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
'template': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})
},
'cms.pagepublic': {
'changed_by': ('models.CharField', [], {'max_length': '70'}),
'created_by': ('models.CharField', [], {'max_length': '70'}),
'creation_date': ('models.DateTimeField', [], {'default': 'datetime.datetime(2009, 7, 14, 7, 37, 26, 379713)'}),
'id': ('models.AutoField', [], {'primary_key': 'True'}),
'in_navigation': ('models.BooleanField', [], {'default': 'True', 'db_index': 'True', 'blank': 'True'}),
'level': ('models.PositiveIntegerField', [], {'db_index': 'True'}),
'lft': ('models.PositiveIntegerField', [], {'db_index': 'True'}),
'login_required': ('models.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'mark_delete': ('models.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'moderator_state': ('models.SmallIntegerField', [], {'default': '1', 'blank': 'True'}),
'navigation_extenders': ('models.CharField', [], {'db_index': 'True', 'max_length': '80', 'null': 'True', 'blank': 'True'}),
'parent': ('models.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['cms.PagePublic']"}),
'publication_date': ('models.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'publication_end_date': ('models.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'published': ('models.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'reverse_id': ('models.CharField', [], {'db_index': 'True', 'max_length': '40', 'null': 'True', 'blank': 'True'}),
'rght': ('models.PositiveIntegerField', [], {'db_index': 'True'}),
'site': ('models.ForeignKey', [], {'to': "orm['sites.Site']"}),
'soft_root': ('models.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
'template': ('models.CharField', [], {'max_length': '100'}),
'tree_id': ('models.PositiveIntegerField', [], {'db_index': 'True'})
},
'googlemap.googlemap': {
'Meta': {'db_table': "'cmsplugin_googlemap'"},
'address': ('django.db.models.fields.CharField', [], {'max_length': '150'}),
'city': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
'content': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'lat': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '6', 'blank': 'True'}),
'lng': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '6', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'zipcode': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
'zoom': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
},
'sites.site': {
'Meta': {'db_table': "'django_site'"},
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
}
}

complete_apps = ['googlemap']
7 changes: 7 additions & 0 deletions cms/plugins/googlemap/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ class GoogleMap(CMSPlugin):
content = models.CharField(_("additional content"), max_length=255, blank=True, null=True)
zoom = models.IntegerField(_("zoom level"), blank=True, null=True)

lat = models.DecimalField(_('latitude'), max_digits=10, decimal_places=6, null=True, blank=True,
help_text=_('Use latitude & longitude to fine tune the map possiton.'))
lng = models.DecimalField(_('longitude'), max_digits=10, decimal_places=6, null=True, blank=True)

def __unicode__(self):
return u"%s (%s, %s %s)" % (self.get_title(), self.address, self.zipcode, self.city,)

Expand All @@ -33,3 +37,6 @@ def get_zoom_level(self):
return 13
return self.zoom

def get_lat_lng(self):
if self.lat and self.lng:
return [self.lat, self.lng]
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{% load i18n %}

<div id="map">
<div id="google-map" style="height:385px; width:auto; display: block;"></div>
</div>

<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key={{ GOOGLE_MAPS_API_KEY }}&amp;hl={{ lang }}"></script>
<script type="text/javascript">
//<![CDATA[
var geocoder;
var map;

var title = "{{ object.get_title }}";
var address = "{{ object.address }}, {{ object.zipcode }} {{ object.city }}";
var zoom = {{ object.get_zoom_level }};

function load()
{
// Create new map object
map = new GMap2(document.getElementById("google-map"));
map.addControl(new GSmallZoomControl());
map.addControl(new GMapTypeControl());

// Create new geocoding object
geocoder = new GClientGeocoder();

// Retrieve location information, pass it to addToMap()
geocoder.getLocations(address, addToMap);
}

// This function adds the point to the map

function addToMap(response)
{
// Retrieve the object
place = response.Placemark[0];

// Retrieve the latitude and longitude
point1 = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);

// Retrieve the latitude and longitude
point2 = new GLatLng(place.Point.coordinates[1] + 0.01,
place.Point.coordinates[0]);

// Center the map on this point
map.setCenter(point2, zoom);

// Create a marker
marker = new GMarker(point1);

// Add the marker to map
map.addOverlay(marker);

// Add address information to marker
marker.openInfoWindowHtml("<strong>" + title + "</strong><br />" + place.address {% ifnotequal map.get_content "" %} + "<br/><br/><i>{{ object.get_content }}</i>"{% endifnotequal %});
}

load();
//]]>
</script>
32 changes: 20 additions & 12 deletions cms/plugins/googlemap/templates/cms/plugins/googlemap.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key={{ GOOGLE_MAPS_API_KEY }}&amp;hl={{ lang }}"></script>
<script type="text/javascript">
//<![CDATA[
function(){
var geocoder;
var map;

Expand All @@ -20,34 +21,40 @@
map = new GMap2(document.getElementById("google-map"));
map.addControl(new GSmallZoomControl());
map.addControl(new GMapTypeControl());


{% if object.get_lat_lng %}
var latLng=new GLatLng({{ object.get_lat_lng|join:", " }});
addToMap(latLng);
{% else %}
// Create new geocoding object
geocoder = new GClientGeocoder();

// Retrieve location information, pass it to addToMap()
geocoder.getLocations(address, addToMap);
geocoder.getLocations(address, onResponse);
{% endif %}
}

// This function adds the point to the map

function addToMap(response)
{
function onResponse(response){
// Retrieve the object
place = response.Placemark[0];

// Retrieve the latitude and longitude
point1 = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);

latLng = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);
addToMap(latLng);
}

function addToMap(latLng)
{
// Retrieve the latitude and longitude
point2 = new GLatLng(place.Point.coordinates[1] + 0.01,
place.Point.coordinates[0]);
center = new GLatLng(latLng.lat() + 0.01, latLng.lng());

// Center the map on this point
map.setCenter(point2, zoom);
map.setCenter(center, zoom);

// Create a marker
marker = new GMarker(point1);
marker = new GMarker(latLng);

// Add the marker to map
map.addOverlay(marker);
Expand All @@ -57,5 +64,6 @@
}

load();
})();
//]]>
</script>
1 change: 0 additions & 1 deletion cms/plugins/link/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from django.utils.translation import ugettext_lazy as _
from cms.models import CMSPlugin, Page
from django.conf import settings
from django.db.models import Q

class Link(CMSPlugin):
"""
Expand Down
2 changes: 1 addition & 1 deletion cms/plugins/snippet/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from cms.models import CMSPlugin
from django.conf import settings
from cms.utils.helpers import reversion_register
from django.db.models import Q


# Stores the actual data
class Snippet(models.Model):
Expand Down
1 change: 0 additions & 1 deletion cms/plugins/teaser/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from django.utils.translation import ugettext_lazy as _
from cms.models import CMSPlugin, Page
from os.path import basename
from django.db.models import Q
from django.conf import settings

class Teaser(CMSPlugin):
Expand Down
1 change: 0 additions & 1 deletion cms/plugins/text/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from django.utils.text import truncate_words
from cms.plugins.text.utils import plugin_admin_html_to_tags,\
plugin_tags_to_admin_html
from django.db.models import Q

class Text(CMSPlugin):
"""A block of content, tied to a page, for a particular language"""
Expand Down
2 changes: 2 additions & 0 deletions example/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@
('pt-br', gettext("Brazil")),
)

DEFAULT_LANGUAGE = 0

CMS_TEMPLATES = (
('index.html', gettext('default')),
('nice.html', gettext('nice one')),
Expand Down
8 changes: 8 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
from setuptools import setup, find_packages
import os

media_files = []

for dirpath, dirnames, filenames in os.walk('cms/media'):
media_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])

setup(
name='django-cms',
version='2.0.0.alpha',
Expand All @@ -10,6 +17,7 @@
'mptt': 'mptt',
'publisher': 'publisher',
},
data_files = media_files,
package_data = {
'cms': [
'templates/admin/cms/mail/*.html',
Expand Down

0 comments on commit 279c990

Please sign in to comment.