Commits

George Notaras committed de93015

Fixed model imports

  • Participants
  • Parent commits 136204d

Comments (0)

Files changed (5)

File src/PostgreSQL_manager/admin.py

         return qs.filter(created_by=request.user)
     
     def save_model(self, request, obj, form, change):
-        PgUser = cache.get_model('pgmanager', 'PgUser')
+        PgUser = cache.get_model('PostgreSQL_manager', 'PgUser')
         password = form.cleaned_data.get('password1')
         
         if not change:  # User creation form
         # Save the model
         obj.save()
 
-admin.site.register(cache.get_model('pgmanager', 'PgUser'), PgUserAdmin)
+admin.site.register(cache.get_model('PostgreSQL_manager', 'PgUser'), PgUserAdmin)
 
 
 
         return super(PgDatabaseAdmin, self).get_readonly_fields(request, obj)
     
     def formfield_for_foreignkey(self, db_field, request, **kwargs):
-        PgUser = cache.get_model('pgmanager', 'PgUser')
+        PgUser = cache.get_model('PostgreSQL_manager', 'PgUser')
         if db_field.name == 'owner':
             if not request.user.is_superuser:
                 kwargs['queryset'] = PgUser.objects.filter(created_by=request.user)
         return qs.filter(created_by=request.user)
     
     def save_model(self, request, obj, form, change):
-        PgDatabase = cache.get_model('pgmanager', 'PgDatabase')
+        PgDatabase = cache.get_model('PostgreSQL_manager', 'PgDatabase')
         
         if not change:  # Database creation form
             
         # Save the model
         obj.save()
 
-admin.site.register(cache.get_model('pgmanager', 'PgDatabase'), PgDatabaseAdmin)
+admin.site.register(cache.get_model('PostgreSQL_manager', 'PgDatabase'), PgDatabaseAdmin)
 
 

File src/PostgreSQL_manager/forms.py

 class PgUserModelForm(forms.ModelForm):
 
     class Meta:
-        model = cache.get_model('pgmanager', 'PgUser')
+        model = cache.get_model('PostgreSQL_manager', 'PgUser')
     
     # Adds two extra password fields, which will be used for password confirmation.
     password1 = forms.CharField(label='Password', required=False, widget=forms.PasswordInput, help_text="Valid characters a-z, A-Z, 0-9 and the underscore '_'")

File src/PostgreSQL_manager/managers.py

 
 class BasePgManager(models.Manager):
     
-    PGMANAGER_DB_ALIAS = 'pgmanager_conn'
+    PGMANAGER_DB_ALIAS = 'PostgreSQL_manager_conn'
     
     def execute_custom_query(self, sql):
         connection = connections[self.PGMANAGER_DB_ALIAS]

File src/PostgreSQL_manager/models.py

 class PgDatabase(models.Model):
     
     name = models.SlugField(verbose_name='name', max_length=100, db_index=True, unique=True, help_text='''Enter a name for the PostgreSQL database. Note that the database name will be prefixed with your Primary Panel username.''')
-    owner = models.ForeignKey('pgmanager.PgUser', related_name='%(class)s_owner')
+    owner = models.ForeignKey('PostgreSQL_manager.PgUser', related_name='%(class)s_owner')
     connlimit = models.IntegerField(default=-1, help_text='''Enter the number of concurrent connections that can be made to this database. -1 means no limit.''')
     
     date_created = models.DateTimeField(verbose_name='created on', auto_now_add=True)

File src/PostgreSQL_manager/signal_cb.py

 
 
 def dbms_drop_role(sender, **kwargs):
-    PgUser = cache.get_model('pgmanager', 'PgUser')
+    PgUser = cache.get_model('PostgreSQL_manager', 'PgUser')
     instance = kwargs['instance']
     PgUser.objects.drop_role(instance.name)
 
     
 def dbms_drop_database(sender, **kwargs):
-    PgDatabase = cache.get_model('pgmanager', 'PgDatabase')
+    PgDatabase = cache.get_model('PostgreSQL_manager', 'PgDatabase')
     instance = kwargs['instance']
     PgDatabase.objects.drop_database(instance.name)