Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Author/Email fields and filtered views now active, email and author a…

…re now mandatory in the DB
  • Loading branch information...
commit 1d84b71ac056e0ac90e7b94b318d1242a5e4c643 1 parent b61e9a2
@elpaso elpaso authored
View
8 qgis-app/plugins/docs/metadata.rst
@@ -2,7 +2,7 @@
Metadata
--------
-Plugins mandatory metadata [#f1]_ are read from both the old `__init__.py` functions format
+Plugins mandatory metadata are read from both the old `__init__.py` functions format
and (if present) the new `metadata.txt` file.
Valid metadata for the `__init__` file are:
@@ -78,9 +78,3 @@ Example configuration file::
repository=http://www.itopen.it/repo
icon=icon.png
-
-
-.. rubric:: Footnotes
-
-.. [#f1] 'name', 'description', 'version', 'qgisMinimumVersion', 'author', 'email'
-.. [#f2] Supported by metadata.txt only: 'homepage', 'changelog', 'tracker', 'repository', 'tags'
View
112 qgis-app/plugins/migrations/0006_auto__chg_field_plugin_author__chg_field_plugin_email.py
@@ -0,0 +1,112 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+
+ # Changing field 'Plugin.author'
+ db.alter_column('plugins_plugin', 'author', self.gf('django.db.models.fields.CharField')(default='empty', max_length=256))
+
+ # Changing field 'Plugin.email'
+ db.alter_column('plugins_plugin', 'email', self.gf('django.db.models.fields.EmailField')(default='empty', max_length=75))
+
+ def backwards(self, orm):
+
+ # Changing field 'Plugin.author'
+ db.alter_column('plugins_plugin', 'author', self.gf('django.db.models.fields.CharField')(max_length=256, null=True))
+
+ # Changing field 'Plugin.email'
+ db.alter_column('plugins_plugin', 'email', self.gf('django.db.models.fields.EmailField')(max_length=75, null=True))
+
+ models = {
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'plugins.plugin': {
+ 'Meta': {'ordering': "('name',)", 'object_name': 'Plugin'},
+ 'author': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
+ 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'plugins_created_by'", 'to': "orm['auth.User']"}),
+ 'created_on': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'deprecated': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'description': ('django.db.models.fields.TextField', [], {}),
+ 'downloads': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
+ 'featured': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'homepage': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
+ 'icon': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'modified_on': ('django.db.models.fields.DateTimeField', [], {}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '256'}),
+ 'owners': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
+ 'package_name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '256'}),
+ 'repository': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
+ 'tracker': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'})
+ },
+ 'plugins.pluginversion': {
+ 'Meta': {'ordering': "('plugin', '-version', 'experimental')", 'unique_together': "(('plugin', 'version'),)", 'object_name': 'PluginVersion'},
+ 'approved': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'changelog': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
+ 'created_on': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'downloads': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'experimental': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'min_qg_version': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+ 'package': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
+ 'plugin': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['plugins.Plugin']"}),
+ 'version': ('django.db.models.fields.CharField', [], {'max_length': '32'})
+ },
+ 'taggit.tag': {
+ 'Meta': {'object_name': 'Tag'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'})
+ },
+ 'taggit.taggeditem': {
+ 'Meta': {'object_name': 'TaggedItem'},
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
+ 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"})
+ }
+ }
+
+ complete_apps = ['plugins']
View
4 qgis-app/plugins/models.py
@@ -105,8 +105,8 @@ class Plugin (models.Model):
# owners
created_by = models.ForeignKey(User, verbose_name=_('Created by'), related_name = 'plugins_created_by')
- author = models.CharField(_('Author'), help_text=_('This is the plugin\'s original author, if different from the uploader, this field will appear in the XML and in the web GUI'), max_length=256, null=True, blank=True)
- email = models.EmailField(_('Author email'), null=True, blank=True)
+ author = models.CharField(_('Author'), help_text=_('This is the plugin\'s original author, if different from the uploader, this field will appear in the XML and in the web GUI'), max_length=256)
+ email = models.EmailField(_('Author email'))
homepage = models.URLField(_('Plugin homepage'), verify_exists=False, blank=True, null=True)
# Support
repository = models.URLField(_('Code repository'), verify_exists=False, blank=True, null=True)
View
2  qgis-app/plugins/templates/plugins/plugin_detail.html
@@ -5,7 +5,7 @@
{% if object.deprecated %}<p class="error"><strong>{% trans "This plugin is deprecated!" %}</strong></p>{% endif %}
<p>{% if object.icon %}<img class="plugin-icon" src="{{ object.icon.url }}" alt="{% trans "Plugin icon" %}" />{% endif %}<strong>{% trans "Description" %}:</strong> {{ object.description }}</p>
{% if object.author %}
- <p><strong>{% trans "Author"%}:</strong> {{ object.author }}</p>
+ <p><strong>{% trans "Author"%}:</strong> <a title="{% trans "Plugins by"%} {{ object.author }}" href="{% url author_plugins object.author|urlencode %}">{{ object.author }}</a></p>
{% endif %}
{% if object.email and not user.is_anonymous %}
<p><strong>{% trans "Author's email"%}:</strong> <a href="mailto:{{ object.email }}">{{ object.email }}</a></p>
View
4 qgis-app/plugins/templates/plugins/plugin_list.html
@@ -58,7 +58,7 @@
{% if not user.is_anonymous %}<th><img title="{% trans "Approved" %}" src="/static/images/tick_16.png" alt="{% trans "Approved" %}"/></th>{% endif %}
<th>{% anchor featured %}</th>
<th>{% anchor downloads %}</th>
- <th>{% anchor created_by "Maintainer" %}</th>
+ <th>{% anchor author "Author" %}</th>
<th>{% anchor modified_on "Last modified" %}</th>
<th>{% trans "Stable" %}</th>
<th>{% trans "Exp." %}</th>
@@ -75,7 +75,7 @@
{% if not user.is_anonymous %}<td>{% if object.approved %}<img src="/static/images/tick_16.png" />{% else %}<img src="/static/images/delete_16.png" />{% endif %}</td>{% endif %}
<td>{% if object.featured%}<img src="/static/images/tick_16.png" />{% else %}<img src="/static/images/delete_16.png" />{% endif %}</td>
<td>{{ object.downloads }}</td>
- <td><a title="{{ object.created_by.get_full_name }}" href="{% url user_details object.created_by %}">{{ object.created_by }}</a></td>
+ <td><a title="{% trans "Plugins by"%} {{ object.author }}" href="{% url author_plugins object.author|urlencode %}">{{ object.author }}</a></td>
<td>{{ object.modified_on|naturalday }}</td>
<td>{% if object.stable %}<a href="{% url version_download object.package_name object.stable.version %}" title="{% trans "Download the stable version" %}" >{{ object.stable.version }}</a>{% else %}&mdash;{% endif %}</td>
<td>{% if object.experimental %}<a href="{% url version_download object.package_name object.experimental.version %}" title="{% trans "Download the experimental version" %}" >{{ object.experimental.version }}</a>{% else %}&mdash;{% endif %}</td>
View
3  qgis-app/plugins/urls.py
@@ -31,6 +31,9 @@
url(r'^stable/$', 'plugins_list', {'queryset' : Plugin.stable_objects.all(), 'extra_context' : {'title' : _('Stable plugins')}}, name='stable_plugins'),
url(r'^experimental/$', 'plugins_list', {'queryset' : Plugin.experimental_objects.all(), 'extra_context' : {'title' : _('Experimental plugins')}}, name='experimental_plugins'),
url(r'^popular/$', 'plugins_list', {'queryset' : Plugin.popular_objects.all(), 'extra_context' : {'title' : _('Popular plugins')}}, name='popular_plugins'),
+
+ url(r'^author/(?P<author>[\sa-zA-Z0-9_%.-]+)/$', 'author_plugins', {}, name='author_plugins'),
+
)
View
16 qgis-app/plugins/views.py
@@ -408,6 +408,22 @@ def plugin_manage(request, package_name):
return HttpResponseRedirect(reverse('user_details', args=[username]))
+
+###############################################
+
+# Author functions
+
+###############################################
+
+def author_plugins(request, author):
+ """
+ List plugins from author
+ """
+ queryset = Plugin.approved_objects.filter(author=author)
+ return plugins_list(request, queryset, template_name = 'plugins/plugin_list.html', extra_context = { 'title' : _('Plugins by %s') % author})
+
+
+
###############################################
# User management functions
Please sign in to comment.
Something went wrong with that request. Please try again.