Fixed 'adding members by web form' feature:
* It now just not only updates the existing members, but also adds new members that are approved. * add 'author_surname' field for the admin view, in admin.py
This commit is contained in:
parent
ed235f018d
commit
cb90ae2092
|
@ -14,7 +14,7 @@ from djagen.collector.configini import *
|
||||||
|
|
||||||
class AuthorsAdmin (admin.ModelAdmin):
|
class AuthorsAdmin (admin.ModelAdmin):
|
||||||
|
|
||||||
list_display = ('author_id', 'author_name', 'author_email', 'author_face', 'current_status', 'is_approved', 'label_personal', 'label_lkd', 'label_community', 'label_eng')
|
list_display = ('author_id', 'author_name','author_surname' ,'author_email', 'author_face', 'current_status', 'is_approved', 'label_personal', 'label_lkd', 'label_community', 'label_eng')
|
||||||
list_select_related = True
|
list_select_related = True
|
||||||
|
|
||||||
search_fields = ['author_name', 'author_surname', 'author_email']
|
search_fields = ['author_name', 'author_surname', 'author_email']
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Handler:
|
||||||
self.id = id
|
self.id = id
|
||||||
|
|
||||||
self.tmp_entries_ini = os.path.join(settings.MAIN_PATH, 'tmp_ini', 'tmp_entries.ini')
|
self.tmp_entries_ini = os.path.join(settings.MAIN_PATH, 'tmp_ini', 'tmp_entries.ini')
|
||||||
|
|
||||||
self.config_header_ini = os.path.join(settings.MAIN_PATH, 'gezegen', 'config_header.ini')
|
self.config_header_ini = os.path.join(settings.MAIN_PATH, 'gezegen', 'config_header.ini')
|
||||||
|
|
||||||
self.config_entries_ini = os.path.join(settings.MAIN_PATH, 'gezegen', 'config_entries.ini')
|
self.config_entries_ini = os.path.join(settings.MAIN_PATH, 'gezegen', 'config_entries.ini')
|
||||||
|
@ -21,6 +21,8 @@ class Handler:
|
||||||
def __set_values(self):
|
def __set_values(self):
|
||||||
|
|
||||||
author = Authors.objects.get(author_id = self.id)
|
author = Authors.objects.get(author_id = self.id)
|
||||||
|
print author
|
||||||
|
print author.author_id
|
||||||
|
|
||||||
if not author.is_approved:
|
if not author.is_approved:
|
||||||
return False
|
return False
|
||||||
|
@ -29,7 +31,7 @@ class Handler:
|
||||||
self.surname = author.author_surname
|
self.surname = author.author_surname
|
||||||
self.face = author.author_face
|
self.face = author.author_face
|
||||||
self.url = author.channel_url
|
self.url = author.channel_url
|
||||||
|
|
||||||
labels = {
|
labels = {
|
||||||
author.label_personal:'Personal',
|
author.label_personal:'Personal',
|
||||||
author.label_lkd: 'LKD',
|
author.label_lkd: 'LKD',
|
||||||
|
@ -43,7 +45,7 @@ class Handler:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def create_tmp_entries(self):
|
def create_tmp_entries(self):
|
||||||
|
|
||||||
if not self.__set_values(): return
|
if not self.__set_values(): return
|
||||||
|
|
||||||
config_entries = open(self.config_entries_ini)
|
config_entries = open(self.config_entries_ini)
|
||||||
|
@ -56,6 +58,7 @@ class Handler:
|
||||||
header = config_header.read()
|
header = config_header.read()
|
||||||
config_header.close()
|
config_header.close()
|
||||||
tmp_entries.write(header)
|
tmp_entries.write(header)
|
||||||
|
found = False
|
||||||
for section in sections:
|
for section in sections:
|
||||||
if (section == 'Planet'):
|
if (section == 'Planet'):
|
||||||
continue
|
continue
|
||||||
|
@ -71,6 +74,7 @@ class Handler:
|
||||||
config_face = None
|
config_face = None
|
||||||
|
|
||||||
if config_id == self.id:
|
if config_id == self.id:
|
||||||
|
found = True
|
||||||
|
|
||||||
url = self.url
|
url = self.url
|
||||||
face = self.face
|
face = self.face
|
||||||
|
@ -98,5 +102,22 @@ class Handler:
|
||||||
|
|
||||||
tmp_entries.write(s)
|
tmp_entries.write(s)
|
||||||
|
|
||||||
|
if found != True:
|
||||||
|
url = self.url
|
||||||
|
face = self.face
|
||||||
|
name = self.name
|
||||||
|
surname = self.surname
|
||||||
|
label = self.author_labels
|
||||||
|
|
||||||
|
id = self.id
|
||||||
|
s = '['+url+']' + '\n'
|
||||||
|
s += 'name = ' + name + '\n'
|
||||||
|
s += 'surname = ' + surname + '\n'
|
||||||
|
s += 'label = ' + label + '\n'
|
||||||
|
if face:
|
||||||
|
s += 'face = ' + face + '\n'
|
||||||
|
s += 'id = ' + str(id) + '\n' + '\n'
|
||||||
|
tmp_entries.write(s)
|
||||||
|
|
||||||
tmp_entries.close()
|
tmp_entries.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user