Skip to content

Instantly share code, notes, and snippets.

@lprsd
Created July 15, 2011 08:36
Show Gist options
  • Save lprsd/1084329 to your computer and use it in GitHub Desktop.
Save lprsd/1084329 to your computer and use it in GitHub Desktop.
def get_form(self, request, obj=None):
form = super(WapSiteAdmin,self).get_form(request, obj)
pl = Platform.objects.get(id=obj.platform_type_id)
rev_alert=WapSite.objects.filter(pub=obj.pub,pub_share__gt= str(obj.pub_share)).count()
if rev_alert !=0:
rev_msg='<b style ="color:red;">Please check the rev share ,publisher has got sites running on rev share greater then this</b>'
else:
rev_msg='<b>Please select the rev_share</b>'
messege = 'Click here to get filter info'
help_text4site = "<a href='../../filterInfo/?entity=site&id=%s' > %s </a> <br/>" %(obj.id,messege)
if obj.platform_type_id==2:
help_store="<a href='../../iphonestore/%s'>%s</a>"%(obj.store_id,'click here to see the store details')
else:
help_store="%s"%('Normal ads does not have store')
if obj.status!='incomplete':
url=WapSite.objects.filter(site_url__icontains=obj.site_url).count()
if url>1:
url_msg='<a href ="../?q=%s&status__exact=activated"><b style ="color:red;">This url has been registered with us %s times.</b></a>'%(obj.site_url,url)
form.base_fields['site_url'].help_text = url_msg
rejUser=WapUser.objects.filter(user_status='rejected')
c=0
if obj.pub.login_id is not None:
login_id=obj.pub.login_id
for user in rejUser:
if (user.user_email).lower().find((obj.pub.user_email).lower())!=-1 or (user.login_id).lower().find((obj.pub.login_id).lower()) or (WapSite.objects.filter(site_url__icontains=obj.site_url).count())!=0:
c=c+1
if c>0:
alert_msg="<a href='../?q=%s&status__exact=all'><b style ='color:red;'>Please check the user of the site.Its matches with login_id or email_id or site url of rejected users</b></a>"%(obj.site_url)
form.base_fields['id'].help_text = alert_msg
help_platform = "<font size=2><b>%s</b></font>"%((pl.name).upper())
form.base_fields['platform_type'].help_text = help_platform
form.base_fields['pub_share'].help_text = rev_msg
form.base_fields['store_id'].help_text = help_store
form.base_fields['site_name'].help_text = help_text4site
return form
@lprsd
Copy link
Author

lprsd commented Jul 15, 2011

fieldsets = [
    ('Basic Site Information', {'fields': ['platform_type','store_id','site_name','site_url','id','critical_nfr','blocked'], 'classes': ['collapse'] }),
    ('Action', {'fields': ['site_type_id','status', 'last_reject','reason_for_reject','allow_adult_ad','ad_approval','network_type','allow_banner_ad','pub_share','new_pub_share','accept_demog','ref_tag_enabled','content_preferences','site_category','allow_default_tags','tags'],'classes':['foobar']}),

    ('IB',{'fields':['flex_category','currency_name','secret_key','site_api_url','exchange_rate_cents'],'classes':['foobar']}),
    ('Other Details', {'fields': ['earning'], 'classes':['collapse']})
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment