Index: trunk/webapp/abscontrol/admin.py =================================================================== diff --git a/trunk/webapp/abscontrol/admin.py b/trunk/webapp/abscontrol/admin.py --- a/trunk/webapp/abscontrol/admin.py (revision 147) +++ b/trunk/webapp/abscontrol/admin.py (revision 148) @@ -17,17 +17,26 @@ class PatternInline(admin.StackedInline): model = Pattern + readonly_fields = ['date_create', 'date_modified', 'hits'] + + fieldsets = [ + (None, {'fields': ['value']}), + ('Date information', {'fields': [('date_create', 'date_modified')], 'classes': ['collapse']}), + ('State', {'fields': ['hits', 'state'], 'classes': ['collapse', 'wide', 'extrapretty']}), + ] extra = 0 class ProfileAdmin(admin.ModelAdmin): + readonly_fields = ['date_create', 'date_modified','hits'] fieldsets = [ (None, {'fields': ['name']}), - ('Date information', {'fields': ['date_create', 'date_modified'], 'classes': ['collapse']}), + ('Date information', {'fields': [('date_create', 'date_modified')], 'classes': ['collapse']}), + ('State', {'fields': ['hits', 'state'], 'classes': ['collapse']}), ] inlines = [PatternInline] admin.site.register(Profile, ProfileAdmin) -admin.site.register(Pattern, PatternAdmin) -admin.site.register(AntennaUp) -admin.site.register(AntennaDown) \ No newline at end of file +#admin.site.register(Pattern, PatternAdmin) +#admin.site.register(AntennaUp) +#admin.site.register(AntennaDown) \ No newline at end of file Index: trunk/webapp/abscontrol/urls.py =================================================================== diff --git a/trunk/webapp/abscontrol/urls.py b/trunk/webapp/abscontrol/urls.py --- a/trunk/webapp/abscontrol/urls.py (revision 147) +++ b/trunk/webapp/abscontrol/urls.py (revision 148) @@ -14,4 +14,6 @@ url(r'^(?P\d+)/delete/(?P\d+)/$', 'deletePattern'), #url(r'^(?P\d+)/results/$', 'results'), #url(r'^(?P\d+)/vote/$', 'vote'), + url(r'^import/$', 'importProfile'), + url(r'^saveImport/$', 'saveImport'), ) \ No newline at end of file Index: trunk/webapp/abscontrol/views.py =================================================================== diff --git a/trunk/webapp/abscontrol/views.py b/trunk/webapp/abscontrol/views.py --- a/trunk/webapp/abscontrol/views.py (revision 147) +++ b/trunk/webapp/abscontrol/views.py (revision 148) @@ -235,3 +235,27 @@ newurl = '/abscontrol/edit/%d' % int(profile_id) return redirect(newurl) + +def importProfile(request): + + return render_to_response('abscontrol/import.html', { }) + +def saveImport(request): + if request.method == 'POST': + txtFilename = request.FILES['txtFile'] + if txtFilename: + destination = open('/tmp/'+txtFilename.name, 'wb+') + for chunk in txtFilename.chunks(): + destination.write(chunk) + destination.close() + f = open('/tmp/'+txtFilename.name, 'r') + content = f.read() + #for line in f: + # lsLine = line.readline() + f.close() + #content = lsLine + else: + txtFilename = "Error" + content = "Error" + return render_to_response('abscontrol/upload.html', {'txtFilename': txtFilename, 'content' : content}) + Index: trunk/webapp/templates/abscontrol/import.html =================================================================== diff --git a/trunk/webapp/templates/abscontrol/import.html b/trunk/webapp/templates/abscontrol/import.html new file mode 10644 --- /dev/null (revision 0) +++ b/trunk/webapp/templates/abscontrol/import.html (revision 148) @@ -0,0 +1,16 @@ +{% extends "abscontrol/index.html" %} +{% block title %}ABS CONTROL:::::IMPORT PROFILE{% endblock %} + +{% block content %} +
+
+
+
+ + + +
+
+
+
+{% endblock %} Index: trunk/webapp/templates/abscontrol/index.html =================================================================== diff --git a/trunk/webapp/templates/abscontrol/index.html b/trunk/webapp/templates/abscontrol/index.html --- a/trunk/webapp/templates/abscontrol/index.html (revision 147) +++ b/trunk/webapp/templates/abscontrol/index.html (revision 148) @@ -42,7 +42,7 @@
  • Save
  • {% endif %}
  • Save as
  • -
  • Import
  • +
  • Import
  • Export
  • Apply
  • Index: trunk/webapp/templates/abscontrol/upload.html =================================================================== diff --git a/trunk/webapp/templates/abscontrol/upload.html b/trunk/webapp/templates/abscontrol/upload.html new file mode 10644 --- /dev/null (revision 0) +++ b/trunk/webapp/templates/abscontrol/upload.html (revision 148) @@ -0,0 +1,17 @@ +{% extends "abscontrol/index.html" %} +{% block title %}ABS CONTROL:::::IMPORT PROFILE{% endblock %} + +{% block content %} +
    +
    +
    + + +
    +
    + +

    {{ content }}

    +
    +
    +
    +{% endblock %} Index: trunk/webapp/util/__init__.py =================================================================== diff --git a/trunk/webapp/util/__init__.py b/trunk/webapp/util/__init__.py new file mode 10644 --- /dev/null (revision 0) +++ b/trunk/webapp/util/__init__.py (revision 148) Index: trunk/webapp/util/readABSFile.py =================================================================== diff --git a/trunk/webapp/util/readABSFile.py b/trunk/webapp/util/readABSFile.py new file mode 10644 --- /dev/null (revision 0) +++ b/trunk/webapp/util/readABSFile.py (revision 148) @@ -0,0 +1,20 @@ +''' +Created on May 2, 2013 + +@author: Jose Antonio Sal y Rosas Celi +@contact: jose.salyrosas@jro.igp.gob.pe +''' + +class readABSFile(object): + + __scriptName = "readABSFile.py" + + def __init__(self, filename): + self.fileName = filename + + def readFile(self): + destination = open(self.fileName, 'wb+') + + destination.close() + + \ No newline at end of file