diff options
-rw-r--r-- | gstudio/models.py | 2 | ||||
-rw-r--r-- | majorproj/gnowsys-studio/gstudio/templates/gstudio/base.html | 110 | ||||
-rw-r--r-- | objectapp/views/dynamicAT.py | 28 |
3 files changed, 126 insertions, 14 deletions
diff --git a/gstudio/models.py b/gstudio/models.py index 87ff155..86fa130 100644 --- a/gstudio/models.py +++ b/gstudio/models.py @@ -2164,7 +2164,7 @@ class AttributeFilePathField(Attribute): class AttributeImageField(Attribute): - value = models.ImageField(upload_to='media/'+UPLOAD_TO, verbose_name='image') + value = models.ImageField(upload_to = UPLOAD_TO, verbose_name='image') def __unicode__(self): return self.title diff --git a/majorproj/gnowsys-studio/gstudio/templates/gstudio/base.html b/majorproj/gnowsys-studio/gstudio/templates/gstudio/base.html new file mode 100644 index 0000000..db8b28b --- /dev/null +++ b/majorproj/gnowsys-studio/gstudio/templates/gstudio/base.html @@ -0,0 +1,110 @@ +{% extends "gstudio/skeleton.html" %} +{% load gstudio_tags i18n %} +{% load objectapp_tags i18n %} + + {% block meta %} + <meta name="generator" content="Objectapp {{ OBJECTAPP_VERSION }}" /> +{% endblock %} + +{% block link %} + <link rel="index" href="{% url objectapp_gbobject_archive_index %}" /> + <link rel="EditURI" type="application/rsd+xml" href="{% url objectapp_rsd %}" /> + <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="{% url objectapp_wlwmanifest %}" /> + <link rel="search" type="application/opensearchdescription+xml" title="Objectapp's Blog" href="{% url objectapp_opensearch %}" /> + <link rel="alternate" type="application/rss+xml" title="{% trans "RSS Feed of latest gbobjects" %}" href="{% url objectapp_gbobject_latest_feed %}" /> + <!-- {% get_archives_gbobjects "objectapp/tags/archives_gbobjects_link.html" %} --> +{% endblock %} + +{% block breadcrumbs %} + {% gstudio_breadcrumbs %} +{% endblock %} + +{% block sidebar %} + <img src="{{ STATIC_URL }}objectapp/img/rss.png" alt="?" width="20" height="" /> + <a href="{% url gstudio_nodetype_latest_feed %}" class="feeds"><h4>Rssfeed</h4></a> + +<div class="search"> + <h3>{% trans "Search" %}</h3> + <form method="get" id="searchform" action="{% url nodes_search %}"> + <p> + <input type="text" value="{% trans "Keywords..." %}" name="pattern" id="searchbox" onfocus="this.value=''" /> + <input type="submit" class="submitbutton" value="OK" /> + <a title="{% trans 'You can use - to exclude words or phrases, "double quotes" for exact phrases and the AND/OR boolean operators combined with parenthesis for complex searchs.' %}"> + <img src="{{ STATIC_URL }}objectapp/img/help.png" alt="?" width="14" height="14" /> + </a> + </p> + </form> +</div> +<!-- +<div class="objecttypes"> + <h3>{% trans "Objecttypes" %}</h3> + {% get_objecttypes %} +</div> +--> +<div class="authors"> + <h3>{% trans "Authors" %}</h3> + {% get_authors %} +</div> +<div class="calendar"> + <h3>{% trans "Calendar" %}</h3> + {% get_calendar_gbobjects %} +</div> +<div class="tags"> + <h3>{% trans "Tags" %}</h3> + {% get_tag_cloud %} +</div> +<div class="recents"> + <h3>{% trans "Recent gbobjects" %}</h3> + {% get_recent_gbobjects 5 %} +</div> +<div class="comments"> + <h3>{% trans "Recent comments" %}</h3> + {% get_recent_comments 5 %} +</div> +<div class="linkbacks"> + <h3>{% trans "Recent linkbacks" %}</h3> + {% get_recent_linkbacks 5 %} +</div> +<div class="randoms"> + <h3>{% trans "Random gbobjects" %}</h3> + {% get_random_gbobjects 5 %} +</div> +<div class="populars"> + <h3>{% trans "Popular gbobjects" %}</h3> + {% get_popular_gbobjects 5 %} +</div> +<div class="archives"> + <h3>{% trans "Archives" %}</h3> + {% get_archives_gbobjects_tree %} +</div> +{% if user.is_authenticated %} +<div class="tools"> + <h3>{% trans "Tools" %}</h3> + <ul> + {% if perms.objectapp %} + <li> + <a href="{% url admin:app_list "objectapp" %}" title="{% trans "Dashboard" %}"> + {% trans "Dashboard" %} + </a> + </li> + {% endif %} + {% if perms.objectapp.add_gbobject %} + <li> + <a href="{% url admin:objectapp_gbobject_add %}" title="{% trans "Post an gbobject" %}"> + {% trans "Post an gbobject" %} + </a> + </li> + {% endif %} + {% block admin_tools %} + {% endblock %} + <li> + <a href="{% url admin:logout %}" title="{% trans "Log out" %}"> + {% trans "Log out" %} + </a> + </li> + </ul> +</div> +{% endif %} +{% endblock %} + + diff --git a/objectapp/views/dynamicAT.py b/objectapp/views/dynamicAT.py index a5d71de..81d442f 100644 --- a/objectapp/views/dynamicAT.py +++ b/objectapp/views/dynamicAT.py @@ -11,23 +11,18 @@ from objectapp.forms import * from gstudio.models import * from gstudio.admin.forms import * + + def MakeForm(model_cls, *args, **kwargs): class ContextForm(ModelForm): class Meta: model = model_cls.values()[0] - print 'model' ,model fields = ('value',) - print 'fields',fields - - def __init__(self, *args, **kwargs): - - super(ContextForm,self).__init__(*args, **kwargs) - + # def __init__(self, *args, **kwargs): + # super(ContextForm,self).__init__(*args, **kwargs) return ContextForm(*args, **kwargs) - - def dynamic_save(request, attit, memtit): rdict ={} savedict = {} @@ -39,17 +34,24 @@ def dynamic_save(request, attit, memtit): at = Attributetype.objects.get(title = str(attit)) dt = str(at.get_dataType_display()) MyModel = eval('Attribute'+dt) - + + print getattr(models , dt) + + list1 = [] + rdict.update({str(at.title):MyModel}) + print "rdict",str(rdict) + print 'dt ',dt if request.method == 'POST': form = MakeForm(rdict,request.POST,request.FILES) try: if form.is_valid(): value = form.cleaned_data['value'] - - if Attribute.objects.filter(subject = memtit.id) and Attribute.objects.filter(attributetype = at.id): + + + if Attribute.objects.filter(subject = memtit.id , attributetype = at.id): att = Attribute.objects.get(subject = memtit.id, attributetype = at.id) att.delete() del att @@ -72,7 +74,7 @@ def dynamic_save(request, attit, memtit): template = "objectapp/fillAT.html" - context = RequestContext(request,{'form' : form,'title':str(attit), 'absolute_url_node':absolute_url_node}) + context = RequestContext(request,{'form' : form,'title':str(attit), 'absolute_url_node':absolute_url_node, 'datatype':dt}) return render_to_response(template,context) |