Loading...
Searching...
No Matches
QDjango Class Reference
Database

The QDjango class provides a set of static functions. More...

`#include <QDjango.h>`

## Static Public Member Functions

static bool | createTables ()
| Creates the database tables for all registered models.
static bool | dropTables ()
| Drops the database tables for all registered models.
static QSqlDatabase | database ()
| Returns the database used by QDjango.
static void | setDatabase (QSqlDatabase database)
| Sets the database used by QDjango.
static bool | isDebugEnabled ()
| Returns whether debugging information should be printed.
static void | setDebugEnabled (bool enabled)
| Sets whether debugging information should be printed.
template<class T>
static QDjangoMetaModel | registerModel ()

## Friends

class | QDjangoCompiler
class | QDjangoModel
class | QDjangoMetaModel
class | QDjangoQuerySetPrivate

## Detailed Description

The QDjango class provides a set of static functions.

It is used to access registered QDjangoModel classes.

## Member Function Documentation

## createTables()

bool QDjango::createTables | ( |  | ) |

static

Creates the database tables for all registered models.

Returns
  true if all the tables were created, false otherwise.

## database()

QSqlDatabase QDjango::database | ( |  | ) |

static

Returns the database used by QDjango.

If you call this method from any thread but the application's main thread, a new connection to the database will be created. The connection will automatically be torn down once the thread finishes.

See also
  setDatabase()

## dropTables()

bool QDjango::dropTables | ( |  | ) |

static

Drops the database tables for all registered models.

Returns
  true if all the tables were dropped, false otherwise.

## isDebugEnabled()

bool QDjango::isDebugEnabled | ( |  | ) |

static

Returns whether debugging information should be printed.

See also
  setDebugEnabled()

## registerModel()

template<class T>

QDjangoMetaModel QDjango::registerModel | ( |  | ) |

static

Register a QDjangoModel class with QDjango.

## setDatabase()

void QDjango::setDatabase | ( | QSqlDatabase | database | ) |

static

Sets the database used by QDjango.

You must call this method from your application's main thread.

See also
  database()

## setDebugEnabled()

void QDjango::setDebugEnabled | ( | bool | enabled | ) |

static

Sets whether debugging information should be printed.

See also
  isDebugEnabled()

The documentation for this class was generated from the following files:

- QDjango.h
- QDjango.cpp